Browse Source

Merge pull request #580 from ckeditor/t/576

Fixed compatibility issues in tests.
Piotrek Koszuliński 9 years ago
parent
commit
214117f05e

+ 5 - 5
packages/ckeditor5-engine/src/dataprocessor/xmldataprocessor.js

@@ -107,17 +107,17 @@ export default class XmlDataProcessor {
 		// Wrap data into root element with optional namespace definitions.
 		data = `<xml ${ namespaces }>${ data }</xml>`;
 
-		const document = this._domParser.parseFromString( data, 'text/xml' );
+		const parsedDocument = this._domParser.parseFromString( data, 'text/xml' );
 
 		// Parse validation.
-		const parserError = document.querySelector( 'parsererror' );
+		const parserError = parsedDocument.querySelector( 'parsererror' );
 
 		if ( parserError ) {
-			throw new Error( 'Parse error - ' + parserError.querySelector( 'div' ).textContent );
+			throw new Error( 'Parse error - ' + parserError.textContent );
 		}
 
-		const fragment = document.createDocumentFragment();
-		const nodes = document.documentElement.childNodes;
+		const fragment = parsedDocument.createDocumentFragment();
+		const nodes = parsedDocument.documentElement.childNodes;
 
 		while ( nodes.length > 0 ) {
 			fragment.appendChild( nodes[ 0 ] );

+ 2 - 2
packages/ckeditor5-engine/tests/dataprocessor/xmldataprocessor.js

@@ -4,7 +4,7 @@
  */
 
 /* bender-tags: browser-only */
-/* globals window, setTimeout */
+/* globals window */
 
 import XmlDataProcessor from '/ckeditor5/engine/dataprocessor/xmldataprocessor.js';
 import xssTemplates from '/tests/engine/dataprocessor/_utils/xsstemplates.js';
@@ -73,7 +73,7 @@ describe( 'XmlDataProcessor', () => {
 				window.testXss = sinon.spy();
 				dataProcessor.toView( input );
 
-				setTimeout( () => {
+				window.setTimeout( () => {
 					sinon.assert.notCalled( window.testXss );
 					done();
 				}, 10 );