nokogiri 1.6.5-x86-mingw32 → 1.6.6.1-x86-mingw32

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +5 -0
  3. data/.travis.yml +10 -20
  4. data/CHANGELOG.ja.rdoc +28 -1
  5. data/CHANGELOG.rdoc +28 -1
  6. data/Gemfile +1 -1
  7. data/Manifest.txt +5 -1
  8. data/README.ja.rdoc +10 -9
  9. data/README.rdoc +6 -9
  10. data/ROADMAP.md +15 -3
  11. data/Rakefile +1 -3
  12. data/bin/nokogiri +48 -8
  13. data/ext/nokogiri/extconf.rb +18 -3
  14. data/ext/nokogiri/xml_comment.c +17 -2
  15. data/ext/nokogiri/xml_node.c +66 -6
  16. data/ext/nokogiri/xml_syntax_error.c +4 -0
  17. data/ext/nokogiri/xml_syntax_error.h +1 -0
  18. data/lib/nokogiri.rb +2 -2
  19. data/lib/nokogiri/1.9/nokogiri.so +0 -0
  20. data/lib/nokogiri/2.0/nokogiri.so +0 -0
  21. data/lib/nokogiri/2.1/nokogiri.so +0 -0
  22. data/lib/nokogiri/decorators/slop.rb +7 -8
  23. data/lib/nokogiri/html/document_fragment.rb +0 -2
  24. data/lib/nokogiri/html/sax/push_parser.rb +22 -2
  25. data/lib/nokogiri/version.rb +1 -1
  26. data/lib/nokogiri/xml.rb +1 -0
  27. data/lib/nokogiri/xml/document.rb +4 -4
  28. data/lib/nokogiri/xml/document_fragment.rb +39 -2
  29. data/lib/nokogiri/xml/node.rb +11 -181
  30. data/lib/nokogiri/xml/node_set.rb +41 -85
  31. data/lib/nokogiri/xml/searchable.rb +221 -0
  32. data/test/css/test_nthiness.rb +1 -1
  33. data/test/html/sax/test_push_parser.rb +87 -0
  34. data/test/html/test_document.rb +20 -5
  35. data/test/html/test_document_fragment.rb +25 -0
  36. data/test/xml/test_attr.rb +5 -2
  37. data/test/xml/test_builder.rb +27 -1
  38. data/test/xml/test_comment.rb +11 -0
  39. data/test/xml/test_document.rb +34 -0
  40. data/test/xml/test_document_fragment.rb +40 -9
  41. data/test/xml/test_namespace.rb +1 -0
  42. data/test/xml/test_node.rb +37 -1
  43. data/test/xml/test_node_set.rb +56 -36
  44. data/test/xml/test_xpath.rb +65 -19
  45. data/test_all +11 -1
  46. metadata +10 -7
  47. data/tasks/nokogiri.org.rb +0 -24
@@ -13,12 +13,6 @@ module Nokogiri
13
13
  # functions to be in a namespace. This is not required by XPath, afaik,
14
14
  # but it is an usual convention though.
15
15
  #
16
- # Furthermore, CSS does not support extension functions but it does in
17
- # Nokogiri. Result: you cannot use them in JRuby impl. At least, until
18
- # the CSS to XPath parser is patched, and let me say that there are more
19
- # important features to add before that happens. I hope you will forgive
20
- # me.
21
- #
22
16
  # Yours truly,
23
17
  #
24
18
  # The guy whose headaches belong to Nokogiri JRuby impl.
@@ -69,6 +63,10 @@ module Nokogiri
69
63
  assert_equal 4, @xml.xpath('//address[@domestic=$value]', nil, :value => 'Yes').length
70
64
  end
71
65
 
66
+ def test_variable_binding_with_search
67
+ assert_equal 4, @xml.search('//address[@domestic=$value]', nil, :value => 'Yes').length
68
+ end
69
+
72
70
  def test_unknown_attribute
73
71
  assert_equal 0, @xml.xpath('//employee[@id="asdfasdf"]/@fooo').length
74
72
  assert_nil @xml.xpath('//employee[@id="asdfasdf"]/@fooo')[0]
@@ -86,12 +84,28 @@ module Nokogiri
86
84
  assert_equal 'foo', @xml.xpath('concat("fo", "o")')
87
85
  end
88
86
 
87
+ def test_node_search_with_multiple_queries
88
+ xml = '<document>
89
+ <thing>
90
+ <div class="title">important thing</div>
91
+ </thing>
92
+ <thing>
93
+ <div class="content">stuff</div>
94
+ </thing>
95
+ <thing>
96
+ <p class="blah">more stuff</div>
97
+ </thing>
98
+ </document>'
99
+ node = Nokogiri::XML(xml).root
100
+ assert_kind_of Nokogiri::XML::Node, node
101
+
102
+ assert_equal 3, node.xpath('.//div', './/p').length
103
+ assert_equal 3, node.css('.title', '.content', 'p').length
104
+ assert_equal 3, node.search('.//div', 'p.blah').length
105
+ end
106
+
89
107
  def test_css_search_uses_custom_selectors_with_arguments
