<html>
<body>

<p>
This test verifies that only document.all is undetectable.  Other
HTMLCollections should be detectable.
</p>

<script>
if (window.layoutTestController) {
  layoutTestController.dumpAsText();
}

function shouldBeUndetectable(name) {
  if (document[name]) {
    document.write("Failed: document." + name + " is detectable.<br>");
  } else {
    document.write("Passed: document." + name + " is undetectable.<br>");
  }
};

function shouldBeDetectable(name) {
  if (document[name]) {
    document.write("Passed: document." + name + " is detectable.<br>");
  } else {
    document.write("Failed: document." + name + " is detectable.<br>");
  }
};

var undetectable = ["all"];
var detectable = ["images", "applets", "links", "forms", "anchors",
                  "embeds", "plugins", "scripts"];

for (var i = 0; i < undetectable.length; i++) {
  shouldBeUndetectable(undetectable[i]);
}

for (var i = 0; i < detectable.length; i++) {
  shouldBeDetectable(detectable[i]);
}
</script>
</body>
</html>
