Ticket #1215 (closed bug: worksforme)
Selector bug with IE 6 & 7
| Reported by: | ScorpioX | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.1.3 |
| Component: | core | Version: | 1.1.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Hi,
I've been working with Jquery for quite some time, thanks for your brilliant work, but now came across a strange problem with Selector under IE 6 & 7 at least.
Below is the sample code with just two lists, the first list item contains a link each while the second merely some text. Selector problem occurs with the two simple line of code trying to select a or li items with id assigned.
The code works fine in FireFox but not in IE 6 or 7. Not sure if it's browser bug or Jquery bug. I can work around by changing the id property in the seoncd list into title or others, or remove the 2nd list completely.
But I guess there are certain bigger issues within Jquery core which is beyond my capability to identify, so I'm putting it forward hoping to trigger a solution soon.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="jquery.pack.js"></script>
<script type="text/javascript">
$(function(){
$(".list1 a[@id]").css("background","#0f0"); //Won't work in IE due to list2
$("li[@id]").css("background","#00f"); //Won't work in IE due to list2
});
</script>
</head>
<body>
<ul class="list1">
<li><a id="w0" href="#">ABC</a></li>
<li><a id="w1" href="#">DEF</a></li>
<li><a id="w2" href="#">GHI</a></li>
<li><a id="w3" href="#">JKL</a></li>
<li><a id="w4" href="#">MNO</a></li>
</ul>
<pre>Each LI in list2 is assigned with an id, which makes jquery selector a[@id] or li{@id] fail, if changed to other property like title or alt, the problem is gone.</pre>
<ul class="list2">
<li id="w">AAA</li>
<li id="x">BBB</li>
<li id="y">CCC</li>
<li id="z">DDD</li>
</ul>
</body>
</html>
Best regards! Wayne
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This works for me with latest SVN and jQuery 1.1.3a