#951 closed bug (fixed)
$('#foo') conflates id and <a name>
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | core | Version: | |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Steps to Reproduce
- Load the following HTML in IE 6 or 7:
<html> <head> <script src="jquery.js"></script> </head> <body> <a name="foo">MUAHAHAHAHA!!!</a> <p id="foo">Greetings, program!</p> <input type="button" value="Greetings, program!" onclick="alert($('#foo').html());" /> <= broken in IE6/7 <hr /> <p name="bar">MUAHAHAHAHA!!!</p> <p id="bar">Greetings, program!</p> <input type="button" value="Greetings, program!" onclick="alert($('#bar').html());" /> <hr /> <a id="baz">Greetings, program!</a> <p name="baz">MUAHAHAHAHA!!!</p> <input type="button" value="Greetings, program!" onclick="alert($('#baz').html());" /> </body> </html>
- Click on the first button
Expected Result
"Greetings, program!" in the alert box
Actual Result
"MUAHAHAHAHA!!!" in the alert box
Notes
The name attribute only clobbers the id attribute when name is on an anchor tag, as the other two instances on the above page demonstrate.
The bug appears in IE 6 and 7, but not in Firefox 1.5.
This is with jQuery 1.1.1.
Note: See
TracTickets for help on using
tickets.
There is ongoing discussion about this ticket in this thread on the dev list. I've provided a test page and patch in the thread for further discussion.