aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes.js
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-05-01 17:09:50 -0400
committertimmywil <tim.willison@thisismedium.com>2011-05-01 17:09:50 -0400
commit24a8ffb3eae56345231931184891f25f6ce017cf (patch)
treefa5a1fc0f028e67170e9925faa991cd08afa1ca7 /src/attributes.js
parente2bace8fa129c2bf3fe5bd382a4b05d96e8cf245 (diff)
downloadjquery-24a8ffb3eae56345231931184891f25f6ce017cf.tar.gz
jquery-24a8ffb3eae56345231931184891f25f6ce017cf.zip
Test for a colon in attribute names for IE6/7. Fixes #1591.
Diffstat (limited to 'src/attributes.js')
-rw-r--r--src/attributes.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/attributes.js b/src/attributes.js
index ade38bcaf..017a32da4 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -7,6 +7,7 @@ var rclass = /[\n\t\r]/g,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rspecial = /^(?:data-|aria-)/,
+ rinvalidChar = /\:/,
formHook;
jQuery.fn.extend({
@@ -308,7 +309,10 @@ jQuery.extend({
// Get the appropriate hook, or the formHook
// if getSetAttribute is not supported and we have form objects in IE6/7
- hooks = jQuery.attrHooks[ name ] || ( jQuery.nodeName( elem, "form" ) && formHook );
+ hooks = jQuery.attrHooks[ name ] ||
+ ( formHook && (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ?
+ formHook :
+ undefined );
if ( value !== undefined ) {
@@ -451,10 +455,11 @@ if ( !jQuery.support.getSetAttribute ) {
// Use this for any attribute on a form in IE6/7
formHook = jQuery.attrHooks.name = jQuery.attrHooks.value = jQuery.valHooks.button = {
get: function( elem, name ) {
+ var ret;
if ( name === "value" && !jQuery.nodeName( elem, "button" ) ) {
return elem.getAttribute( name );
}
- var ret = elem.getAttributeNode( name );
+ ret = elem.getAttributeNode( name );
// Return undefined if not specified instead of empty string
return ret && ret.specified ?
ret.nodeValue :