Bug Tracker

Opened 10 years ago

Closed 10 years ago

#13872 closed bug (notabug)

$(self.location).attr("href") fails in IEs

Reported by: fzaitsev Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:


as of 5/9/2013 running javascript:$(location).attr("href") in the address bar of IE browser at jquery.com throws exception.

The exception happens on the line 2631 of the non-minified version of jquery-1.9.1, the function receives the self.location object as elem, and it doesn't have getAttribute method, thus failing.

href/src property should get the full normalized URL (#10299/#12915) jQuery.each([ "href", "src" ], function( i, name ) {

jQuery.propHooks[ name ] = {

get: function( elem ) {

return elem.getAttribute( name, 4 );




It may be arguable if this is a bug or improper use of the method .attr(), but I inherited the code that din't throw any such exceptions with jquery-1.6.1

Change History (1)

comment:1 Changed 10 years ago by Rick Waldron

Resolution: notabug
Status: newclosed

Get the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.

Note: See TracTickets for help on using tickets.