r60738 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60737‎ | r60738 | r60739 >
Date:18:41, 6 January 2010
Author:nimishg
Status:ok (Comments)
Tags:
Comment:
IE fixes
Modified paths:
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js
@@ -378,8 +378,14 @@
379379 if ( currentField.indexOf( '=' ) == -1 ) {
380380 // anonymous field, gets a number
381381 valueBegin = currentField.match( /\S+/ ); //first nonwhitespace character
 382+ if( valueBegin == null ){ //ie
 383+ continue;
 384+ }
382385 valueBeginIndex = valueBegin.index + oldDivider+1;
383386 valueEnd = currentField.match( /[^\s]\s*$/ ); //last nonwhitespace character
 387+ if( valueEnd == null ){ //ie
 388+ continue;
 389+ }
384390 valueEndIndex = valueEnd.index + oldDivider + 2;
385391 ranges.push( new Range( ranges[ranges.length-1].end,
386392 valueBeginIndex ) ); //all the chars upto now
@@ -408,6 +414,9 @@
409415 nameBeginIndex = nameBegin.index + oldDivider + 1;
410416 // Last nonwhitespace and non } character
411417 nameEnd = currentName.match( /[^\s]\s*$/ );
 418+ if( nameEnd == null ){ //ie
 419+ continue;
 420+ }
412421 nameEndIndex = nameEnd.index + oldDivider + 2;
413422 // All the chars upto now
414423 ranges.push( new Range( ranges[ranges.length-1].end, nameBeginIndex ) );
@@ -416,9 +425,15 @@
417426 oldDivider += currentField.indexOf( '=' ) + 1;
418427 // First nonwhitespace character
419428 valueBegin = currentValue.match( /\S+/ );
 429+ if( valueBegin == null ){ //ie
 430+ continue;
 431+ }
420432 valueBeginIndex = valueBegin.index + oldDivider + 1;
421433 // Last nonwhitespace and non } character
422434 valueEnd = currentValue.match( /[^\s]\s*$/ );
 435+ if( valueEnd == null ){ //ie
 436+ continue;
 437+ }
423438 valueEndIndex = valueEnd.index + oldDivider + 2;
424439 // All the chars upto now
425440 equalsIndex = ranges.push( new Range( ranges[ranges.length-1].end, valueBeginIndex) ) - 1;

Comments

#Comment by Trevor Parscal (WMF) (talk | contribs)   19:45, 6 January 2010

This actually breaks IE in a different way - now the first template parameter is not parsed when written like

OOjs UI icon information-progressive.svg
Thank you for experimenting with MediaWiki.org. Your test worked, and it has been reverted or removed. Please use the sandbox, Structured Discussions sandbox or the VisualEditor test page for any other tests you may want to do. If you want to contribute, please read Project:About.

- aka no white-space around the template parameters.

#Comment by Trevor Parscal (WMF) (talk | contribs)   20:03, 6 January 2010

(ok, let's try this again)

This actually breaks IE in a different way - now the first template parameter is not parsed when written like {{test|a=1|b=2}} - aka no white-space around the template parameters.

Status & tagging log