Permalink
Browse files

handle data- and aria- special

  • Loading branch information...
1 parent 9559b1a commit 83e9ce95d753bac0a860271ca85aef474295c1c4 @aFarkas aFarkas committed with timmywil Apr 23, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/attributes.js
View
@@ -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,15 +312,15 @@ jQuery.extend({
if ( value !== undefined ) {
- if ( value === null || value === false ) {
+ if ( value === null || (value === false && !special.test( name )) ) {
jQuery.removeAttr( elem, name );
return undefined;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
- if( value === true ){
+ if( value === true && !special.test( name ) ){
value = name;
}
elem.setAttribute( name, "" + value );

0 comments on commit 83e9ce9

Please sign in to comment.