From a88e364337c93f0cd84ed8594531ba9fed8b874d Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 2 Dec 2009 18:44:03 +0000 Subject: [PATCH] Fix more abuses of spacing in regexes in jQuery --- js2/js2stopgap.js | 10 +++++----- js2/js2stopgap.min.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js2/js2stopgap.js b/js2/js2stopgap.js index 00602c2e01..9a709ba53a 100644 --- a/js2/js2stopgap.js +++ b/js2/js2stopgap.js @@ -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 ); diff --git a/js2/js2stopgap.min.js b/js2/js2stopgap.min.js index 94cd141aec..40e45da6ff 100644 --- a/js2/js2stopgap.min.js +++ b/js2/js2stopgap.min.js @@ -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 -- 2.20.1