From: Dave Methvin Date: Fri, 2 Nov 2012 00:50:45 +0000 (-0400) Subject: Fix #10299. Add a propHook for oldIE link href. X-Git-Tag: 1.9.0b1~123 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=240b141a22c4783d619fc67c91f990d1535e7c57;p=jquery.git Fix #10299. Add a propHook for oldIE link href. --- diff --git a/src/attributes.js b/src/attributes.js index 52098ae34..dbaf3d5eb 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -562,6 +562,7 @@ if ( !getSetAttribute ) { // Some attributes require a special call on IE +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !jQuery.support.hrefNormalized ) { jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { @@ -571,6 +572,13 @@ if ( !jQuery.support.hrefNormalized ) { } }); }); + + // link's href property should get the full normalized URL (#10299) + jQuery.propHooks.href = { + get: function( elem, name ) { + return elem.getAttribute( name, 4 ); + } + }; } if ( !jQuery.support.style ) { diff --git a/test/unit/attributes.js b/test/unit/attributes.js index f171e896e..e2648a0e6 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -54,7 +54,7 @@ test( "jQuery.propFix integrity test", function() { }); test( "attr(String)", function() { - expect( 46 ); + expect( 47 ); equal( jQuery("#text1").attr("type"), "text", "Check for type attribute" ); equal( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" ); @@ -92,6 +92,8 @@ test( "attr(String)", function() { "href": "#5" }).appendTo("#qunit-fixture"); equal( jQuery("#tAnchor5").attr("href"), "#5", "Check for non-absolute href (an anchor)" ); + jQuery("").appendTo("#qunit-fixture"); + equal( jQuery("#tAnchor5").prop("href"), jQuery("#tAnchor6").prop("href"), "Check for absolute href prop on an anchor" ); // list attribute is readonly by default in browsers that support it jQuery("#list-test").attr( "list", "datalist" );