aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-04-23 17:07:31 -0400
committertimmywil <tim.willison@thisismedium.com>2011-04-25 12:41:12 -0400
commit51650338838e61d4d785968ddb5317233b76f55a (patch)
tree68b46dc6449ace81a0190d9dc1bd3549bb10707f /src
parent83e9ce95d753bac0a860271ca85aef474295c1c4 (diff)
downloadjquery-51650338838e61d4d785968ddb5317233b76f55a.tar.gz
jquery-51650338838e61d4d785968ddb5317233b76f55a.zip
Add tests data- and aria- attributes and the autofocus boolean attribute and some style updates in jQuery.attr
Diffstat (limited to 'src')
-rw-r--r--src/attributes.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/attributes.js b/src/attributes.js
index 5d8a7adb8..43d72ae9b 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -6,7 +6,7 @@ var rclass = /[\n\t\r]/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
- special = /^(?:data-|aria-)/,
+ rspecial = /^(?:data-|aria-)/,
formHook;
jQuery.fn.extend({
@@ -312,7 +312,7 @@ jQuery.extend({
if ( value !== undefined ) {
- if ( value === null || (value === false && !special.test( name )) ) {
+ if ( value === null || (value === false && !rspecial.test( name )) ) {
jQuery.removeAttr( elem, name );
return undefined;
@@ -320,9 +320,12 @@ jQuery.extend({
return ret;
} else {
- if( value === true && !special.test( name ) ){
+
+ // Set boolean attributes to the same name
+ if ( value === true && !rspecial.test( name ) ) {
value = name;
}
+
elem.setAttribute( name, "" + value );
return value;
}