nokogiri 1.8.2-java → 1.8.3-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.

Files changed (65) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +14 -14
  3. data/CHANGELOG.md +43 -1
  4. data/LICENSE.md +2 -1
  5. data/Manifest.txt +3 -0
  6. data/README.md +20 -21
  7. data/Rakefile +3 -9
  8. data/SECURITY.md +19 -0
  9. data/build_all +1 -1
  10. data/dependencies.yml +11 -11
  11. data/ext/java/nokogiri/HtmlSaxParserContext.java +7 -13
  12. data/ext/java/nokogiri/HtmlSaxPushParser.java +72 -90
  13. data/ext/java/nokogiri/NokogiriService.java +0 -19
  14. data/ext/java/nokogiri/XmlNode.java +2 -23
  15. data/ext/java/nokogiri/XmlSaxParserContext.java +81 -101
  16. data/ext/java/nokogiri/XmlSaxPushParser.java +117 -89
  17. data/ext/java/nokogiri/XmlSyntaxError.java +9 -17
  18. data/ext/java/nokogiri/internals/NokogiriHandler.java +100 -108
  19. data/ext/java/nokogiri/internals/NokogiriHelpers.java +11 -14
  20. data/ext/java/nokogiri/internals/ParserContext.java +34 -19
  21. data/ext/java/nokogiri/internals/ReaderNode.java +6 -10
  22. data/ext/java/nokogiri/internals/SaveContextVisitor.java +4 -3
  23. data/ext/java/nokogiri/internals/XmlDomParserContext.java +6 -3
  24. data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +4 -3
  25. data/ext/nokogiri/extconf.rb +1 -1
  26. data/ext/nokogiri/html_element_description.c +14 -14
  27. data/ext/nokogiri/xml_cdata.c +6 -4
  28. data/ext/nokogiri/xml_document.c +2 -3
  29. data/ext/nokogiri/xml_dtd.c +2 -2
  30. data/ext/nokogiri/xml_io.c +1 -0
  31. data/ext/nokogiri/xml_namespace.c +3 -9
  32. data/ext/nokogiri/xml_namespace.h +2 -0
  33. data/ext/nokogiri/xml_node.c +23 -15
  34. data/ext/nokogiri/xml_node_set.c +5 -4
  35. data/ext/nokogiri/xml_node_set.h +0 -1
  36. data/ext/nokogiri/xslt_stylesheet.c +2 -2
  37. data/lib/nokogiri/css/parser.rb +108 -90
  38. data/lib/nokogiri/css/parser.y +13 -2
  39. data/lib/nokogiri/css/tokenizer.rb +1 -1
  40. data/lib/nokogiri/css/tokenizer.rex +4 -4
  41. data/lib/nokogiri/css/xpath_visitor.rb +10 -3
  42. data/lib/nokogiri/html/document_fragment.rb +11 -1
  43. data/lib/nokogiri/nokogiri.jar +0 -0
  44. data/lib/nokogiri/version.rb +1 -1
  45. data/lib/nokogiri/xml/node.rb +58 -0
  46. data/lib/nokogiri/xml/node_set.rb +32 -18
  47. data/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch +78 -0
  48. data/test/css/test_nthiness.rb +21 -21
  49. data/test/css/test_parser.rb +17 -0
  50. data/test/html/test_attributes.rb +85 -0
  51. data/test/html/test_document_fragment.rb +7 -1
  52. data/test/test_css_cache.rb +5 -3
  53. data/test/xml/sax/test_parser.rb +9 -1
  54. data/test/xml/sax/test_push_parser.rb +60 -0
  55. data/test/xml/test_cdata.rb +1 -1
  56. data/test/xml/test_document.rb +5 -5
  57. data/test/xml/test_dtd.rb +4 -4
  58. data/test/xml/test_node.rb +89 -6
  59. data/test/xml/test_node_attributes.rb +3 -3
  60. data/test/xml/test_node_reparenting.rb +18 -0
  61. data/test/xml/test_node_set.rb +31 -4
  62. data/test/xml/test_reader.rb +13 -1
  63. data/test/xml/test_syntax_error.rb +3 -3
  64. data/test/xml/test_xpath.rb +8 -0
  65. metadata +25 -4
@@ -51,6 +51,12 @@ module Nokogiri
51
51
  @list.each { |x| assert_nil x['class'] }
52
52
  end
53
53
 
54
+ def test_remove_attribute
55
+ @list.each { |x| x['class'] = 'blah' }
56
+ assert_equal @list, @list.remove_attribute('class')
57
+ @list.each { |x| assert_nil x['class'] }
58
+ end
59
+
54
60
  def test_add_class
55
61
  assert_equal @list, @list.add_class('bar')
56
62
  @list.each { |x| assert_equal 'bar', x['class'] }
@@ -62,6 +68,17 @@ module Nokogiri
62
68
  @list.each { |x| assert_equal 'bar baz', x['class'] }
