r63522 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63521‎ | r63522 | r63523 >
Date:23:12, 9 March 2010
Author:nimishg
Status:ok
Tags:
Comment:
no longer freaks out when opening HTML comments without close HTML comments
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -78,14 +78,14 @@
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 97 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ),
82 - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 43 ),
 82+ array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 44 ),
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 313 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 314 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 313 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 314 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js
@@ -556,10 +556,14 @@
557557 sanatizedStr.substring( endBraces.index + 2 );
558558 }
559559
 560+
560561 //treat HTML comments like whitespace
561562 while ( sanatizedStr.indexOf( '<!' ) != -1 ) {
562563 startIndex = sanatizedStr.indexOf( '<!' );
563564 endIndex = sanatizedStr.indexOf('-->') + 3;
 565+ if( endIndex < 3 ){
 566+ break;
 567+ }
564568 sanatizedSegment = sanatizedStr.substring( startIndex,endIndex ).replace( /\S/g , ' ' );
565569 sanatizedStr =
566570 sanatizedStr.substring( 0, startIndex ) + sanatizedSegment + sanatizedStr.substring( endIndex );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -9669,10 +9669,14 @@
96709670 sanatizedStr.substring( endBraces.index + 2 );
96719671 }
96729672
 9673+
96739674 //treat HTML comments like whitespace
96749675 while ( sanatizedStr.indexOf( '<!' ) != -1 ) {
96759676 startIndex = sanatizedStr.indexOf( '<!' );
96769677 endIndex = sanatizedStr.indexOf('-->') + 3;
 9678+ if( endIndex < 3 ){
 9679+ break;
 9680+ }
96779681 sanatizedSegment = sanatizedStr.substring( startIndex,endIndex ).replace( /\S/g , ' ' );
96789682 sanatizedStr =
96799683 sanatizedStr.substring( 0, startIndex ) + sanatizedSegment + sanatizedStr.substring( endIndex );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -664,7 +664,8 @@
665665 if(wikitext.match(/\s*{{\s*\S*:/)){collapsible=false;}
666666 var sanatizedStr=wikitext.replace(/{{/," ");endBraces=sanatizedStr.match(/}}\s*$/);if(endBraces){sanatizedStr=sanatizedStr.substring(0,endBraces.index)+" "+
667667 sanatizedStr.substring(endBraces.index+2);}
668 -while(sanatizedStr.indexOf('<!')!=-1){startIndex=sanatizedStr.indexOf('<!');endIndex=sanatizedStr.indexOf('-->')+3;sanatizedSegment=sanatizedStr.substring(startIndex,endIndex).replace(/\S/g,' ');sanatizedStr=sanatizedStr.substring(0,startIndex)+sanatizedSegment+sanatizedStr.substring(endIndex);}
 668+while(sanatizedStr.indexOf('<!')!=-1){startIndex=sanatizedStr.indexOf('<!');endIndex=sanatizedStr.indexOf('-->')+3;if(endIndex<3){break;}
 669+sanatizedSegment=sanatizedStr.substring(startIndex,endIndex).replace(/\S/g,' ');sanatizedStr=sanatizedStr.substring(0,startIndex)+sanatizedSegment+sanatizedStr.substring(endIndex);}
669670 while(sanatizedStr.indexOf('{{')!=-1){startIndex=sanatizedStr.indexOf('{{')+1;openBraces=2;endIndex=startIndex;while((openBraces>0)&&(endIndex<sanatizedStr.length)){var brace=sanatizedStr[++endIndex];openBraces+=brace=='}'?-1:brace=='{'?1:0;}
670671 sanatizedSegment=sanatizedStr.substring(startIndex,endIndex).replace(/[{}|=]/g,'X');sanatizedStr=sanatizedStr.substring(0,startIndex)+sanatizedSegment+sanatizedStr.substring(endIndex);}
671672 while(sanatizedStr.indexOf('[[')!=-1){startIndex=sanatizedStr.indexOf('[[')+1;openBraces=2;endIndex=startIndex;while((openBraces>0)&&(endIndex<sanatizedStr.length)){var brace=sanatizedStr[++endIndex];openBraces+=brace==']'?-1:brace=='['?1:0;}

Status & tagging log