handle data- and aria- special
This commit is contained in:
parent
9559b1a294
commit
83e9ce95d7
|
@ -6,6 +6,7 @@ var rclass = /[\n\t\r]/g,
|
||||||
rtype = /^(?:button|input)$/i,
|
rtype = /^(?:button|input)$/i,
|
||||||
rfocusable = /^(?:button|input|object|select|textarea)$/i,
|
rfocusable = /^(?:button|input|object|select|textarea)$/i,
|
||||||
rclickable = /^a(?:rea)?$/i,
|
rclickable = /^a(?:rea)?$/i,
|
||||||
|
special = /^(?:data-|aria-)/,
|
||||||
formHook;
|
formHook;
|
||||||
|
|
||||||
jQuery.fn.extend({
|
jQuery.fn.extend({
|
||||||
|
@ -311,7 +312,7 @@ jQuery.extend({
|
||||||
|
|
||||||
if ( value !== undefined ) {
|
if ( value !== undefined ) {
|
||||||
|
|
||||||
if ( value === null || value === false ) {
|
if ( value === null || (value === false && !special.test( name )) ) {
|
||||||
jQuery.removeAttr( elem, name );
|
jQuery.removeAttr( elem, name );
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
||||||
|
@ -319,7 +320,7 @@ jQuery.extend({
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if( value === true ){
|
if( value === true && !special.test( name ) ){
|
||||||
value = name;
|
value = name;
|
||||||
}
|
}
|
||||||
elem.setAttribute( name, "" + value );
|
elem.setAttribute( name, "" + value );
|
||||||
|
|
Loading…
Reference in a new issue