4 <title>Test case
</title>
8 <div style=
"background: green; width: 32px; height: 32px; position: absolute"></div>
11 window
.addEventListener(
14 // Must dynamically fetch another stylesheet
15 var el
= document
.createElement('link');
16 el
.href
= 'data:text/css,';
18 el
.rel
= 'stylesheet';
19 document
.getElementsByTagName('head')[0].appendChild(el
);
21 // Based on jQuery pre-1.6.2 code, which creates a temporary <body>
22 // element to do tests on:
23 // https://github.com/jquery/jquery/blob/304dd618b7aa17158446bedd80af330375d8d4d4/src/support.js#L138
24 // The behavior was changed for jQuery 1.6.2 with this commit:
25 // https://github.com/jquery/jquery/commit/ceba855c010c792aad8fc15edc06b86285f71142/
26 var anotherBody
= document
.createElement('body');
28 document
.documentElement
.insertBefore(
29 anotherBody
, document
.documentElement
.firstChild
);
31 // Triggering a style recalc here is necessary.
32 anotherBody
.offsetHeight
;
34 anotherBody
.parentNode
.removeChild(anotherBody
);