nokogiri 1.6.3.rc2-java → 1.6.3.rc3-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5fe2e8d07f52df71f080e08f85e149374fbcabbd
4
- data.tar.gz: f924e1807f51738cd1a0b58f14493c0684629510
3
+ metadata.gz: 76cd7f9d1052ba69f2a34be1bb3fbb4c605560e4
4
+ data.tar.gz: 6439b977d5972946a353d619809768a099e96e3d
5
5
  SHA512:
6
- metadata.gz: b4353244adddeb08c390f4ebc5f80b96de03fc034cd8d001cd989fb1fed02a9715dbd07b0b9fb14dffb3b5d66a6c7e540fc7cebab11afdb210d7c739ffeef59b
7
- data.tar.gz: 381222c91a0c88f0ad65a89d94fd28ce672c2e356d45be52cad896ab8fe6b0a0f68691947fb64bb7289daf2522882f063f9cc1ff56554aed837e78633d95cc14
6
+ metadata.gz: 4e47f8b7d7a34e13d2ff8dfc1d9b3ecb5b6ace664c836da42a9fc49a3d0e9bd57a9a06f65628a2ffedb2be58290a72a69f6c6eed10b3703bbeb04a0716a43088
7
+ data.tar.gz: 5090be6e68a1e360973fa4e19f5a6eca2bda8e8d4b25ab4791cfbde45e4a8b2343053c72ad3776c3d09a26bbdb918f4934885af15387fde7da00718dfb1b69a0
@@ -1,10 +1,17 @@
1
1
  === 1.6.3 / unreleased
2
2
 
3
+ ==== Features
4
+
5
+ * Added Node#document? and Node#processing_instruction?
6
+
7
+
3
8
  ==== Bug fixes
4
9
 
5
10
  * [JRuby] Fix Ruby memory exhaustion vulnerability. #1087 (Thanks, @ocher)
6
11
  * [MRI] Fix segfault during GC when using `libxml-ruby` and `nokogiri` together in multi-threaded environment. #895 (Thanks, @ender672!)
7
12
  * Building on OSX 10.9 stock ruby 2.0.0 now works. #1101 (Thanks, @zenspider!)
13
+ * Node#parse now works again for HTML document nodes (broken in 1.6.2+).
14
+ * Processing instructions can now be added via Node#add_next_sibling.
8
15
 
9
16
 
10
17
  === 1.6.2.1 / 2014年5月13日
@@ -1,10 +1,17 @@
1
1
  === 1.6.3 / unreleased
2
2
 
3
+ ==== Features
4
+
5
+ * Added Node#document? and Node#processing_instruction?
6
+
7
+
3
8
  ==== Bug fixes
4
9
 
5
10
  * [JRuby] Fix Ruby memory exhaustion vulnerability. #1087 (Thanks, @ocher)
6
11
  * [MRI] Fix segfault during GC when using `libxml-ruby` and `nokogiri` together in multi-threaded environment. #895 (Thanks, @ender672!)
7
12
  * Building on OSX 10.9 stock ruby 2.0.0 now works. #1101 (Thanks, @zenspider!)
13
+ * Node#parse now works again for HTML document nodes (broken in 1.6.2+).
14
+ * Processing instructions can now be added via Node#add_next_sibling.
8
15
 
9
16
 
10
17
  === 1.6.2.1 / 2014-05-13
Binary file
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.6.3.rc2'
3
+ VERSION = '1.6.3.rc3'
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -287,7 +287,7 @@ module Nokogiri
287
287
  def prepend_child node_or_tags
288
288
  if first = children.first
289
289
  # Mimic the error add_child would raise.
290
- raise RuntimeError, "Document already has a root node" if is_a?(XML::Document) && !node_or_tags.is_a?(XML::ProcessingInstruction)
290
+ raise RuntimeError, "Document already has a root node" if document? && !node_or_tags.processing_instruction?
291
291
  first.__send__(:add_sibling, :previous, node_or_tags)
292
292
  else
293
293
  add_child(node_or_tags)
@@ -313,7 +313,7 @@ module Nokogiri
313
313
  #
314
314
  # Also see related method +before+.
315
315
  def add_previous_sibling node_or_tags
316
- raise ArgumentError.new("A document may not have multiple root nodes.") if parent.is_a?(XML::Document) && !node_or_tags.is_a?(XML::ProcessingInstruction)
316
+ raise ArgumentError.new("A document may not have multiple root nodes.") if (parent && parent.document?) && !node_or_tags.processing_instruction?
317
317
 
318
318
  add_sibling :previous, node_or_tags
319
319
  end
@@ -326,7 +326,7 @@ module Nokogiri
326
326
  #
327
327
  # Also see related method +after+.
328
328
  def add_next_sibling node_or_tags
329
- raise ArgumentError.new("A document may not have multiple root nodes.") if parent.is_a?(XML::Document)
329
+ raise ArgumentError.new("A document may not have multiple root nodes.") if (parent && parent.document?) && !node_or_tags.processing_instruction?
330
330
 
331
331
  add_sibling :next, node_or_tags
332
332
  end
@@ -513,7 +513,7 @@ module Nokogiri
513
513
  # document as the parsing context instead. Otherwise, the in-context
514
514
  # parser cannot find an element or a document node.
515
515
  # Document Fragments are also not usable by the in-context parser.
516
- if !element? && !xml? && (!parent || parent.fragment?)
516
+ if !element? && !document? && (!parent || parent.fragment?)
517
517
  return document.parse(string_or_io, options)
