r77501 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77500‎ | r77501 | r77502 >
Date:19:38, 30 November 2010
Author:reedy
Status:ok
Tags:
Comment:
Remove some redundant character escapes from regexes
Modified paths:
  • /trunk/phase3/resources/jquery.effects/jquery.effects.core.js (modified) (history)
  • /trunk/phase3/resources/jquery/jquery.color.js (modified) (history)
  • /trunk/phase3/skins/common/ajaxwatch.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/ajaxwatch.js
@@ -65,8 +65,8 @@
6666 var $link = $( this );
6767 $link
6868 .data( 'icon', $link.parents( 'li' ).hasClass( 'icon' ) )
69 - .data( 'action', $link.attr( 'href' ).match( /[\?\&]action=unwatch/i ) ? 'unwatch' : 'watch' );
70 - var title = $link.attr( 'href' ).match( /[\?\&]title=(.*?)&/i )[1];
 69+ .data( 'action', $link.attr( 'href' ).match( /[\?&]action=unwatch/i ) ? 'unwatch' : 'watch' );
 70+ var title = $link.attr( 'href' ).match( /[\?&]title=(.*?)&/i )[1];
7171 $link.data( 'target', decodeURIComponent( title ).replace( /_/g, ' ' ) );
7272 });
7373
Index: trunk/phase3/resources/jquery/jquery.color.js
@@ -39,7 +39,7 @@
4040 return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
4141
4242 // Look for rgb(num%,num%,num%)
43 - if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
 43+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*\)/.exec(color))
4444 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
4545
4646 // Look for #a0b1c2
Index: trunk/phase3/resources/jquery.effects/jquery.effects.core.js
@@ -52,7 +52,7 @@
5353 return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
5454
5555 // Look for rgb(num%,num%,num%)
56 - if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
 56+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*\)/.exec(color))
5757 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
5858
5959 // Look for #a0b1c2

Status & tagging log