Skip to main content

Bug Tracker

Side navigation

#13499 closed bug (fixed)

Opened February 22, 2013 12:06PM UTC

Closed February 23, 2013 02:31AM UTC

Last modified May 24, 2013 01:46PM UTC

Descendant selector fails when searched ID doesn't exists but NAME does (IE7 only)

Reported by: cem.moreau@gmail.com Owned by: gibson042
Priority: low Milestone: 1.10
Component: selector Version: git
Keywords: Cc:
Blocked by: Blocking:
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.

Attachments (0)
Change History (9)

Changed February 22, 2013 02:07PM UTC by anonymous comment:1

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.

Changed February 22, 2013 03:00PM UTC by gibson042 comment:2

owner: → cem.moreau@gmail.com
status: newpending

Replying to [comment:1 anonymous]:

This is really weird, I hope my first example will enlight the root cause of all this.

It will if you can reproduce it in jsFiddle or another public sandbox. Without that, though, there's basically nothing we can do.

Changed February 22, 2013 03:29PM UTC by cem.moreau@gmail.com comment:3

status: pendingnew

Here is the sandboxed example : http://jsbin.com/ibotuw/3/

Be aware : edit will crash under IE7.

Changed February 22, 2013 06:43PM UTC by gibson042 comment:4

owner: cem.moreau@gmail.comgibson042
status: newassigned

Thanks very much. This will be fixed in the next release.

Changed February 23, 2013 02:29AM UTC by gibson042 comment:5

component: unfiledselector
milestone: None1.9.2
priority: undecidedlow

Changed February 23, 2013 02:31AM UTC by Richard Gibson comment:6

resolution: → fixed
status: assignedclosed

Fix #13499: selector with leading ID matching only a name

Changeset: 5c4ab97a64c162503ac200bc7cea7f3e5725984d

Changed February 23, 2013 02:31AM UTC by Richard Gibson comment:7

Fix #13499: selector with leading ID matching only a name

(cherry picked from commit 5c4ab97a64c162503ac200bc7cea7f3e5725984d)

Changeset: 7d36c0fb6e0e97a2f1af31657104d6cbd5d90b64

Changed May 24, 2013 01:43PM UTC by dmethvin comment:8

milestone: 1.9.21.10/2.0

Bulk update to milestone 1.10/2.0

Changed May 24, 2013 01:46PM UTC by dmethvin comment:9

milestone: 1.10/2.01.10