Skip to content

Commit 889ee2a

Browse files
committed
test: update behavior of namespaces in HTML
libxml 2.9.12 fixes the parser to ignore namespaces in HTML docs, likely in upstream commit 21ca882.
1 parent 9751d85 commit 889ee2a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/xml/test_node.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,13 +1055,15 @@ def test_namespace_without_an_href_on_html_node
10551055
node = html.at("div").children.first
10561056
assert_not_nil(node)
10571057

1058-
if Nokogiri.uses_libxml?
1058+
if Nokogiri.uses_libxml?(">= 2.9.12")
1059+
assert_empty(node.namespaces.keys)
1060+
assert_equal("<p>foo</p>", node.to_html)
1061+
elsif Nokogiri.uses_libxml?
10591062
assert_equal(1, node.namespaces.keys.size)
10601063
assert(node.namespaces.has_key?('xmlns:o'))
10611064
assert_nil(node.namespaces['xmlns:o'])
10621065
assert_equal("<p>foo</p>", node.to_html)
1063-
else
1064-
# Xerces does something completely different
1066+
else # jruby
10651067
assert_empty(node.namespaces.keys)
10661068
assert_equal("<o:p>foo</o:p>", node.to_html)
10671069
end

0 commit comments

Comments
 (0)