Skip to content

Commit 66c2886

Browse files
committed
dep: update libxml2 to v2.9.14
from v2.9.13 https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.9.14
1 parent b7c4cc3 commit 66c2886

File tree

4 files changed

+43
-58
lines changed

4 files changed

+43
-58
lines changed

dependencies.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
libxml2:
2-
version: "2.9.13"
3-
sha256: "276130602d12fe484ecc03447ee5e759d0465558fbc9d6bd144e3745306ebf0e"
4-
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.sha256sum
2+
version: "2.9.14"
3+
sha256: "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee"
4+
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.sha256sum
55

66
libxslt:
77
version: "1.1.35"

patches/libxml2/0010-Revert-Different-approach-to-fix-quadratic-behavior.patch

-45
This file was deleted.

test/html4/test_comments.rb

+24-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class TestComment < Nokogiri::TestCase
173173
let(:body) { doc.at_css("body") }
174174
let(:subject) { doc.at_css("div#under-test") }
175175

176-
if Nokogiri.uses_libxml?
176+
if Nokogiri.uses_libxml?("<=2.9.13")
177177
it "ignores up to the next '>'" do # NON-COMPLIANT
178178
assert_equal 2, body.children.length
179179
assert_equal body.children[0], subject
@@ -183,10 +183,33 @@ class TestComment < Nokogiri::TestCase
183183
assert_predicate body.children[1], :text?
184184
assert_equal "-->hello", body.children[1].content
185185
end
186+
elsif Nokogiri.uses_libxml?
187+
it "parses as pcdata" do # NON-COMPLIANT
188+
assert_equal 1, body.children.length
189+
assert_equal subject, body.children.first
190+
191+
assert_equal 3, subject.children.length
192+
subject.children[0].tap do |child|
193+
assert_predicate(child, :text?)
194+
assert_equal("<! comment ", child.content)
195+
end
196+
subject.children[1].tap do |child|
197+
assert_predicate(child, :element?)
198+
assert_equal("div", child.name)
199+
assert_equal("inner content", child.content)
200+
end
201+
subject.children[2].tap do |child|
202+
assert_predicate(child, :text?)
203+
assert_equal("-->hello", child.content)
204+
end
205+
end
186206
end
187207

188208
if Nokogiri.jruby?
189209
it "ignores up to the next '-->'" do # NON-COMPLIANT
210+
assert_equal 1, body.children.length
211+
assert_equal subject, body.children.first
212+
190213
assert_equal 1, subject.children.length
191214
assert_predicate subject.children[0], :text?
192215
assert_equal "hello", subject.children[0].content

test/html4/test_document.rb

+16-9
Original file line numberDiff line numberDiff line change
@@ -801,18 +801,25 @@ def test_leaking_dtd_nodes_after_internal_subset_removal
801801

802802
it "skips to the next start tag" do
803803
# see https://github.com/sparklemotion/nokogiri/issues/2461 for why we're testing this edge case
804-
if Nokogiri.uses_libxml?(">= 2.9.13")
805-
skip_unless_libxml2_patch("0010-Revert-Different-approach-to-fix-quadratic-behavior.patch")
806-
end
807-
808804
doc = Nokogiri::HTML4.parse(input)
809805
body = doc.at_xpath("//body")
810806

811-
expected_error_snippet = Nokogiri.uses_libxml? ? "invalid element name" : "Missing start element name"
812-
assert_includes(doc.errors.first.to_s, expected_error_snippet)
813-
814-
assert_equal("this < that", body.children.first.text, body.to_html)
815-
assert_equal(["div", "div"], body.children.map(&:name), body.to_html)
807+
if Nokogiri.uses_libxml?("= 2.9.13")
808+
# <body><div>this <div>second element</div></div></body>
809+
assert_equal(1, body.children.length)
810+
body.children.first.tap do |div|
811+
assert_equal(2, div.children.length)
812+
assert_equal("this ", div.children[0].content)
813+
assert_equal("div", div.children[1].name)
814+
assert_equal("second element", div.children[1].content)
815+
end
816+
else
817+
# <body><div>this &lt; that</div><div>second element</div></body>
818+
assert_equal(2, body.children.length)
819+
assert_equal(["div", "div"], body.children.map(&:name), body.to_html)
820+
assert_equal("this < that", body.children[0].text, body.to_html)
821+
assert_equal("second element", body.children[1].text, body.to_html)
822+
end
816823
end
817824
end
818825

0 commit comments

Comments
 (0)