aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes.js
diff options
context:
space:
mode:
authoraFarkas <info@corrupt-system.de>2011-04-23 21:57:55 +0200
committertimmywil <tim.willison@thisismedium.com>2011-04-25 12:41:12 -0400
commit83e9ce95d753bac0a860271ca85aef474295c1c4 (patch)
treecbfad5345af0a5274dd4b0c9aedec5830540a807 /src/attributes.js
parent9559b1a294af42d4c12d20b8af7a8422903b0a73 (diff)
downloadjquery-83e9ce95d753bac0a860271ca85aef474295c1c4.tar.gz
jquery-83e9ce95d753bac0a860271ca85aef474295c1c4.zip
handle data- and aria- special
Diffstat (limited to 'src/attributes.js')
-rw-r--r--src/attributes.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/attributes.js b/src/attributes.js
index 990884484..5d8a7adb8 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -6,6 +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-)/,
formHook;
jQuery.fn.extend({
@@ -311,7 +312,7 @@ jQuery.extend({
if ( value !== undefined ) {
- if ( value === null || value === false ) {
+ if ( value === null || (value === false && !special.test( name )) ) {
jQuery.removeAttr( elem, name );
return undefined;
@@ -319,7 +320,7 @@ jQuery.extend({
return ret;
} else {
- if( value === true ){
+ if( value === true && !special.test( name ) ){
value = name;
}
elem.setAttribute( name, "" + value );