blob: d376d538c8ca7ce14ab97c76b093e3770cd985c4 [file] [log] [blame]
<html>
<head>
<script type="text/javascript" charset="utf-8">
function log(msg)
{
document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
}
function test(element, name)
{
var didPass = true;
for (prop in element) {
if (prop == "toString")
didPass = false;
}
if (didPass)
log("PASS: the toString function is not enumerable for " + name + ".");
else
log("FAIL: the toString function is enumerable for " + name + " and should not be.");
}
function runTests()
{
if (window.testRunner)
testRunner.dumpAsText();
// DOM objects with custom toString() functions
test(document.createElement('a'), "HTMLAnchorElement");
test(window.location, "Location");
test(window.getSelection(), "Selection");
// Other DOM objects
test(document.createElement('div'), "HTMLDivElement");
test(document, "HTMLDocument");
// JS objects
test({}, "Object");
test([], "Array");
}
</script>
</head>
<body onload="runTests();">
<p>This tests that the toString() function does not enumerate.</p>
<pre id="console"></pre>
</body>
</html>