oga 2.8 → 2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ce7108284cc8de9b510d9cdbfe16cdfafef042e
4
- data.tar.gz: b3b633bcea752cf76284f0a5963628c5645d081b
3
+ metadata.gz: 50b5eac4cf1caefe82ec313588b10244f41d9d9e
4
+ data.tar.gz: 8384365d741110e61afb7a9010f4b792b418d286
5
5
  SHA512:
6
- metadata.gz: f761cac6f7431ef2843bc818a5c3103243f744d2163ee35b9efed46e1debb53da626acf76a2b33ba5eb820a064f5298187b97c14ce4c21fa5e00663a2d30ea11
7
- data.tar.gz: 938f57cce3403ffd8aa8b830be1415957b73a1b18afd32608cc9ebd9ceb42a3592cded188ebfcd28a8f84ea35dd7e5943a90aac67f7d403567173d3d9c7d9f9d
6
+ metadata.gz: c00fa4fbe27a8a31e655011190c7c87c9b7eddf54071e3c99d0fefe0b136f1ef7b8d6effdd20896f2b1f14eff28e4110b72e504dab406671b3624f008a88b1d3
7
+ data.tar.gz: fa02ff9fa46578343abc34c9f566a6d88e4e704348e4440f4b9b822c7dcd66ed03acc66ca4d663f04a8da7fc4a1434ca23e89f53e904dbe32d5199b3126bbdd4
@@ -1,3 +1,3 @@
1
1
  module Oga
2
- VERSION = '2.8'
2
+ VERSION = '2.9'
3
3
  end # Oga
@@ -1,9 +1,7 @@
1
1
  module Oga
2
2
  module XML
3
3
  # Class used for storing information about Doctypes.
4
- class Doctype
5
- include ToXML
6
-
4
+ class Doctype < Node
7
5
  # The name of the doctype (e.g. "HTML").
8
6
  # @return [String]
9
7
  attr_accessor :name
@@ -7,6 +7,11 @@ module Oga
7
7
  include Traversal
8
8
  include ToXML
9
9
 
10
+ # The doctype of the document.
11
+ #
12
+ # When parsing a document this attribute will be set automatically if a
13
+ # doctype resides at the root of the document.
14
+ #
10
15
  # @return [Oga::XML::Doctype]
11
16
  attr_accessor :doctype
12
17
 
@@ -136,7 +136,9 @@ module Oga
136
136
  end
137
137
 
138
138
  if self_closing?(element)
139
- output << "<#{name}#{attrs} />"
139
+ closing_tag = html_void_element?(element) ? '>' : ' />'
140
+
141
+ output << "<#{name}#{attrs}#{closing_tag}"
140
142
  else
141
143
  output << "<#{name}#{attrs}>"
142
144
  end
@@ -214,6 +216,10 @@ module Oga
214
216
  element.children.empty?
215
217
  end
216
218
  end
219
+
220
+ def html_void_element?(element)
221
+ @html_mode && HTML_VOID_ELEMENTS.allow?(element.name)
222
+ end
217
223
  end
218
224
  end
219
225
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oga
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.8'
4
+ version: '2.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yorick Peterse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast