* Fixed IE ID selectors selecting by the name attribute and added tests

* Added href attribute test to test suite
* Updated Changelog
This commit is contained in:
Brandon Aaron 2007-02-23 02:53:22 +00:00
parent 4259b02c99
commit 44599e174b
4 changed files with 20 additions and 7 deletions

View file

@ -223,11 +223,15 @@ jQuery.extend({
if ( m[1] == "#" && ret[ret.length-1].getElementById ) {
// Optimization for HTML document case
var oid = ret[ret.length-1].getElementById(m[2]);
// Do a quick check for the existence of the actual ID attribute
// to avoid selecting by the name attribute in IE
if ( jQuery.browser.msie && oid && oid.id != m[2] )
oid = jQuery('[@id="'+m[2]+'"]', ret[ret.length-1])[0];
// Do a quick check for node name (where applicable) so
// that div#foo searches will be really fast
ret = r = oid &&
(!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
} else {
// Pre-compile a regular expression to handle class searches