63
69
  end
64
70
 
71
+ def test_append_class
72
+ assert_equal @list, @list.append_class('bar')
73
+ @list.each { |x| assert_equal 'bar', x['class'] }
74
+
75
+ @list.append_class('bar')
76
+ @list.each { |x| assert_equal 'bar bar', x['class'] }
77
+
78
+ @list.append_class('baz')
79
+ @list.each { |x| assert_equal 'bar bar baz', x['class'] }
80
+ end
81
+
65
82
  def test_remove_class_with_no_class
66
83
  assert_equal @list, @list.remove_class('bar')
67
84
  @list.each { |e| assert_nil e['class'] }
@@ -408,7 +425,7 @@ module Nokogiri
408
425
  def test_delete_on_empty_set
409
426
  empty_set = Nokogiri::XML::NodeSet.new @xml, []
410
427
  employee = @xml.at_xpath("//employee")
411
- assert_equal nil, empty_set.delete(employee)
428
+ assert_nil empty_set.delete(employee)
412
429
  end
413
430
 
414
431
  def test_unlink
@@ -563,6 +580,8 @@ module Nokogiri
563
580
 
564
581
  assert_equal 3, employees.index(employees[3])
565
582
  assert_nil employees.index(other)
583
+ assert_equal 3, employees.index {|employee| employee.search("employeeId/text()").to_s == "EMP0004" }
584
+ assert_nil employees.index {|employee| employee.search("employeeId/text()").to_s == "EMP0000" }
566
585
  end
567
586
 
568
587
  def test_slice_too_far
@@ -573,9 +592,9 @@ module Nokogiri
573
592
 
574
593
  def test_slice_on_empty_node_set
575
594
  empty_set = Nokogiri::XML::NodeSet.new @xml, []
576
- assert_equal nil, empty_set[99]
577
- assert_equal nil, empty_set[99..101]
578
- assert_equal nil, empty_set[99,2]
595
+ assert_nil empty_set[99]
596
+ assert_nil empty_set[99..101]
597
+ assert_nil empty_set[99,2]
579
598
  end
580
599
 
581
600
  def test_slice_waaaaaay_off_the_end
@@ -653,6 +672,14 @@ module Nokogiri
653
672
  assert ! empty_set.include?(employee)
654
673
  end
655
674
 
675
+ def test_each
676
+ employees = @xml.search("//employee")
677
+ enum = employees.each
678
+ assert_instance_of Enumerator, enum
679
+ assert_equal enum.next, employees[0]
680
+ assert_equal enum.next, employees[1]
681
+ end
682
+
656
683
  def test_children
657
684
  employees = @xml.search("//employee")
658
685
  count = 0
@@ -4,6 +4,18 @@ require "helper"
4
4
  module Nokogiri
5
5
  module XML
6
6
  class TestReader < Nokogiri::TestCase
7
+ class NonStringIO
8
+ def read(size)
9
+ :invalid_object
10
+ end
11
+ end
12
+
13
+ def test_io_non_string
14
+ io = NonStringIO.new
15
+ reader = Nokogiri::XML::Reader(io)
16
+ assert_equal io, reader.source
17
+ end
18
+
7
19
  def test_from_io_sets_io_as_source
8
20
  io = File.open SNUGGLES_FILE
9
21
  reader = Nokogiri::XML::Reader.from_io(io)
@@ -601,7 +613,7 @@ module Nokogiri
601
613
  reader = Nokogiri::XML::Reader("<root xmlns='bob'><el attr='fred' /></root>")
602
614
  reader.read # root
603
615
  reader.read # el
604
- assert_equal nil, reader.attribute('other')
616
+ assert_nil reader.attribute('other')
605
617
  end
606
618
  end
607
619
  end
@@ -27,9 +27,9 @@ module Nokogiri
27
27
  error = bad_doc.errors.first
28
28
 
29
29
  assert_equal "The element type \"root\" must be terminated by the matching end-tag \"</root>\".", error.message
30
- assert_equal nil, error.line
31
- assert_equal nil, error.column
32
- assert_equal nil, error.level
30
+ assert_nil error.line
31
+ assert_nil error.column
32
+ assert_nil error.level
33
33
  end
34
34
  end
35
35
  end
@@ -108,6 +108,14 @@ module Nokogiri
108
108
  assert_equal 3, node.search('.//div', 'p.blah').length
109
109
  end
110
110
 
111
+ def test_css_search_with_ambiguous_integer_or_string_attributes
112
+ # https://github.com/sparklemotion/nokogiri/issues/711
113
+ html = "<body><div><img width=200>"
114
+ doc = Nokogiri::HTML(html)
115
+ assert_not_nil doc.at_css("img[width='200']")
116
+ assert_not_nil doc.at_css("img[width=200]")
117
+ end
118
+
111
119
  def test_css_search_uses_custom_selectors_with_arguments
