Ticket #13499 (closed bug: fixed)
Descendant selector fails when searched ID doesn't exists but NAME does (IE7 only)
| Reported by: | cem.moreau@… | Owned by: | gibson042 |
|---|---|---|---|
| Priority: | low | Milestone: | 1.10 |
| Component: | selector | Version: | git |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
It seems that jQuery selector with IE7 doesn't behave the right way : in the following example, $("#notes2 textarea") shouldn't match anything -- it does, with an error.
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<div id="content">
<textarea name="notes2"></textarea>
</div>
</body>
</html>
The following code ouputs "notes2" - OK
$("#content textarea").attr("name");
$("textarea").attr("name");
The following code ouputs "undefined" - OK
$("#doesntexists textarea").attr("name");
But this one FAILS.
$("#notes2 textarea").attr("name");
In my opinion textarea attribute name "notes2" conflicts with the #notes2 selector.
Change History
comment:2 in reply to: ↑ 1 Changed 3 months ago by gibson042
- Owner set to cem.moreau@…
- Status changed from new to pending
comment:3 Changed 3 months ago by cem.moreau@…
- Status changed from pending to new
Here is the sandboxed example : http://jsbin.com/ibotuw/3/
Be aware : edit will crash under IE7.
comment:4 Changed 3 months ago by gibson042
- Owner changed from cem.moreau@… to gibson042
- Status changed from new to assigned
Thanks very much. This will be fixed in the next release.
comment:5 Changed 3 months ago by gibson042
- Priority changed from undecided to low
- Component changed from unfiled to selector
- Milestone changed from None to 1.9.2
comment:6 Changed 3 months ago by Richard Gibson
- Status changed from assigned to closed
- Resolution set to fixed
Fix #13499: selector with leading ID matching only a name
Changeset: 5c4ab97a64c162503ac200bc7cea7f3e5725984d
comment:7 Changed 3 months ago by Richard Gibson
Fix #13499: selector with leading ID matching only a name (cherry picked from commit 5c4ab97a64c162503ac200bc7cea7f3e5725984d)
Changeset: 7d36c0fb6e0e97a2f1af31657104d6cbd5d90b64
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

I may be wrong on my diagnosis: I still have the same problem on a more complex page I can't reproduce here, even if I don't have any name conflict.
This is really weird, I hope my first example will enlight the root cause of all this.