diff --git a/test/data/iframeTest.js b/test/data/iframeTest.js index 877e884f0..4db56833c 100644 --- a/test/data/iframeTest.js +++ b/test/data/iframeTest.js @@ -1,4 +1,3 @@ - window.startIframeTest = function() { var args = Array.prototype.slice.call( arguments ); diff --git a/test/data/testinit.js b/test/data/testinit.js index c37687f68..dd06f86be 100644 --- a/test/data/testinit.js +++ b/test/data/testinit.js @@ -236,6 +236,7 @@ this.testIframe = function( title, fileName, func ) { var iframe; var done = assert.async(); + // Test iframes are expected to invoke this via startIframeTest (cf. iframeTest.js) window.iframeCallback = function() { var args = Array.prototype.slice.call( arguments ); diff --git a/test/unit/offset.js b/test/unit/offset.js index 622a7ba90..2acfd71af 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -4,28 +4,45 @@ if ( !jQuery.fn.offset ) { return; } -var supportsScroll, supportsFixedPosition, - forceScroll = jQuery( "
" ).css( { width: 2000, height: 2000 } ), - checkSupport = function() { +var supportsFixedPosition, supportsScroll, alwaysScrollable, + forceScroll = supportjQuery( "
" ).css( { width: 2000, height: 2000 } ), + checkSupport = function( assert ) { // Only run once checkSupport = false; - var checkFixed = jQuery( "
" ).css( { position: "fixed", top: "20px" } ).appendTo( "#qunit-fixture" ); + var checkFixed = supportjQuery( "
" ) + .css( { position: "fixed", top: "20px" } ) + .appendTo( "#qunit-fixture" ); + supportsFixedPosition = checkFixed[ 0 ].offsetTop === 20; + checkFixed.remove(); - // Must append to body because #qunit-fixture is hidden and elements inside it don't have a scrollTop + // Append forceScroll to the body instead of #qunit-fixture because the latter is hidden forceScroll.appendTo( "body" ); window.scrollTo( 200, 200 ); supportsScroll = document.documentElement.scrollTop || document.body.scrollTop; forceScroll.detach(); - supportsFixedPosition = checkFixed[ 0 ].offsetTop === 20; - checkFixed.remove(); + // Support: iOS <=7 + // Hijack the iframe test infrastructure to detect viewport scrollability + // for pages with position:fixed document element + var done = assert.async(), + $iframe = supportjQuery( "