2 <script src=
"../../../resources/js-test.js"></script>
3 <iframe id=
"nullbody" src=
"resources/quirks-empty.html"></iframe><br>
4 <iframe id=
"nullroot" src=
"resources/quirks-empty.html"></iframe><br>
6 description("Verifies that asking for the scrollingElement of a document with null body or null documentElement doesn't crash");
7 var jsTestIsAsync
= true;
11 // Verify scrollTopLeftInterop is actually enabled.
12 shouldBe("document.scrollingElement", "document.documentElement");
14 // Verify null body doesn't crash.
15 var nullbody
= document
.getElementById("nullbody");
16 nullbody
.contentDocument
.documentElement
.removeChild(nullbody
.contentDocument
.body
);
17 shouldBeEqualToString("nullbody.contentDocument.compatMode", "BackCompat");
18 shouldBeNull("nullbody.contentDocument.body");
19 shouldBeNull("nullbody.contentDocument.scrollingElement");
21 // Verify null documentElement doesn't crash.
22 var nullroot
= document
.getElementById("nullroot");
23 nullroot
.contentDocument
.removeChild(nullroot
.contentDocument
.documentElement
);
24 shouldBeEqualToString("nullroot.contentDocument.compatMode", "BackCompat");
25 shouldBeNull("nullroot.contentDocument.documentElement");
26 shouldBeNull("nullroot.contentDocument.body");
27 shouldBeNull("nullroot.contentDocument.scrollingElement")
33 e
.target
.loaded
= true;
34 if (nullbody
.loaded
&& nullroot
.loaded
)
38 nullbody
.addEventListener('load', onload
);
39 nullroot
.addEventListener('load', onload
);