aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraFarkas <info@corrupt-system.de>2012-11-18 20:48:49 -0500
committerDave Methvin <dave.methvin@gmail.com>2012-11-18 21:20:12 -0500
commitca5e06a15c99d5c181aff6e08804ca803424648d (patch)
tree0d8092b3641b8c7c388ec510379a931d639e2f8e
parent20be650bae02c866fa9660a3683cbf1617166795 (diff)
downloadjquery-ca5e06a15c99d5c181aff6e08804ca803424648d.tar.gz
jquery-ca5e06a15c99d5c181aff6e08804ca803424648d.zip
Fix #12915, add propHook for scrip src property on oldIE. Close gh-1035.
-rw-r--r--src/attributes.js14
-rw-r--r--test/unit/attributes.js5
2 files changed, 12 insertions, 7 deletions
diff --git a/src/attributes.js b/src/attributes.js
index 8ae23f72a..919733cd8 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -568,12 +568,14 @@ 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 );
- }
- };
+ // 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 );
+ }
+ };
+ });
}
if ( !jQuery.support.style ) {
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index d0d074d38..4e3ae6e4a 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( 47 );
+ expect( 48 );
equal( jQuery("#text1").attr("type"), "text", "Check for type attribute" );
equal( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" );
@@ -94,6 +94,9 @@ test( "attr(String)", function() {
equal( jQuery("#tAnchor5").attr("href"), "#5", "Check for non-absolute href (an anchor)" );
jQuery("<a id='tAnchor6' href='#5' />").appendTo("#qunit-fixture");
equal( jQuery("#tAnchor5").prop("href"), jQuery("#tAnchor6").prop("href"), "Check for absolute href prop on an anchor" );
+
+ $("<script type='jquery/test' src='#5' id='scriptSrc'></script>").appendTo("#qunit-fixture");
+ equal( jQuery("#tAnchor5").prop("href"), jQuery("#scriptSrc").prop("src"), "Check for absolute src prop on a script" );
// list attribute is readonly by default in browsers that support it
jQuery("#list-test").attr( "list", "datalist" );