chromium/third_party/blink/web_tests/fast/dom/HTMLDocument/object-by-name-or-id.html

<body>

<p>This tests when object elements are accessible by name or id directly as properties of the
document object. A PASS result means that behavior matches IE and Firefox.
</p>

<hr>

<script>
if (window.testRunner)
    testRunner.dumpAsText();
</script>

<div style="visibility: hidden; width: 0px; height: 0px;">
<object name="object1" width="0" height="0"></object>
<object name="object2" width="0" height="0"><param name="p" value="v"></object>
<object name="object5" width="0" height="0"><param name="p" value="v">    </object>
<object name="object9" width="0" height="0"><param name="p" value="v"><!-- --></object>
<object name="object11" width="0" height="0"><param name="p" value="v"><!-- comment --></object>
<object name="object6" width="0" height="0"><param name="p" value="v">text</object>
<object name="object13" width="0" height="0"><param name="p" value="v"><img width="0" height="0"></object>
<object id="object3" width="0" height="0"></object>
<object id="object4" width="0" height="0"><param name="p" value="v"></object>
<object id="object8" width="0" height="0"><param name="p" value="v">    </object>
<object id="object10" width="0" height="0"><param name="p" value="v"><!-- --></object>
<object id="object12" width="0" height="0"><param name="p" value="v"><!-- comment --></object>
<object id="object7" width="0" height="0"><param name="p" value="v">text</object>
<object id="object14" width="0" height="0"><param name="p" value="v"><img width="0" height="0"></object>
</div>

<pre id="results">
Results:<br>
</pre>

<script>
function print(x)
{
   document.getElementById("results").innerHTML += x;
}

function testProperty(description, propName, IE) {
    print(description);
    print(":");
    var propVal = document[propName];

    print(!propVal == IE ? " FAIL" : " PASS");
    print("<br>");
}

print("By name:<br>");
testProperty("no children", "object1", true);
testProperty("param", "object2", true);
testProperty("param and whitespace", "object5", true);
testProperty("param and empty comment", "object9", true);
testProperty("param and non-empty comment", "object11", true);
testProperty("param and text", "object6", true);
testProperty("param and img", "object13", true);
print("<br>By id:<br>");
testProperty("no children", "object3", true);
testProperty("param", "object4", true);
testProperty("param and whitespace", "object8", true);
testProperty("param and empty comment", "object10", true);
testProperty("param and non-empty comment", "object12", true);
testProperty("param and text", "object7", true);
testProperty("param and img", "object14", true);

</script>
</body>