diff --git a/test/files/tlm.html b/test/files/tlm.html
index 3b2b52c9824..ea2c73b459e 100644
--- a/test/files/tlm.html
+++ b/test/files/tlm.html
@@ -827,6 +827,7 @@
Step 3: Upload the video file
Special character div
+Partial collision id
diff --git a/test/html/sax/test_parser.rb b/test/html/sax/test_parser.rb
index 6af9bcaa2ac..b092b895df7 100644
--- a/test/html/sax/test_parser.rb
+++ b/test/html/sax/test_parser.rb
@@ -29,9 +29,9 @@ def test_parse_file
# Take a look at the comment in test_parse_document to know
# a possible reason to this difference.
if Nokogiri.uses_libxml?
- assert_equal 1111, @parser.document.end_elements.length
+ assert_equal 1112, @parser.document.end_elements.length
else
- assert_equal 1120, @parser.document.end_elements.length
+ assert_equal 1121, @parser.document.end_elements.length
end
end
diff --git a/test/html/test_document.rb b/test/html/test_document.rb
index 62b3fc6b1f3..d9b55f1c3c0 100644
--- a/test/html/test_document.rb
+++ b/test/html/test_document.rb
@@ -496,6 +496,15 @@ def awesome divs
}.new)
end
+ def test_find_with_partial_id_collision_function
+ found_by_id = @html.css("#partial_collision_id", Class.new {
+ def collision nodes
+ [nodes.first]
+ end
+ }.new)
+ assert_equal 1, found_by_id.length
+ end
+
def test_dup_shallow
found = @html.search('//div/a').first
dup = found.dup(0)