518
518
  end
519
519
 
@@ -601,6 +601,16 @@ module Nokogiri
601
601
  type == HTML_DOCUMENT_NODE
602
602
  end
603
603
 
604
+ # Returns true if this is a Document
605
+ def document?
606
+ is_a? XML::Document
607
+ end
608
+
609
+ # Returns true if this is a ProcessingInstruction node
610
+ def processing_instruction?
611
+ type == PI_NODE
612
+ end
613
+
604
614
  # Returns true if this is a Text node
605
615
  def text?
606
616
  type == TEXT_NODE
@@ -136,7 +136,29 @@ module Nokogiri
136
136
  def test_parse_with_unparented_text_context_node
137
137
  doc = XML::Document.new
138
138
  elem = XML::Text.new("foo", doc)
139
- elem.parse("<bar/>")
139
+ x = elem.parse("<bar/>") # should not raise an exception
140
+ assert_equal x.first.name, "bar"
141
+ end
142
+
143
+ def test_parse_with_unparented_html_text_context_node
144
+ doc = HTML::Document.new
145
+ elem = XML::Text.new("div", doc)
146
+ x = elem.parse("<div/>") # should not raise an exception
147
+ assert_equal x.first.name, "div"
148
+ end
149
+
150
+ def test_parse_with_unparented_fragment_text_context_node
151
+ doc = XML::DocumentFragment.parse "<div><span>foo</span></div>"
152
+ elem = doc.at_css "span"
153
+ x = elem.parse("<span/>") # should not raise an exception
154
+ assert_equal x.first.name, "span"
155
+ end
156
+
157
+ def test_parse_with_unparented_html_fragment_text_context_node
158
+ doc = HTML::DocumentFragment.parse "<div><span>foo</span></div>"
159
+ elem = doc.at_css "span"
160
+ x = elem.parse("<span/>") # should not raise an exception
161
+ assert_equal x.first.name, "span"
140
162
  end
141
163
 
142
164
  def test_subclass_dup
@@ -836,7 +858,7 @@ b"></div>
836
858
  ne = d1.root.xpath('//a').first.dup(1)
837
859
  ne.content += "& < & > \" &"
838
860
  d2.root << ne
839
- assert_match /<a>&amp;&amp; &lt; &amp; &gt; " &amp;<\/a>/, d2.to_s
861
+ assert_match /<a>&amp;&amp; &lt; &amp; &gt; \" &amp;<\/a>/, d2.to_s
840
862
  end
841
863
 
842
864
  def test_content_after_appending_text
@@ -1150,6 +1172,26 @@ eoxml
1150
1172
  root << "<a>hello:with_colon</a>"
1151
1173
  assert_match(/hello:with_colon/, document.to_xml)
1152
1174
  end
1175
+
1176
+ def test_document_eh
1177
+ html_doc = Nokogiri::HTML "<div>foo</div>"
1178
+ xml_doc = Nokogiri::XML "<div>foo</div>"
1179
+ html_node = html_doc.at_css "div"
1180
+ xml_node = xml_doc.at_css "div"
1181
+
1182
+ assert html_doc.document?
1183
+ assert xml_doc.document?
1184
+ assert ! html_node.document?
1185
+ assert ! xml_node.document?
1186
+ end
1187
+
1188
+ def test_processing_instruction_eh
1189
+ xml_doc = Nokogiri::XML %Q{<?xml version="1.0"?>\n<?xml-stylesheet type="text/xsl" href="foo.xsl"?>\n<?xml-stylesheet type="text/xsl" href="foo2.xsl"?>\n<root><div>foo</div></root>}
1190
+ pi_node = xml_doc.children.first
1191
+ div_node = xml_doc.at_css "div"
1192
+ assert pi_node.processing_instruction?
1193
+ assert ! div_node.processing_instruction?
1194
+ end
1153
1195
  end
1154
1196
  end
1155
1197
  end
@@ -248,12 +248,17 @@ module Nokogiri
248
248
  end
249
249
  end
250
250
 
251
- def test_add_pi_as_previous_sibling_to_root_is_ok
251
+ def test_add_pi_as_previous_and_next_sibling_to_root_is_ok
252
252
  doc = Nokogiri::XML "<root>foo</root>"
253
253
  pi = Nokogiri::XML::ProcessingInstruction.new(doc, "xml-stylesheet", %q{type="text/xsl" href="foo.xsl"})
254
254
  doc.root.add_previous_sibling pi
255
255
  expected_doc = %Q{<?xml version="1.0"?>\n<?xml-stylesheet type="text/xsl" href="foo.xsl"?>\n<root>foo</root>}
256
256
  assert_includes doc.to_xml, expected_doc
257
+
258
+ pi2 = Nokogiri::XML::ProcessingInstruction.new(doc, "xml-stylesheet", %q{type="text/xsl" href="foo2.xsl"})
259
+ pi.add_next_sibling pi2
260
+ expected_doc = %Q{<?xml version="1.0"?>\n<?xml-stylesheet type="text/xsl" href="foo.xsl"?>\n<?xml-stylesheet type="text/xsl" href="foo2.xsl"?>\n<root>foo</root>}
261
+ assert_includes doc.to_xml, expected_doc
257
262
  end
258
263
 
259
264
  def test_find_by_css_with_tilde_eql
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3.rc2
4
+ version: 1.6.3.rc3
5
5
  platform: java
6
6
  authors:
7
7
  - Aaron Patterson
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-06-17 00:00:00.000000000 Z
15
+ date: 2014-06-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rdoc