Skip to main content

Bug Tracker

Side navigation

#7324 closed bug (duplicate)

Opened October 27, 2010 07:44AM UTC

Closed October 27, 2010 10:04PM UTC

Last modified March 10, 2012 02:56AM UTC

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

Reported by: cybernetix@gmail.com Owned by:
Priority: blocker Milestone: 1.4.4
Component: selector Version: 1.4.3
Keywords: reference id name Cc:
Blocked by: Blocking:
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>

Attachments (0)
Change History (14)

Changed October 27, 2010 08:05AM UTC by cybernetix@gmail.com comment:1

Actually it fails at least in FireFox

Changed October 27, 2010 02:35PM UTC by cherouvim comment:2

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:

[]

Changed October 27, 2010 02:41PM UTC by cherouvim comment:3

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

switch from 1.4.2 to 1.4.3 to see the difference

Changed October 27, 2010 03:06PM UTC by addyosmani comment:4

component: unfiledselector
keywords: → reference id name
priority: undecidedlow
resolution: → duplicate
status: newclosed

Changed October 27, 2010 03:07PM UTC by addyosmani comment:5

Duplicate of #7212.

Changed October 27, 2010 05:51PM UTC by anonymous comment:6

Replying to [comment:5 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>

Changed October 27, 2010 09:23PM UTC by rwaldron comment:7

priority: lowblocker
resolution: duplicate
status: closedreopened

Changed October 27, 2010 09:23PM UTC by rwaldron comment:8

milestone: 1.51.4.4
status: reopenedopen

Changed October 27, 2010 09:25PM UTC by rwaldron comment:9

@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>

Changed October 27, 2010 09:42PM UTC by rwaldron comment:10

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

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

Changed October 27, 2010 10:04PM UTC by snover comment:11

resolution: → duplicate
status: openclosed

Changed October 27, 2010 10:04PM UTC by snover comment:12

#7324 is a duplicate of this ticket.

Changed October 27, 2010 10:04PM UTC by snover comment:13

Duplicate of #7324.

Changed October 27, 2010 10:05PM UTC by snover comment:14

Whoops. Duplicate of #7212.