Changeset 1896
- Timestamp:
- 05/13/07 17:20:03 (2 years ago)
- Location:
- trunk/jquery
- Files:
-
- 3 modified
-
build/test/index.html (modified) (1 diff)
-
src/selector/selector.js (modified) (1 diff)
-
src/selector/selectorTest.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jquery/build/test/index.html
r1827 r1896 93 93 <form id="lengthtest"> 94 94 <input type="text" id="length" name="test"> 95 <input type="text" id="idTest" name="id"> 95 96 </form> 96 97 <table id="table"></table> -
trunk/jquery/src/selector/selector.js
r1842 r1896 230 230 // Do a quick check for the existence of the actual ID attribute 231 231 // to avoid selecting by the name attribute in IE 232 if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && oid.id != m[2] ) 232 // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form 233 if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] ) 233 234 oid = jQuery('[@id="'+m[2]+'"]', elem)[0]; 234 235 -
trunk/jquery/src/selector/selectorTest.js
r1843 r1896 28 28 29 29 test("id", function() { 30 expect(2 3);30 expect(24); 31 31 t( "ID Selector", "#body", ["body"] ); 32 32 t( "ID Selector w/ Element", "body#body", ["body"] ); … … 56 56 ok( $("#tName1")[0].id == 'tName1', "ID selector with same value for a name attribute" ); 57 57 ok( $("#tName2").length == 0, "ID selector non-existing but name attribute on an A tag" ); 58 t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"] ); 58 59 59 60 t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986 … … 111 112 t( "Last Child", "p:last-child", ["sap"] ); 112 113 113 t( "Nth-child", "#main form > *:nth-child(2)", ["text2" ] );114 t( "Nth-child", "#main form > :nth-child(2)", ["text2" ] );114 t( "Nth-child", "#main form > *:nth-child(2)", ["text2","idTest"] ); 115 t( "Nth-child", "#main form > :nth-child(2)", ["text2","idTest"] ); 115 116 }); 116 117 … … 151 152 t( "Only Child", "a:only-child", ["simon1","anchor1","yahoo","anchor2"] ); 152 153 t( "Empty", "ul:empty", ["firstUL"] ); 153 t( "Enabled UI Element", "input:enabled", ["text1","radio1","radio2","check1","check2","hidden1","hidden2","name","length" ] );154 t( "Enabled UI Element", "input:enabled", ["text1","radio1","radio2","check1","check2","hidden1","hidden2","name","length","idTest"] ); 154 155 t( "Disabled UI Element", "input:disabled", ["text2"] ); 155 156 t( "Checked UI Element", "input:checked", ["radio2","check1"] ); … … 169 170 t( "Position Less Than", "p:lt(3)", ["firstp","ap","sndp"] ); 170 171 t( "Is A Parent", "p:parent", ["firstp","ap","sndp","en","sap","first"] ); 171 t( "Is Visible", "input:visible", ["text1","text2","radio1","radio2","check1","check2","name","length" ] );172 t( "Is Visible", "input:visible", ["text1","text2","radio1","radio2","check1","check2","name","length","idTest"] ); 172 173 t( "Is Hidden", "input:hidden", ["hidden1","hidden2"] ); 173 174 174 t( "Form element :input", ":input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "button", "area1", "select1", "select2", "select3", "length" ] );175 t( "Form element :input", ":input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "button", "area1", "select1", "select2", "select3", "length", "idTest"] ); 175 176 t( "Form element :radio", ":radio", ["radio1", "radio2"] ); 176 177 t( "Form element :checkbox", ":checkbox", ["check1", "check2"] ); 177 t( "Form element :text", ":text", ["text1", "text2", "hidden2", "name", "length" ] );178 t( "Form element :text", ":text", ["text1", "text2", "hidden2", "name", "length", "idTest"] ); 178 179 t( "Form element :radio:checked", ":radio:checked", ["radio2"] ); 179 180 t( "Form element :checkbox:checked", ":checkbox:checked", ["check1"] );
