@@ -1397,32 +1397,37 @@ describe('jqLite', function() {
1397
1397
expect ( contents [ 1 ] . data ) . toEqual ( 'before-' ) ;
1398
1398
} ) ;
1399
1399
1400
- // IE8 does not like this test, although the functionality may still work there.
1401
- if ( ! msie || msie > 8 ) {
1402
- it ( 'should select all types iframe contents' , function ( ) {
1403
- var iframe_ = document . createElement ( 'iframe' ) , tested ,
1404
- iframe = jqLite ( iframe_ ) ;
1405
- function test ( ) {
1406
- var contents = iframe . contents ( ) ;
1407
- expect ( contents [ 0 ] ) . toBeTruthy ( ) ;
1408
- expect ( contents . length ) . toBe ( 1 ) ;
1409
- expect ( contents . prop ( 'nodeType' ) ) . toBe ( 9 ) ;
1410
- expect ( contents [ 0 ] . body ) . toBeTruthy ( ) ;
1411
- expect ( jqLite ( contents [ 0 ] . body ) . contents ( ) . length ) . toBe ( 3 ) ;
1412
- iframe . remove ( ) ;
1413
- tested = true ;
1414
- }
1415
- iframe_ . onload = iframe_ . onreadystatechange = function ( ) {
1416
- if ( iframe_ . contentDocument ) test ( ) ;
1417
- } ;
1418
- iframe_ . src = "/base/test/fixtures/iframe.html" ;
1419
- jqLite ( document ) . find ( 'body' ) . append ( iframe ) ;
1400
+ it ( 'should select all types iframe contents' , function ( ) {
1401
+ // IE8 does not like this test, although the functionality may still work there.
1402
+ if ( msie < 9 ) return ;
1403
+ var iframe_ = document . createElement ( 'iframe' ) ;
1404
+ var tested = false ;
1405
+ var iframe = jqLite ( iframe_ ) ;
1406
+ function test ( ) {
1407
+ var doc = iframe_ . contentDocument || iframe_ . contentWindow . document ;
1408
+ doc . body . innerHTML = '\n<span>Text</span>\n' ;
1409
+
1410
+ var contents = iframe . contents ( ) ;
1411
+ expect ( contents [ 0 ] ) . toBeTruthy ( ) ;
1412
+ expect ( contents . length ) . toBe ( 1 ) ;
1413
+ expect ( contents . prop ( 'nodeType' ) ) . toBe ( 9 ) ;
1414
+ expect ( contents [ 0 ] . body ) . toBeTruthy ( ) ;
1415
+ expect ( jqLite ( contents [ 0 ] . body ) . contents ( ) . length ) . toBe ( 3 ) ;
1416
+ iframe . remove ( ) ;
1417
+ doc = null ;
1418
+ tested = true ;
1419
+ }
1420
+ iframe_ . onload = iframe_ . onreadystatechange = function ( ) {
1421
+ if ( iframe_ . contentDocument ) test ( ) ;
1422
+ } ;
1423
+ /* jshint scripturl:true */
1424
+ iframe_ . src = 'javascript:false' ;
1425
+ jqLite ( document ) . find ( 'body' ) . append ( iframe ) ;
1420
1426
1421
- // This test is potentially flaky on CI cloud instances, so there is a generous
1422
- // wait period...
1423
- waitsFor ( function ( ) { return tested ; } , 2000 ) ;
1424
- } ) ;
1425
- }
1427
+ // This test is potentially flaky on CI cloud instances, so there is a generous
1428
+ // wait period...
1429
+ waitsFor ( function ( ) { return tested ; } , 5000 ) ;
1430
+ } ) ;
1426
1431
} ) ;
1427
1432
1428
1433
0 commit comments