Bug Tracker

Modify

Ticket #7275 (closed bug: duplicate)

Opened 3 years ago

Last modified 14 months ago

jQuery.fn.find() returns no results in Firefox for forms that contain input element with name "id"

Reported by: hallettj@… Owned by:
Priority: undecided Milestone: 1.5
Component: traversing Version: 1.4.3
Keywords: fn find id regression Cc:
Blocking: Blocked by:

Description

jQuery: 1.4.3 browser: Firefox 3.6.11 OS: Ubuntu 9.10 and Ubuntu 10.04

Steps to reproduce in Firefox 3.6:

  1. Create a form element with some child elements.
  2. Inside the form, place an input element with a name attribute set to "id".
  3. Using jQuery reference the form and try to find() any set of elements inside of it. For example: $('#myForm').find('input').

Step 3 will yield an empty result set no matter what selector is given to find().

This issue does not appear to affect jQuery 1.4.2.

The problem is that jQuery tries to change the id attribute of the form and to use that new id value as a point of reference when invoking querySelectorAll(). Because the form has an input element named "id" accessing the "id" attribute of the form access that input element instead of the form's own element id.

Test case:  http://jsfiddle.net/hallettj/pWNFe/

Running the above test case in Firefox 3.6 outputs "false" in the console. In Chrome 7 the same test case outputs "true".

Change History

comment:1 Changed 3 years ago by addyosmani

  • Keywords fn find id regression needsreview added
  • Status changed from new to open

Flagging as a regression we need to review. This is related to the fact that DOM 0 makes frames automatically expand onto the Doc object and input elements more or less automatically expand onto the form element. It's an issue we've seen in at least one other ticket but this is not a dupe.

comment:2 Changed 3 years ago by addyosmani

#7280 is a duplicate of this ticket.

comment:3 Changed 3 years ago by rwaldron

  • Status changed from open to closed
  • Resolution set to duplicate

comment:4 Changed 3 years ago by rwaldron

  • Status changed from closed to reopened
  • Resolution duplicate deleted

comment:5 Changed 3 years ago by rwaldron

  • Status changed from reopened to closed
  • Resolution set to duplicate
  • Component changed from unfiled to traversing

comment:6 Changed 3 years ago by rwaldron

Duplicate of #7212.

comment:7 Changed 3 years ago by dmethvin

  • Keywords needsreview removed

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.