X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fattributes.js;h=73dee368badc8c7962ce1f426dcd2de9d32d500d;hb=8e1d3697109e70ccdcb29e269af251216de057a8;hp=4fa49b914169a90af85fa579867ed8ed32c80690;hpb=a44ec402771f6d622506f39073d0be260400dd21;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index 4fa49b9..73dee36 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -1,13 +1,13 @@ (function( jQuery ) { var rclass = /[\n\t]/g, - rspace = /\s+/, + rspaces = /\s+/, rreturn = /\r/g, - rspecialurl = /href|src|style/, - rtype = /(button|input)/i, - rfocusable = /(button|input|object|select|textarea)/i, - rclickable = /^(a|area)$/i, - rradiocheck = /radio|checkbox/; + rspecialurl = /^(?:href|src|style)$/, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea)?$/i, + rradiocheck = /^(?:radio|checkbox)$/i; jQuery.fn.extend({ attr: function( name, value ) { @@ -32,7 +32,7 @@ jQuery.fn.extend({ } if ( value && typeof value === "string" ) { - var classNames = (value || "").split( rspace ); + var classNames = (value || "").split( rspaces ); for ( var i = 0, l = this.length; i < l; i++ ) { var elem = this[i]; @@ -66,7 +66,7 @@ jQuery.fn.extend({ } if ( (value && typeof value === "string") || value === undefined ) { - var classNames = (value || "").split(rspace); + var classNames = (value || "").split( rspaces ); for ( var i = 0, l = this.length; i < l; i++ ) { var elem = this[i]; @@ -104,7 +104,7 @@ jQuery.fn.extend({ // toggle individual class names var className, i = 0, self = jQuery(this), state = stateVal, - classNames = value.split( rspace ); + classNames = value.split( rspaces ); while ( (className = classNames[ i++ ]) ) { // check each className given, space seperated list