Bug Tracker

Opened 10 years ago

Closed 9 years ago

#4244 closed bug

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 );

Change History (2)

comment:1 Changed 9 years ago by Rick Waldron

Owner: changed from john to dbrown
Status: newpending

Please provide a reduced jsFiddle test

comment:2 Changed 9 years ago by trac-o-bot

Status: pendingclosed

Automatically closed due to 14 days of inactivity.

Note: See TracTickets for help on using tickets.