90
- set = if Nokogiri.uses_libxml?
91
- @xml.css('employee > address:my_filter("domestic", "Yes")', @handler)
92
- else
93
- @xml.xpath("//employee/address[nokogiri:my_filter(., \"domestic\", \"Yes\")]", @ns, @handler)
94
- end
108
+ set = @xml.css('employee > address:my_filter("domestic", "Yes")', @handler)
95
109
  assert set.length > 0
96
110
  set.each do |node|
97
111
  assert_equal 'Yes', node['domestic']
@@ -100,15 +114,31 @@ module Nokogiri
100
114
 
101
115
  def test_css_search_uses_custom_selectors
102
116
  set = @xml.xpath('//employee')
103
- if Nokogiri.uses_libxml?
104
- @xml.css('employee:thing()', @handler)
105
- else
106
- @xml.xpath("//employee[nokogiri:thing(.)]", @ns, @handler)
107
- end
117
+ @xml.css('employee:thing()', @handler)
108
118
  assert_equal(set.length, @handler.things.length)
109
119
  assert_equal(set.to_a, @handler.things.flatten)
110
120
  end
111
121
 
122
+ def test_search_with_css_query_uses_custom_selectors_with_arguments
123
+ set = @xml.search('employee > address:my_filter("domestic", "Yes")', @handler)
124
+ assert set.length > 0
125
+ set.each do |node|
126
+ assert_equal 'Yes', node['domestic']
127
+ end
128
+ end
129
+
130
+ def test_search_with_xpath_query_uses_custom_selectors_with_arguments
131
+ set = if Nokogiri.uses_libxml?
132
+ @xml.search('//employee/address[my_filter(., "domestic", "Yes")]', @handler)
133
+ else
134
+ @xml.search('//employee/address[nokogiri:my_filter(., "domestic", "Yes")]', @ns, @handler)
135
+ end
136
+ assert set.length > 0
137
+ set.each do |node|
138
+ assert_equal 'Yes', node['domestic']
139
+ end
140
+ end
141
+
112
142
  def test_pass_self_to_function
113
143
  set = if Nokogiri.uses_libxml?
114
144
  @xml.xpath('//employee/address[my_filter(., "domestic", "Yes")]', @handler)
@@ -179,6 +209,22 @@ module Nokogiri
179
209
  assert_send [elapsed_time, :<, time_limit], "XPath is taking too long"
180
210
  end
181
211
 
212
+ # issue #1109 (jruby impl's xpath() cache not being cleared on attr removal)
213
+ def test_xpath_results_cache_should_get_cleared_on_attr_removal
214
+ doc = Nokogiri::HTML('<html><div name="foo"></div></html>')
215
+ element = doc.at_xpath('//div[@name="foo"]')
216
+ element.remove_attribute('name')
217
+ assert_nil doc.at_xpath('//div[@name="foo"]')
218
+ end
219
+
220
+ # issue #1109 (jruby impl's xpath() cache not being cleared on attr update )
221
+ def test_xpath_results_cache_should_get_cleared_on_attr_update
222
+ doc = Nokogiri::HTML('<html><div name="foo"></div></html>')
223
+ element = doc.at_xpath('//div[@name="foo"]')
224
+ element['name'] = 'bar'
225
+ assert_nil doc.at_xpath('//div[@name="foo"]')
226
+ end
227
+
182
228
  def test_custom_xpath_function_returns_string
183
229
  if Nokogiri.uses_libxml?
184
230
  result = @xml.xpath('thing("asdf")', @handler)
@@ -332,7 +378,7 @@ END
332
378
  <RecordReference>a</RecordReference>
333
379
  </Product>
334
380
  </ONIXMessage>}
335
-
381
+
336
382
  xml_doc = Nokogiri::XML(xml_string)
337
383
  onix = xml_doc.children.first
338
384
  assert_equal 'a', onix.at_xpath('xmlns:Product').at_xpath('xmlns:RecordReference').text
@@ -350,7 +396,7 @@ END
350
396
  <title>Artikkelin otsikko Hydrangea artiklan 1</title>
351
397
  </titleInfo>
352
398
  </mods>}
353
-
399
+
354
400
  xml_doc = Nokogiri::XML(xml_string)
355
401
  ns_hash = {'mods'=>'http://www.loc.gov/mods/v3'}
356
402
  node = xml_doc.at_xpath('//mods:titleInfo[1]',ns_hash)
@@ -371,7 +417,7 @@ END
371
417
  <title>Artikkelin otsikko Hydrangea artiklan 1</title>
372
418
  </titleInfo>
373
419
  </mods>}
374
-
420
+
375
421
  xml_doc = Nokogiri::XML(xml_string)
