Bug Tracker

Modify

Ticket #5744 (closed bug: worksforme)

Opened 3 years ago

Last modified 14 months ago

jQuery selectors search inside HTML comments, causing crashes and/or other errors

Reported by: MrPete Owned by: john
Priority: critical Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: Cc:
Blocking: Blocked by:

Description

Consider this scenario: <body>

<div id="x">

<!--<small class="b"><a href="#" ></a></small>--> <small class="b"><a href="#">Oct 3, 2009</a></small>

</div>

</body>

this: var str= $('small.b:first').text();

Will either crash FireFox (total lockup) or return an empty string depending on (something)

I'm using jQuery inside of GreaseMonkey, for whatever that is worth. But it appears this is a jQuery problem.

Attachments

gmstub.user.js Download (588 bytes) - added by MrPete 3 years ago.
GM stub excercising this bug
test.html Download (332 bytes) - added by MrPete 3 years ago.
Small test HTML file for this bug

Change History

Changed 3 years ago by MrPete

GM stub excercising this bug

Changed 3 years ago by MrPete

Small test HTML file for this bug

comment:1 Changed 3 years ago by MrPete

Sorry about the non-code formatting. My first jQuery ticket :)

comment:2 Changed 3 years ago by MrPete

Update: AFAIK, this is NOT a crasher bug. I've isolated the crashes to another issue.

The effect still stands, as demonstrated in my attachments: selectors "see" nonexistent elements inside of HTML comments.

comment:3 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.