rubygem-nokogiri/rubygem-nokogiri-1.11.2-update-behavior-of-namespaces-in-HTML.patch
Vít Ondruch f06c482b6f Fix test suite compatibility with libxml 2.9.12.
Resolves: rhbz#1980885
2021-07-28 14:57:27 +02:00

35 lines
1.3 KiB
Diff

From 0e743c8a6d34bd4416fd986c9777b22744ad2283 Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@gmail.com>
Date: Thu, 13 May 2021 23:07:27 -0400
Subject: [PATCH] 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.
---
test/xml/test_node.rb | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/test/xml/test_node.rb b/test/xml/test_node.rb
index 54cc9eccd..11a8b993a 100644
--- a/test/xml/test_node.rb
+++ b/test/xml/test_node.rb
@@ -1047,13 +1047,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