diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2012-09-18 17:39:44 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-09-18 18:04:31 -0400 |
commit | 15b5dbfe2386d67b8c1df3305812b35abc04458c (patch) | |
tree | e762b8301177061e96654586353cdab821b4280e /src/attributes.js | |
parent | e8e3e90a8620a945d2d4f6012a604d96db2bd317 (diff) | |
download | jquery-15b5dbfe2386d67b8c1df3305812b35abc04458c.tar.gz jquery-15b5dbfe2386d67b8c1df3305812b35abc04458c.zip |
Fix #12229, size/consistency improvements. Close gh-887.
Diffstat (limited to 'src/attributes.js')
-rw-r--r-- | src/attributes.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/attributes.js b/src/attributes.js index aeb4e0f9f..cde7e4732 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -57,7 +57,7 @@ jQuery.fn.extend({ setClass = " " + elem.className + " "; for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { + if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { setClass += classNames[ c ] + " "; } } @@ -90,7 +90,7 @@ jQuery.fn.extend({ // loop over each item in the removal list for ( c = 0, cl = removes.length; c < cl; c++ ) { // Remove until there is nothing to remove, - while ( className.indexOf(" " + removes[ c ] + " ") > -1 ) { + while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { className = className.replace( " " + removes[ c ] + " " , " " ); } } @@ -144,7 +144,7 @@ jQuery.fn.extend({ i = 0, l = this.length; for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { return true; } } @@ -322,7 +322,7 @@ jQuery.extend({ return ret; } else { - elem.setAttribute( name, "" + value ); + elem.setAttribute( name, value + "" ); return value; } @@ -586,7 +586,7 @@ if ( !jQuery.support.style ) { return elem.style.cssText.toLowerCase() || undefined; }, set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); + return ( elem.style.cssText = value + "" ); } }; } |