Skip to content

Commit

Permalink
test: update behavior of namespaces in HTML
Browse files Browse the repository at this point in the history
libxml 2.9.12 fixes the parser to ignore namespaces in HTML docs,
likely in upstream commit 21ca882.
  • Loading branch information
flavorjones committed May 14, 2021
1 parent 9751d85 commit 889ee2a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/xml/test_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1055,13 +1055,15 @@ def test_namespace_without_an_href_on_html_node
node = html.at("div").children.first
assert_not_nil(node)

if Nokogiri.uses_libxml?
if Nokogiri.uses_libxml?(">= 2.9.12")
assert_empty(node.namespaces.keys)
assert_equal("<p>foo</p>", node.to_html)
elsif Nokogiri.uses_libxml?
assert_equal(1, node.namespaces.keys.size)
assert(node.namespaces.has_key?('xmlns:o'))
assert_nil(node.namespaces['xmlns:o'])
assert_equal("<p>foo</p>", node.to_html)
else
# Xerces does something completely different
else # jruby
assert_empty(node.namespaces.keys)
assert_equal("<o:p>foo</o:p>", node.to_html)
end
Expand Down

0 comments on commit 889ee2a

Please sign in to comment.