Side navigation
#4244 closed bug ()
Opened February 25, 2009 03:22PM UTC
Closed November 11, 2010 11:09PM UTC
selector by attribute "src" not working the same way as in 1.2.6
Reported by: | dbrown | Owned by: | dbrown |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | selector | Version: | 1.3.2 |
Keywords: | src | Cc: | |
Blocked by: | Blocking: |
Description
I'm trying to select images like this:
$("img[src='/site/images/image.gif']")
With jQuery 1.2.6 it worked correctly but with jQuery 1.3.2, the check is done against an absolute url : jQuery is trying to compare '/site/images/image.gif' with 'http://mysiteurl.com/site/images/image.gif'.
My browser is IE 6.0 SP2.
I fixed it by doing this:
attrHandle: {
href: function(elem){
return elem.getAttribute("href");
},
src: function(elem){
return elem.getAttribute("src",2);
}
}
In version 1.2.6, I think it was this part of the code which was handling it correctly:
// These attributes require special treatment
var special = /href|src|style/.test( name );
[ ... ]
var attr = msie && notxml && special
// Some attributes require a special call on IE
? elem.getAttribute( name, 2 )
: elem.getAttribute( name );
Please provide a reduced jsFiddle test