r61695 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61694‎ | r61695 | r61696 >
Date:23:38, 29 January 2010
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: IE7 doesn't allow str[0], use str.charAt( 0 ). Also, IE replaces all our \n with \r, convert them back so EditWarning's comparison works
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.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -72,7 +72,7 @@
7373 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ),
7575 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 26 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 89 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 90 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 26 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 45 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 11 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 202 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 203 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 202 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 203 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -402,8 +402,8 @@
403403 while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
404404 t = t.next();
405405 }
406 - if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue[0] != '\n'
407 - && t.node.nodeValue[0] != '\r' ) {
 406+ if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue.charAt( 0 ) != '\n'
 407+ && t.node.nodeValue.charAt( 0 ) != '\r' ) {
408408 text += "\n";
409409 }
410410 $( this ).text( text );
@@ -412,9 +412,10 @@
413413 // IE aggressively collapses whitespace in .text() after having done DOM manipulation,
414414 // but for some crazy reason this does work
415415 if ( $.browser.msie ) {
416 - $pre = $( '<pre>' + $pre.html() + '</pre>' );
 416+ return $( '<pre>' + $pre.html() + '</pre>' ).text().replace( /\r/g, '\n' );
 417+ } else {
 418+ return $pre.text();
417419 }
418 - return $pre.text();
419420 },
420421
421422 /*
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6826,8 +6826,8 @@
68276827 while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
68286828 t = t.next();
68296829 }
6830 - if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue[0] != '\n'
6831 - && t.node.nodeValue[0] != '\r' ) {
 6830+ if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue.charAt( 0 ) != '\n'
 6831+ && t.node.nodeValue.charAt( 0 ) != '\r' ) {
68326832 text += "\n";
68336833 }
68346834 $( this ).text( text );
@@ -6836,9 +6836,10 @@
68376837 // IE aggressively collapses whitespace in .text() after having done DOM manipulation,
68386838 // but for some crazy reason this does work
68396839 if ( $.browser.msie ) {
6840 - $pre = $( '<pre>' + $pre.html() + '</pre>' );
 6840+ return $( '<pre>' + $pre.html() + '</pre>' ).text().replace( /\r/g, '\n' );
 6841+ } else {
 6842+ return $pre.text();
68416843 }
6842 - return $pre.text();
68436844 },
68446845
68456846 /*
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -453,9 +453,8 @@
454454 +'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t")});$pre.find('br').each(function(){$(this).replaceWith("\n");});$pre.find('p').each(function(){if(this.previousSibling||this.parentNode!=$pre.get(0)){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,-10,this).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();}
455455 if(t){text="\n"+text;}
456456 t=new context.fn.rawTraverser(this.lastChild,-10,this).next();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.next();}
457 -if(t&&!t.inP&&t.node.nodeName=='#text'&&t.node.nodeValue[0]!='\n'&&t.node.nodeValue[0]!='\r'){text+="\n";}
458 -$(this).text(text);}});if($.browser.msie){$pre=$('<pre>'+$pre.html()+'</pre>');}
459 -return $pre.text();},'getContents':function(){return context.fn.htmlToText(context.$content.html());},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();}
 457+if(t&&!t.inP&&t.node.nodeName=='#text'&&t.node.nodeValue.charAt(0)!='\n'&&t.node.nodeValue.charAt(0)!='\r'){text+="\n";}
 458+$(this).text(text);}});if($.browser.msie){return $('<pre>'+$pre.html()+'</pre>').text().replace(/\r/g,'\n');}else{return $pre.text();}},'getContents':function(){return context.fn.htmlToText(context.$content.html());},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();}
460459 if(typeof retval.text!='undefined'){retval=context.fn.htmlToText(retval.htmlText);}else if(retval.toString){retval=retval.toString();}
461460 return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selTextArr;var selectAfter=false;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';}
462461 if(options.splitlines){selTextArr=selText.split(/\n/);}

Status & tagging log