8
0
Просмотр исходного кода

Fixed: DomConverter#getCorrespondingDomText + tests.

Szymon Cofalik 9 лет назад
Родитель
Сommit
59f1f23663

+ 2 - 2
packages/ckeditor5-engine/src/view/domconverter.js

@@ -597,8 +597,8 @@ export default class DomConverter {
 			return this.getCorrespondingDom( previousSibling ).nextSibling;
 		}
 
-		// Try to use parent to find the corresponding text node.
-		if ( !previousSibling && this.getCorrespondingDom( viewText.parent ) ) {
+		// If this is a first node, try to use parent to find the corresponding text node.
+		if ( !previousSibling && viewText.parent && this.getCorrespondingDom( viewText.parent ) ) {
 			return this.getCorrespondingDom( viewText.parent ).childNodes[ 0 ];
 		}
 

+ 4 - 0
packages/ckeditor5-engine/tests/view/domconverter/binding.js

@@ -239,6 +239,10 @@ describe( 'DomConverter', () => {
 
 			expect( converter.getCorrespondingDom( viewFragment ) ).to.equal( domFragment );
 		} );
+
+		it( 'should return null if wrong parameter is passed', () => {
+			expect( converter.getCorrespondingDom( null ) ).to.be.null;
+		} );
 	} );
 
 	describe( 'getCorrespondingDomElement', () => {