blob: a44d7e0f94bec94de3171e9beba7dfb93af783e0 [file] [log] [blame]
<body>
<p>This tests when object elements are accessible by name or id directly as properties of the
document object. IE allows this only if the object has not child nodes other than param and
whitespace anonymous text. A PASS result means that behavior matches IE. WebKit&rsquo;s results for comments differ.
</p>
<hr>
<script>
if (window.layoutTestController)
window.layoutTestController.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", false);
testProperty("param and non-empty comment", "object11", false);
testProperty("param and text", "object6", false);
testProperty("param and img", "object13", false);
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", false);
testProperty("param and non-empty comment", "object12", false);
testProperty("param and text", "object7", false);
testProperty("param and img", "object14", false);
</script>
</body>