function checkNegativeMaxLengthException(element)
{
caught = false;
try {
element.setAttribute('maxLength', -10);
} catch(e) {
caught = true;
}
ok(!caught, "Setting maxLength attribute to a negative value shouldn't throw an exception");
caught = false;
try {
element.maxLength = -20;
} catch(e) {
is(e.name, "IndexSizeError", "Should be an IndexSizeError exception");
caught = true;
}
ok(caught, "Setting negative maxLength from the DOM should throw an exception");
is(element.getAttribute('maxLength'), "-10", "When the exception is raised, the maxLength attribute shouldn't change");
}
/* TODO: correct behavior may be checked for email, telephone, url and search input types */
checkNegativeMaxLengthException(document.getElementById('t'));
checkNegativeMaxLengthException(document.getElementById('i'));
checkNegativeMaxLengthException(document.getElementById('p'));
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.