mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-26 19:56:49 +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
|
||||
var element = data[i],
|
||||
type = element.type,
|
||||
open = type[0] !== '/';
|
||||
open = type.charAt( 0 ) !== '/';
|
||||
// Trim the "/" off the beginning of closing tag types
|
||||
if ( !open ) {
|
||||
type = type.substr( 1 );
|
||||
|
@ -148,7 +148,7 @@ es.DocumentModel.newFromPlainObject = function( obj ) {
|
|||
* @param {Object} annotation Annotation object to generate hash for
|
||||
* @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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -878,6 +878,7 @@ es.ContentView.prototype.getHtml = function( range, options ) {
|
|||
leftPlain,
|
||||
rightPlain,
|
||||
stack = [],
|
||||
chr,
|
||||
i,
|
||||
j;
|
||||
for ( i = 0; i < data.length; i++ ) {
|
||||
|
@ -897,18 +898,19 @@ es.ContentView.prototype.getHtml = function( range, options ) {
|
|||
} else if ( !leftPlain && !rightPlain ) {
|
||||
// [formatted][formatted] pair, open/close any differences
|
||||
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 );
|
||||
}
|
||||
}
|
||||
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 += right[0] in htmlChars ? htmlChars[right[0]] : right[0];
|
||||
left = right;
|
||||
chr = rightPlain ? right : right[0];
|
||||
out += chr in htmlChars ? htmlChars[chr] : chr;
|
||||
left = right;
|
||||
}
|
||||
// Close all remaining tags at the end of the content
|
||||
if ( !rightPlain && right ) {
|
||||
|
|
Loading…
Reference in a new issue