no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / layout / base / tests / input-maxlength-valid-change.html
blob261264253488fd79159d589aebffd6931b08cb92
1 <!DOCTYPE HTML>
2 <html>
3 <!-- Test: input with maxlength is valid if the user edits and it's not too long -->
4 <head>
5 <style>
6 :valid { background-color:green; }
7 :invalid { background-color:red; }
8 * { background-color:white; }
9 </style>
10 <script src="/tests/SimpleTest/EventUtils.js"></script>
11 <script>
12 function runTest() {
13 var input = document.getElementById('input');
14 input.setSelectionRange(input.value.length, input.value.length)
15 input.focus();
16 synthesizeKey("KEY_Backspace"); // so that it becomes invalid first
17 input.blur();
18 input.focus();
19 synthesizeKey("KEY_Backspace");
20 input.blur(); // to hide the caret
21 document.documentElement.className='';
23 </script>
24 </head>
25 <body onload="runTest()">
26 <input id="input" maxlength="3" value="foooo">
27 </body>
28 </html>