blob: f7c761295a7994f85b30f0a319fe02017551b8b2 [file] [log] [blame]
<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 + ".");
log("FAIL: the toString function is enumerable for " + name + " and should not be.");
function runTests()
if (window.testRunner)
// DOM objects with custom toString() functions
test(window.location, "Location");
// Other DOM objects
test(document.createElement('div'), "HTMLDivElement");
test(document, "HTMLDocument");
// JS objects
test({}, "Object");
test([], "Array");
<body onload="runTests();">
<p>This tests that the toString() function does not enumerate.</p>
<pre id="console"></pre>