mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-27 04:06:51 +00:00
Bunch of fixes for IE8
This commit is contained in:
parent
7cf6990af3
commit
8ec3fb5b81
|
@ -84,7 +84,7 @@ es.DocumentModel.createNodesFromData = function( data ) {
|
||||||
// It's an element, figure out it's type
|
// It's an element, figure out it's type
|
||||||
var element = data[i],
|
var element = data[i],
|
||||||
type = element.type,
|
type = element.type,
|
||||||
open = type[0] !== '/';
|
open = type.charAt( 0 ) !== '/';
|
||||||
// Trim the "/" off the beginning of closing tag types
|
// Trim the "/" off the beginning of closing tag types
|
||||||
if ( !open ) {
|
if ( !open ) {
|
||||||
type = type.substr( 1 );
|
type = type.substr( 1 );
|
||||||
|
@ -148,7 +148,7 @@ es.DocumentModel.newFromPlainObject = function( obj ) {
|
||||||
* @param {Object} annotation Annotation object to generate hash for
|
* @param {Object} annotation Annotation object to generate hash for
|
||||||
* @returns {String} Hash of annotation
|
* @returns {String} Hash of annotation
|
||||||
*/
|
*/
|
||||||
es.DocumentModel.getHash = typeof JSON.stringify === 'function' ?
|
es.DocumentModel.getHash = ( window.JSON && typeof JSON.stringify === 'function' ) ?
|
||||||
JSON.stringify : es.JsonSerializer.stringify;
|
JSON.stringify : es.JsonSerializer.stringify;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -878,6 +878,7 @@ es.ContentView.prototype.getHtml = function( range, options ) {
|
||||||
leftPlain,
|
leftPlain,
|
||||||
rightPlain,
|
rightPlain,
|
||||||
stack = [],
|
stack = [],
|
||||||
|
chr,
|
||||||
i,
|
i,
|
||||||
j;
|
j;
|
||||||
for ( i = 0; i < data.length; i++ ) {
|
for ( i = 0; i < data.length; i++ ) {
|
||||||
|
@ -897,17 +898,18 @@ es.ContentView.prototype.getHtml = function( range, options ) {
|
||||||
} else if ( !leftPlain && !rightPlain ) {
|
} else if ( !leftPlain && !rightPlain ) {
|
||||||
// [formatted][formatted] pair, open/close any differences
|
// [formatted][formatted] pair, open/close any differences
|
||||||
for ( j = 1; j < left.length; j++ ) {
|
for ( j = 1; j < left.length; j++ ) {
|
||||||
if ( right.indexOf( left[j] ) === -1 ) {
|
if ( es.inArray( left[j], right ) ) {
|
||||||
out += render( 'close', left[j], stack );
|
out += render( 'close', left[j], stack );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ( j = 1; j < right.length; j++ ) {
|
for ( j = 1; j < right.length; j++ ) {
|
||||||
if ( left.indexOf( right[j] ) === -1 ) {
|
if ( es.inArray( right[j], left ) ) {
|
||||||
out += render( 'open', right[j], stack );
|
out += render( 'open', right[j], stack );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out += right[0] in htmlChars ? htmlChars[right[0]] : right[0];
|
chr = rightPlain ? right : right[0];
|
||||||
|
out += chr in htmlChars ? htmlChars[chr] : chr;
|
||||||
left = right;
|
left = right;
|
||||||
}
|
}
|
||||||
// Close all remaining tags at the end of the content
|
// Close all remaining tags at the end of the content
|
||||||
|
|
Loading…
Reference in a new issue