Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<meta charset=utf-8>
<title>Named items: property names don't shadow</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- interface Document -->
<img name="constructor">
<img name="currentScript">
<img name="forms">
<!-- interface Node -->
<img name="firstChild">
<!-- Object.prototype -->
<img name="__proto__">
<img name="foobar">
<script id="this-script">
test(function() {
assert_equals(document.constructor, HTMLDocument);
}, "document.constructor is not shadowed");
test(function() {
assert_equals(document.currentScript, document.getElementById("this-script"));
}, "document.currentScript is not shadowed");
test(function() {
assert_true(document.forms instanceof HTMLCollection);
assert_equals(document.forms.length, 0);
}, "document.forms is not shadowed");
test(function() {
assert_true(document.firstChild instanceof DocumentType);
assert_equals(document.firstChild, document.childNodes[0]);
}, "document.firstChild is not shadowed");
test(function() {
assert_equals(document.__proto__, HTMLDocument.prototype);
}, "document.__proto__ is not shadowed");
test(function() {
assert_true(document.foobar instanceof HTMLImageElement);
}, "document.foobar works (sanity check)");
</script>