git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Fixed IE ID selectors selecting by the name attribute and added tests
[jquery.git]
/
src
/
selector
/
selector.js
diff --git
a/src/selector/selector.js
b/src/selector/selector.js
index
c6692e1
..
e1abbf4
100644
(file)
--- a/
src/selector/selector.js
+++ b/
src/selector/selector.js
@@
-59,7
+59,7
@@
jQuery.extend({
_resort: function(m){
return ["", m[1], m[3], m[2], m[5]];
},
_resort: function(m){
return ["", m[1], m[3], m[2], m[5]];
},
- _prefix: "z=jQuery.attr(a,m[3]);" // just use attr instead of checking for property first. href in firefox return full URI as property
+ _prefix: "z=a[m[3]];if(!z||/href|src/.test(m[3]))z=jQuery.attr(a,m[3]);"
},
"[": "jQuery.find(m[2],a).length"
},
},
"[": "jQuery.find(m[2],a).length"
},
@@
-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]);
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
// 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
} else {
// Pre-compile a regular expression to handle class searches