r105229 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105228‎ | r105229 | r105230 >
Date:21:37, 5 December 2011
Author:inez
Status:deferred
Tags:
Comment:
Bunch of fixes for IE8
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/models/es.DocumentModel.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.ContentView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/models/es.DocumentModel.js
@@ -84,7 +84,7 @@
8585 // It's an element, figure out it's type
8686 var element = data[i],
8787 type = element.type,
88 - open = type[0] !== '/';
 88+ open = type.charAt( 0 ) !== '/';
8989 // Trim the "/" off the beginning of closing tag types
9090 if ( !open ) {
9191 type = type.substr( 1 );
@@ -148,7 +148,7 @@
149149 * @param {Object} annotation Annotation object to generate hash for
150150 * @returns {String} Hash of annotation
151151 */
152 -es.DocumentModel.getHash = typeof JSON.stringify === 'function' ?
 152+es.DocumentModel.getHash = ( window.JSON && typeof JSON.stringify === 'function' ) ?
153153 JSON.stringify : es.JsonSerializer.stringify;
154154
155155 /**
Index: trunk/extensions/VisualEditor/modules/es/views/es.ContentView.js
@@ -878,6 +878,7 @@
879879 leftPlain,
880880 rightPlain,
881881 stack = [],
 882+ chr,
882883 i,
883884 j;
884885 for ( i = 0; i < data.length; i++ ) {
@@ -897,18 +898,19 @@
898899 } else if ( !leftPlain && !rightPlain ) {
899900 // [formatted][formatted] pair, open/close any differences
900901 for ( j = 1; j < left.length; j++ ) {
901 - if ( right.indexOf( left[j] ) === -1 ) {
 902+ if ( es.inArray( left[j], right ) ) {
902903 out += render( 'close', left[j], stack );
903904 }
904905 }
905906 for ( j = 1; j < right.length; j++ ) {
906 - if ( left.indexOf( right[j] ) === -1 ) {
 907+ if ( es.inArray( right[j], left ) ) {
907908 out += render( 'open', right[j], stack );
908909 }
909910 }
910911 }
911 - out += right[0] in htmlChars ? htmlChars[right[0]] : right[0];
912 - left = right;
 912+ chr = rightPlain ? right : right[0];
 913+ out += chr in htmlChars ? htmlChars[chr] : chr;
 914+ left = right;
913915 }
914916 // Close all remaining tags at the end of the content
915917 if ( !rightPlain && right ) {

Status & tagging log