<html>
<head>
<title>ValidityState minimal test case</title>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<fieldset name="victim">
<select name="victim"></select>
<input name="victim"/>
<textarea name="victim"></textarea>
<button name="victim"></button>
<output name="victim"></output>
<object name="victim"></object>
</fieldset>
<script>
description('Each form control in this document exposes a validity attribute that returns a live instance of ValidityState.');
function countAttr(o) {
var a = 0;
for (pisell in o)
a++;
return a;
}
var controls = document.getElementsByName("victim");
for (var i = 0; i < controls.length; ++i) {
debug('===> Tests for ' + controls[i].tagName);
shouldBeTrue('"validity" in controls[i]');
var validity1, validity2;
shouldBeTrue('validity1 = controls[i].validity; validity1 instanceof ValidityState');
shouldBeTrue('validity2 = controls[i].validity; validity1 === validity2');
shouldBe('countAttr(controls[i].validity)', '11');
}
shouldThrow('new ValidityState()', '"TypeError: Illegal constructor"');
</script>
</body>
</html>