Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#7324 closed bug (duplicate)

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

Change History (14)

comment:1 Changed 9 years ago by cybernetix@…

Actually it fails at least in FireFox

comment:2 Changed 9 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 9 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 9 years ago by addyosmani

Component: unfiledselector
Keywords: reference id name added
Priority: undecidedlow
Resolution: duplicate
Status: newclosed

comment:5 Changed 9 years ago by addyosmani

Duplicate of #7212.

comment:6 in reply to:  5 Changed 9 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 9 years ago by Rick Waldron

Priority: lowblocker
Resolution: duplicate
Status: closedreopened

comment:8 Changed 9 years ago by Rick Waldron

Milestone: 1.51.4.4
Status: reopenedopen

comment:9 Changed 9 years ago by Rick Waldron

@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 9 years ago by Rick Waldron

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

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

comment:11 Changed 9 years ago by snover

Resolution: duplicate
Status: openclosed

comment:12 Changed 9 years ago by snover

#7324 is a duplicate of this ticket.

comment:13 Changed 9 years ago by snover

Duplicate of #7324.

comment:14 Changed 9 years ago by snover

Whoops. Duplicate of #7212.

Note: See TracTickets for help on using tickets.