112
120
  set = @xml.css('employee > address:my_filter("domestic", "Yes")', @handler)
113
121
  assert set.length > 0
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.8.2
4
+ version: 1.8.3
5
5
  platform: java
6
6
  authors:
7
7
  - Aaron Patterson
@@ -9,10 +9,12 @@ authors:
9
9
  - Yoko Harada
10
10
  - Tim Elliott
11
11
  - Akinori MUSHA
12
+ - John Shahid
13
+ - Lars Kanis
12
14
  autorequire:
13
15
  bindir: bin
14
16
  cert_chain: []
15
- date: 2018-01-29 00:00:00.000000000 Z
17
+ date: 2018-06-16 00:00:00.000000000 Z
16
18
  dependencies:
17
19
  - !ruby/object:Gem::Dependency
18
20
  requirement: !ruby/object:Gem::Requirement
@@ -200,12 +202,27 @@ description: |-
200
202
  Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among
201
203
  Nokogiri's many features is the ability to search documents via XPath
202
204
  or CSS3 selectors.
205
+
206
+ * http://nokogiri.org
207
+ * [Installation Help](http://nokogiri.org/tutorials/installing_nokogiri.html)
208
+ * [Tutorials](http://nokogiri.org)
209
+ * [GitHub](https://github.com/sparklemotion/nokogiri)
210
+ * [Mailing List](https://groups.google.com/group/nokogiri-talk)
211
+ * [Bug Reports](https://github.com/sparklemotion/nokogiri/issues)
212
+ * [Chat/Gitter](https://gitter.im/sparklemotion/nokogiri)
213
+
214
+ [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/nokogiri/jobs/ruby-2.4-system/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/nokogiri?groups=master)
215
+ [![Code Climate](https://codeclimate.com/github/sparklemotion/nokogiri.svg)](https://codeclimate.com/github/sparklemotion/nokogiri)
216
+ [![Version Eye](https://www.versioneye.com/ruby/nokogiri/badge.png)](https://www.versioneye.com/ruby/nokogiri)
217
+ [![Join the chat at https://gitter.im/sparklemotion/nokogiri](https://badges.gitter.im/sparklemotion/nokogiri.svg)](https://gitter.im/sparklemotion/nokogiri?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
203
218
  email:
204
219
  - aaronp@rubyforge.org
205
220
  - mike.dalessio@gmail.com
206
221
  - yokolet@gmail.com
207
222
  - tle@holymonkey.com
208
223
  - knu@idaemons.org
224
+ - jvshahid@gmail.com
225
+ - lars@greiz-reinsdorf.de
209
226
  executables:
210
227
  - nokogiri
211
228
  extensions: []
@@ -218,6 +235,7 @@ extra_rdoc_files:
218
235
  - Manifest.txt
219
236
  - README.md
220
237
  - ROADMAP.md
238
+ - SECURITY.md
221
239
  - STANDARD_RESPONSES.md
222
240
  - Y_U_NO_GEMSPEC.md
223
241
  - suppressions/README.txt
@@ -272,6 +290,7 @@ files:
272
290
  - README.md
273
291
  - ROADMAP.md
274
292
  - Rakefile
293
+ - SECURITY.md
275
294
  - STANDARD_RESPONSES.md
276
295
  - Y_U_NO_GEMSPEC.md
277
296
  - appveyor.yml
@@ -508,6 +527,7 @@ files:
508
527
  - lib/xercesImpl.jar
509
528
  - lib/xml-apis.jar
510
529
  - lib/xsd/xmlparser/nokogiri.rb
530
+ - patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
511
531
  - patches/sort-patches-by-date
512
532
  - suppressions/README.txt
513
533
  - suppressions/nokogiri_ruby-2.supp
@@ -559,6 +579,7 @@ files:
559
579
  - test/html/sax/test_parser_context.rb
560
580
  - test/html/sax/test_parser_text.rb
561
581
  - test/html/sax/test_push_parser.rb
582
+ - test/html/test_attributes.rb
562
583
  - test/html/test_builder.rb
563
584
  - test/html/test_document.rb
564
585
  - test/html/test_document_encoding.rb
@@ -622,7 +643,7 @@ files:
622
643
  - test/xml/test_xpath.rb
623
644
  - test/xslt/test_custom_functions.rb
624
645
  - test/xslt/test_exception_handling.rb
625
- homepage: http://nokogiri.org
646
+ homepage:
626
647
  licenses:
627
648
  - MIT
628
649
  metadata: {}
@@ -644,7 +665,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
644
665
  version: '0'
645
666
  requirements: []
646
667
  rubyforge_project:
647
- rubygems_version: 2.6.13
668
+ rubygems_version: 2.6.14
648
669
  signing_key:
649
670
  specification_version: 4
650
671
  summary: Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser