Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test console error for invalid pattern attributes</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<input pattern="[a]" id="inp">
</div>
<pre id="test">
<script>
SimpleTest.waitForExplicitFinish();
function runTest() {
// should find exactly one error
SimpleTest.monitorConsole(SimpleTest.finish, [
{ errorMessage: new RegExp(
"Unable to check <input pattern=ā€˜\\[a-\\]ā€™> because ā€˜/\\[a-\\]/vā€™ is not a valid regexp"
) }
], /*forbidUnexpectedMsgs*/ true);
let inp = document.getElementById("inp");
// should cause no error
inp.value = "a";
// should cause one error
inp.pattern = "[a-]";
SimpleTest.endMonitorConsole();
}
runTest();
</script>
</pre>
</body>
</html>