Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>Named access on the window object - Document without window</title>
<link rel="author" title="Matthew Phillips" href="mailto:matthew@matthewphillips.info">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
"use strict";
test(() => {
const doc = document.implementation.createHTMLDocument();
// Sanity check
assert_equals(doc.defaultView, null);
const img = doc.createElement("img");
img.setAttribute("id", "foo");
doc.body.appendChild(img);
assert_true(Boolean(img.parentNode));
img.setAttribute("id", "bar");
assert_equals(img.getAttribute("id"), "bar");
doc.body.removeChild(img);
assert_false(Boolean(img.parentNode));
}, "A document without a Window must not cause errors");
</script>