r59671 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59670‎ | r59671 | r59672 >
Date:18:44, 2 December 2009
Author:catrope
Status:reverted
Tags:
Comment:
Fix more abuses of spacing in regexes in jQuery
Modified paths:
  • /trunk/phase3/js2/js2stopgap.js (modified) (history)
  • /trunk/phase3/js2/js2stopgap.min.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/js2stopgap.js
@@ -30,7 +30,7 @@
3131 // (both of which we optimize for)
3232 quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
3333 // Is it a simple selector
34 - isSimple = / ^ .[ ^ :# \[\.,]*$/;
 34+ isSimple = /^.[^:# \[\.,]*$/;
3535
3636 jQuery.fn = jQuery.prototype = {
3737 init: function( selector, context ) {
@@ -460,7 +460,7 @@
461461 if ( this.nodeType != 1 )
462462 return;
463463
464 - if ( jQuery.isArray( value ) && / radio | checkbox / .test( this.type ) )
 464+ if ( jQuery.isArray( value ) && /radio|checkbox/ .test( this.type ) )
465465 this.checked = ( jQuery.inArray( this.value, value ) >= 0 ||
466466 jQuery.inArray( this.name, value ) >= 0 );
467467
@@ -791,7 +791,7 @@
792792 }
793793
794794 // Make sure we're using the right name for getting the float value
795 - if ( name.match( / float /i ) )
 795+ if ( name.match( /float/i ) )
796796 name = styleFloat;
797797
798798 if ( !force && style && style[ name ] )
@@ -800,10 +800,10 @@
801801 else if ( defaultView.getComputedStyle ) {
802802
803803 // Only "float" is needed here
804 - if ( name.match( / float /i ) )
 804+ if ( name.match( /float/i ) )
805805 name = "float";
806806
807 - name = name.replace( / ( [A - Z] ) /g, "-$1" ).toLowerCase();
 807+ name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
808808
809809 var computedStyle = defaultView.getComputedStyle( elem, null );
810810
Index: trunk/phase3/js2/js2stopgap.min.js
@@ -1,6 +1,6 @@
22
33 (function(){var
4 -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;}
 4+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;}
55 if(typeof selector==="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])
66 selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem&&elem.id!=match[3])
77 return jQuery().find(selector);var ret=jQuery(elem||[]);ret.context=document;ret.selector=selector;return ret;}}else

Follow-up revisions

RevisionCommit summaryAuthorDate
r59697Revert js2stopgap to its good state before r58959 tried to prettify it and r5...catrope10:22, 3 December 2009

Status & tagging log