58 lines
2.8 KiB
Diff
58 lines
2.8 KiB
Diff
From 5145b0da80cceaf6413e0ede3e0f384e07e3033e Mon Sep 17 00:00:00 2001
|
|
From: zouzhimin <zouzhimin@kylinos.cn>
|
|
Date: Sat, 12 Aug 2023 03:38:46 +0800
|
|
Subject: [PATCH] support libxml2 2.10.4 backported
|
|
|
|
---
|
|
test/integration/test_ad_hoc.rb | 4 ++--
|
|
test/integration/test_scrubbers.rb | 4 ++--
|
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/test/integration/test_ad_hoc.rb b/test/integration/test_ad_hoc.rb
|
|
index 9f87187..2efc8fa 100644
|
|
--- a/test/integration/test_ad_hoc.rb
|
|
+++ b/test/integration/test_ad_hoc.rb
|
|
@@ -79,7 +79,7 @@ class IntegrationTestAdHoc < Loofah::TestCase
|
|
|
|
def test_fragment_whitewash_on_microsofty_markup
|
|
whitewashed = Loofah.fragment(MSWORD_HTML).scrub!(:whitewash)
|
|
- if Nokogiri.uses_libxml?("<2.9.11")
|
|
+ if Nokogiri.uses_libxml?("<2.9.11") || Nokogiri.uses_libxml?(">=2.10.4")
|
|
assert_equal "<p>Foo <b>BOLD</b></p>", whitewashed.to_s.strip
|
|
else
|
|
assert_equal "<p>Foo <b>BOLD<p></p></b></p>", whitewashed.to_s.strip
|
|
@@ -88,7 +88,7 @@ class IntegrationTestAdHoc < Loofah::TestCase
|
|
|
|
def test_document_whitewash_on_microsofty_markup
|
|
whitewashed = Loofah.document(MSWORD_HTML).scrub!(:whitewash)
|
|
- if Nokogiri.uses_libxml?("<2.9.11")
|
|
+ if Nokogiri.uses_libxml?("<2.9.11") || Nokogiri.uses_libxml?(">=2.10.4")
|
|
assert_equal "<p>Foo <b>BOLD</b></p>", whitewashed.xpath("/html/body/*").to_s
|
|
else
|
|
assert_equal "<p>Foo <b>BOLD<p></p></b></p>", whitewashed.xpath("/html/body/*").to_s
|
|
diff --git a/test/integration/test_scrubbers.rb b/test/integration/test_scrubbers.rb
|
|
index c8636a3..ed86b1b 100644
|
|
--- a/test/integration/test_scrubbers.rb
|
|
+++ b/test/integration/test_scrubbers.rb
|
|
@@ -69,7 +69,7 @@ class IntegrationTestScrubbers < Loofah::TestCase
|
|
doc = Loofah::HTML::Document.parse "<html><body>#{WHITEWASH_FRAGMENT}</body></html>"
|
|
result = doc.scrub! :whitewash
|
|
|
|
- ww_result = Nokogiri.uses_libxml?("<2.9.11") ? WHITEWASH_RESULT : WHITEWASH_RESULT_LIBXML2911
|
|
+ ww_result = (Nokogiri.uses_libxml?("<2.9.11") || Nokogiri.uses_libxml?(">=2.10.4")) ? WHITEWASH_RESULT : WHITEWASH_RESULT_LIBXML2911
|
|
assert_equal ww_result, doc.xpath("/html/body").inner_html
|
|
assert_equal doc, result
|
|
end
|
|
@@ -248,7 +248,7 @@ class IntegrationTestScrubbers < Loofah::TestCase
|
|
doc = Loofah::HTML::DocumentFragment.parse "<div>#{WHITEWASH_FRAGMENT}</div>"
|
|
result = doc.scrub! :whitewash
|
|
|
|
- ww_result = Nokogiri.uses_libxml?("<2.9.11") ? WHITEWASH_RESULT : WHITEWASH_RESULT_LIBXML2911
|
|
+ ww_result = (Nokogiri.uses_libxml?("<2.9.11") || Nokogiri.uses_libxml?(">=2.10.4")) ? WHITEWASH_RESULT : WHITEWASH_RESULT_LIBXML2911
|
|
assert_equal ww_result, doc.xpath("./div").inner_html
|
|
assert_equal doc, result
|
|
end
|
|
--
|
|
2.39.1
|
|
|