diff --git a/lib/nokogiri/xml/node.rb b/lib/nokogiri/xml/node.rb index c90a64cabc0..41538a80ed9 100644 --- a/lib/nokogiri/xml/node.rb +++ b/lib/nokogiri/xml/node.rb @@ -1102,7 +1102,7 @@ def fragment(tags) # Parse +string_or_io+ as a document fragment within the context of # *this* node. Returns a XML::NodeSet containing the nodes parsed from # +string_or_io+. - def parse(string_or_io, options = nil) + def parse(string_or_io, options_ = nil, options: options_) ## # When the current node is unparented and not an element node, use the # document as the parsing context instead. Otherwise, the in-context diff --git a/test/xml/test_node.rb b/test/xml/test_node.rb index abb11161a34..3c21124b3cb 100644 --- a/test/xml/test_node.rb +++ b/test/xml/test_node.rb @@ -153,6 +153,35 @@ def test_node_context_parsing_of_malformed_html_fragment_without_recover_is_not_ end end + def test_node_context_parsing_of_malformed_html_fragment_without_recover_is_not_corrected_keyword + skip("libxml2 2.14.0 no longer raises this error") if Nokogiri.uses_libxml?(">= 2.14.0") + + doc = HTML4.parse("
") + context_node = doc.at_css("div") + assert_raises(Nokogiri::XML::SyntaxError) do + context_node.parse("