Bug Tracker

Modify

Ticket #7324 (closed bug: duplicate)

Opened 3 years ago

Last modified 15 months ago

Jquery 1.4.3 bug ( id="id" or name="id" )

Reported by: cybernetix@… Owned by:
Priority: blocker Milestone: 1.4.4
Component: selector Version: 1.4.3
Keywords: reference id name Cc:
Blocking: Blocked by:

Description

If id="id" or name="id" then .find() fails.

<script type="text/javascript" language="javascript" src=" http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" charset="utf-8"></script> <script type="text/javascript"> jQuery(function(){

console.log($("#frm").find("#id").length); console.log($("#frm").find("[name=id]").length); console.log($("#frm").find(".cls").length);

}); </script> <form id="frm" name="frm">

<input id="id" name="id" value="0" type="hidden" /> <input class="cls" id="f1" name="f1" value="" type="text" />

</form>

Change History

comment:1 Changed 3 years ago by cybernetix@…

Actually it fails at least in FireFox

comment:2 Changed 3 years ago by cherouvim

I confirm this.

html:

<form action="?" method="get"><input type="hidden" name="id" value="5" /></form>

js:

$('form').find('input')

jQuery 1.4.2 returns:

[input]

jQuery 1.4.3 returns:

[]

comment:3 Changed 3 years ago by cherouvim

live example:  http://jsfiddle.net/eBsjU/

switch from 1.4.2 to 1.4.3 to see the difference

comment:4 Changed 3 years ago by addyosmani

  • Keywords reference id name added
  • Priority changed from undecided to low
  • Status changed from new to closed
  • Component changed from unfiled to selector
  • Resolution set to duplicate

comment:5 follow-up: ↓ 6 Changed 3 years ago by addyosmani

Duplicate of #7212.

comment:6 in reply to: ↑ 5 Changed 3 years ago by anonymous

Replying to addyosmani:

Duplicate of #7212.

Issue still persists ( jQuery 1.4.4rc1 & Firefox v3.6.11 )

Test this in Firefox v3.6.11, not on JSFIDDLE:

<script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.4.4rc1.min.js" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
	console.log($("form").find("#id").length);
	console.log($("form").find("[name=id]").length);
	console.log($("form").find(".cls").length);	
	console.log($("#frm").find("#id").length);
	console.log($("#frm").find("[name=id]").length);
	console.log($("#frm").find(".cls").length);
	console.log($("[name=frm]").find("#id").length);
	console.log($("[name=frm]").find("[name=id]").length);
	console.log($("[name=frm]").find(".cls").length);	
});
</script>
<form id="frm" name="frm">
    <input id="id" name="id" value="0" type="hidden" />
    <input class="cls" id="f1" name="f1" value="" type="text" />
</form>

comment:7 Changed 3 years ago by rwaldron

  • Priority changed from low to blocker
  • Status changed from closed to reopened
  • Resolution duplicate deleted

comment:8 Changed 3 years ago by rwaldron

  • Status changed from reopened to open
  • Milestone changed from 1.5 to 1.4.4

comment:9 Changed 3 years ago by rwaldron

@addyosmani, this is definitely the same as 7212, but I'm reopening because it's clearly still an issue and this new ticket has significantly more data.

ALSO!!! I used this code:

<script src="http://code.jquery.com/jquery-git.js"></script>
<script >
$(function(){
  console.log($("form").find("#id").length);
  console.log($("form").find("[name=id]").length);
  console.log($("form").find(".cls").length); 
  console.log($("#frm").find("#id").length);
  console.log($("#frm").find("[name=id]").length);
  console.log($("#frm").find(".cls").length);
  console.log($("[name=frm]").find("#id").length);
  console.log($("[name=frm]").find("[name=id]").length);
  console.log($("[name=frm]").find(".cls").length); 
});
</script>
<form id="frm" name="frm">
    <input id="id" name="id" value="0" type="hidden" />
    <input class="cls" id="f1" name="f1" value="" type="text" />
</form>

comment:10 Changed 3 years ago by rwaldron

This is the result of my original hideous patch to Sizzle:

 http://gyazo.com/738f6ad524be9297cf7131f81e613302.png

comment:11 Changed 3 years ago by snover

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

comment:12 Changed 3 years ago by snover

#7324 is a duplicate of this ticket.

comment:13 Changed 3 years ago by snover

Duplicate of #7324.

comment:14 Changed 3 years ago by snover

Whoops. Duplicate of #7212.

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.