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

Changed: view.Position#getAncestors changed order of ancestors.

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

+ 1 - 1
packages/ckeditor5-engine/src/view/position.js

@@ -141,7 +141,7 @@ export default class Position {
 	 * @returns {Array} Array with ancestors.
 	 */
 	getAncestors() {
-		return this.parent.getAncestors().concat( this.parent );
+		return this.parent.getAncestors( { includeNode: true, parentFirst: true } );
 	}
 
 	/**

+ 1 - 1
packages/ckeditor5-engine/tests/view/position.js

@@ -123,7 +123,7 @@ describe( 'Position', () => {
 			const div = new Element( 'div', null, p );
 			const docFrag = new DocumentFragment( div );
 
-			expect( new Position( foo, 1 ).getAncestors() ).to.deep.equal( [ docFrag, div, p, foo ] );
+			expect( new Position( foo, 1 ).getAncestors() ).to.deep.equal( [ foo, p, div, docFrag ] );
 		} );
 	} );