| 7 | var alwaysScrollable, |
| 8 | forceScroll = supportjQuery( "<div></div>" ).css( { width: 2000, height: 2000 } ), |
| 9 | checkSupport = function( assert ) { |
| 10 | |
| 11 | // Only run once |
| 12 | checkSupport = false; |
| 13 | |
| 14 | // Append forceScroll to the body instead of #qunit-fixture because the latter is hidden |
| 15 | forceScroll.appendTo( "body" ); |
| 16 | window.scrollTo( 200, 200 ); |
| 17 | forceScroll.detach(); |
| 18 | |
| 19 | // Support: iOS <=7 - 12+ |
| 20 | // Hijack the iframe test infrastructure to detect viewport scrollability |
| 21 | // for pages with position:fixed document element |
| 22 | var done = assert.async(); |
| 23 | testIframe( |
| 24 | null, |
| 25 | "offset/boxes.html", |
| 26 | function( assert, $, win, doc ) { |
| 27 | var scrollTop = win.pageYOffset, |
| 28 | scrollLeft = win.pageXOffset; |
| 29 | doc.documentElement.style.position = "fixed"; |
| 30 | win.scrollTo( scrollLeft, scrollTop ); |
| 31 | alwaysScrollable = win.pageXOffset !== 0; |
| 32 | done(); |
| 33 | }, |
| 34 | function mockQUnit_test( _, testCallback ) { |
| 35 | setTimeout( function() { |
| 36 | testCallback( assert ); |
| 37 | } ); |
| 38 | } |
| 39 | ); |
| 40 | }; |
| 41 | |
| 42 | QUnit.module( "offset", { beforeEach: function( assert ) { |
| 43 | if ( typeof checkSupport === "function" ) { |