]> source.dussan.org Git - jquery.git/commitdiff
handle data- and aria- special
authoraFarkas <info@corrupt-system.de>
Sat, 23 Apr 2011 19:57:55 +0000 (21:57 +0200)
committertimmywil <tim.willison@thisismedium.com>
Mon, 25 Apr 2011 16:41:12 +0000 (12:41 -0400)
src/attributes.js

index 990884484f52d083763ea0318267041aafd9d579..5d8a7adb8b75c5c94de88c1faaf4523511ce96cd 100644 (file)
@@ -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 );