Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for handler functions not interfering with CSS id queries #1890

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/files/tlm.html
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ <h3>Step 3: Upload the video file</h3>
</div>

<div id="abc.123" class='special.character'>Special character div</div>
<div id="partial_collision_id">Partial collision id</div>
<div id="footer">
A design by <a href="http://blog.geminigeek.com/wordpress-theme">GeminiGeek</a> &bull; Powered by <a href="http://wordpress.org">Wordpress</a><!--&bull; <a href="#">CSS</a> &bull; <a href="#">xHTML 1.0</a>-->
</div>
Expand Down
4 changes: 2 additions & 2 deletions test/html/sax/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions test/html/test_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down