Fix more abuses of spacing in regexes in jQuery
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 2 Dec 2009 18:44:03 +0000 (18:44 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 2 Dec 2009 18:44:03 +0000 (18:44 +0000)
js2/js2stopgap.js
js2/js2stopgap.min.js

index 00602c2..9a709ba 100644 (file)
@@ -30,7 +30,7 @@ var
        // (both of which we optimize for)
        quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
        // Is it a simple selector
-       isSimple = / ^ .[ ^ :# \[\.,]*$/;
+       isSimple = /^.[^:# \[\.,]*$/;
 
 jQuery.fn = jQuery.prototype = {
        init: function( selector, context ) {
@@ -460,7 +460,7 @@ jQuery.fn = jQuery.prototype = {
                        if ( this.nodeType != 1 )
                                return;
 
-                       if ( jQuery.isArray( value ) && / radio | checkbox / .test( this.type ) )
+                       if ( jQuery.isArray( value ) && /radio|checkbox/ .test( this.type ) )
                                this.checked = ( jQuery.inArray( this.value, value ) >= 0 ||
                                        jQuery.inArray( this.name, value ) >= 0 );
 
@@ -791,7 +791,7 @@ jQuery.extend( {
                }
 
                // Make sure we're using the right name for getting the float value
-               if ( name.match( / float /i ) )
+               if ( name.match( /float/i ) )
                        name = styleFloat;
 
                if ( !force && style && style[ name ] )
@@ -800,10 +800,10 @@ jQuery.extend( {
                else if ( defaultView.getComputedStyle ) {
 
                        // Only "float" is needed here
-                       if ( name.match( / float /i ) )
+                       if ( name.match( /float/i ) )
                                name = "float";
 
-                       name = name.replace( / ( [A - Z] ) /g, "-$1" ).toLowerCase();
+                       name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
 
                        var computedStyle = defaultView.getComputedStyle( elem, null );
 
index 94cd141..40e45da 100644 (file)
@@ -1,6 +1,6 @@
 
 (function(){var
-window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;this.context=selector;return this;}
+window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:# \[\.,]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;this.context=selector;return this;}
 if(typeof selector==="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])
 selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem&&elem.id!=match[3])
 return jQuery().find(selector);var ret=jQuery(elem||[]);ret.context=document;ret.selector=selector;return ret;}}else