376
422
  ns_hash = {'mods'=>'http://www.loc.gov/mods/v3'}
377
423
  node = xml_doc.at_xpath('//mods:titleInfo[1]',ns_hash)
data/test_all CHANGED
@@ -10,7 +10,17 @@
10
10
  # (e.g., 1.9.3's glob_helper). ["rake test:valgrind:suppression"]
11
11
  #
12
12
 
13
- RUBIES="ruby-2.2.0-preview1 ruby-2.1 ruby-2.0.0-p481 ruby-1.9.3 jruby-1.7.15"
13
+ # I'd add rubinius, but rvm errors when building it on my machine. :(
14
+ RUBIES="\
15
+ ruby-2.2 \
16
+ ruby-2.1 \
17
+ ruby-2.0.0-p598 \
18
+ ruby-1.9.3-p551 \
19
+ ruby-1.9.2-p330 \
20
+ jruby-9.0.0.0.pre1 \
21
+ jruby-1.7.18
22
+ "
23
+
14
24
  TEST_LOG=test.log
15
25
  VALGRIND_LOG=valgrind.log
16
26
 
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.5
4
+ version: 1.6.6.1
5
5
  platform: x86-mingw32
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-11-26 00:00:00.000000000 Z
15
+ date: 2015-01-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: mini_portile
@@ -60,16 +60,16 @@ dependencies:
60
60
  name: hoe-debugging
61
61
  requirement: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - '>='
63
+ - - ~>
64
64
  - !ruby/object:Gem::Version
65
- version: 1.0.3
65
+ version: 1.2.0
66
66
  type: :development
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - '>='
70
+ - - ~>
71
71
  - !ruby/object:Gem::Version
72
- version: 1.0.3
72
+ version: 1.2.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: hoe-gemspec
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -244,6 +244,7 @@ extra_rdoc_files:
244
244
  - ext/nokogiri/xslt_stylesheet.c
245
245
  files:
246
246
  - .autotest
247
+ - .cross_rubies
247
248
  - .editorconfig
248
249
  - .gemtest
249
250
  - .travis.yml
@@ -387,6 +388,7 @@ files:
387
388
  - lib/nokogiri/xml/sax/parser_context.rb
388
389
  - lib/nokogiri/xml/sax/push_parser.rb
389
390
  - lib/nokogiri/xml/schema.rb
391
+ - lib/nokogiri/xml/searchable.rb
390
392
  - lib/nokogiri/xml/syntax_error.rb
391
393
  - lib/nokogiri/xml/text.rb
392
394
  - lib/nokogiri/xml/xpath.rb
@@ -400,7 +402,6 @@ files:
400
402
  - suppressions/nokogiri_ruby-1.8.7.370.supp
401
403
  - suppressions/nokogiri_ruby-1.9.2.320.supp
402
404
  - suppressions/nokogiri_ruby-1.9.3.327.supp
403
- - tasks/nokogiri.org.rb
404
405
  - tasks/test.rb
405
406
  - test/css/test_nthiness.rb
406
407
  - test/css/test_parser.rb
@@ -445,6 +446,7 @@ files:
445
446
  - test/helper.rb
446
447
  - test/html/sax/test_parser.rb
447
448
  - test/html/sax/test_parser_context.rb
449
+ - test/html/sax/test_push_parser.rb
448
450
  - test/html/test_builder.rb
449
451
  - test/html/test_document.rb
450
452
  - test/html/test_document_encoding.rb
@@ -582,6 +584,7 @@ test_files:
582
584
  - test/html/test_document_fragment.rb
583
585
  - test/html/sax/test_parser_context.rb
584
586
  - test/html/sax/test_parser.rb
587
+ - test/html/sax/test_push_parser.rb
585
588
  - test/html/test_element_description.rb
586
589
  - test/html/test_document.rb
587
590
  - test/html/test_named_characters.rb
@@ -1,24 +0,0 @@
1
- #
2
- # note that this file will only work if you've got the `nokogiri.org`
3
- # repo checked out, and you've got an rvm gemset "1.8.7@nokogiri"
4
- # bundled with both nokogiri's and nokogiri.org's gems.
5
- #
6
- namespace :docs do
7
- desc "generate HTML docs for nokogiri.org"
8
- task :website do
9
- system 'rvm use 1.8.7@nokogiri' # see above
10
- title = "#{HOE.name}-#{HOE.version} Documentation"
11
-
12
- options = []
13
- options << "--main=#{HOE.readme_file}"
14
- options << '--format=activerecord'
15
- options << '--threads=1'
16
- options << "--title=#{title.inspect}"
17
-
18
- options += HOE.spec.require_paths
19
- options += HOE.spec.extra_rdoc_files
20
- require 'rdoc/rdoc'
21
- ENV['RAILS_ROOT'] ||= File.expand_path(File.join('..', 'nokogiri_ws'))
22
- RDoc::RDoc.new.document options
23
- end
24
- end