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

Changed: make getAncestors work with iframes.

Szymon Cofalik 9 лет назад
Родитель
Сommit
2d916303d5
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      packages/ckeditor5-utils/tests/dom/getancestors.js

+ 12 - 0
packages/ckeditor5-utils/tests/dom/getancestors.js

@@ -35,4 +35,16 @@ describe( 'getAncestors', () => {
 
 		expect( ancestors.includes( document ) ).to.be.false;
 	} );
+
+	it( 'should not return any non-Node, non-DocumentFragment object if given node is in iframe', () => {
+		const iframe = document.getElementsByTagName( 'iframe' )[ 0 ];
+		const iframeDoc = iframe.contentWindow.document;
+
+		const span = createElement( iframeDoc, 'span' );
+		iframeDoc.documentElement.appendChild( span );
+
+		const ancestors = getAncestors( span );
+
+		expect( ancestors.includes( iframeDoc ) ).to.be.false;
+	} );
 } );