From: aFarkas Date: Sat, 23 Apr 2011 19:57:55 +0000 (+0200) Subject: handle data- and aria- special X-Git-Tag: 1.6rc1~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=83e9ce95d753bac0a860271ca85aef474295c1c4;p=jquery.git handle data- and aria- special --- 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 );