tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

maxlength-manual.html (1183B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <meta charset=utf-8>
      5    <title>input max length</title>
      6    <link rel="author" title="Sam Gibson" href="mailto:sam@ifdown.net">
      7    <link rel=help href="https://html.spec.whatwg.org/multipage/forms.html#the-maxlength-and-minlength-attributes">
      8    <script src="/resources/testharness.js"></script>
      9    <script src="/resources/testharnessreport.js"></script>
     10  </head>
     11 
     12  <body>
     13    <div id="log"></div>
     14    <p>Type a letter anywhere into the input field (do not select any text, or otherwise manipulate the input)</p>
     15    <input type=text maxlength=4 id=only-four value="inpu"></input>
     16 
     17    <script>
     18      var input;
     19      setup(function() {
     20        input = document.getElementById('only-four');
     21      }, {explicit_done: true, explicit_timeout: true});
     22 
     23 
     24      on_event(input, 'keyup', function(event) {
     25          if  ((event.keyCode >= 65 && event.keyCode <= 90) ||
     26                (event.keyCode >= 97 && event.keyCode <= 122)) {
     27            test(function() {
     28              assert_equals(input.value, "inpu");
     29            }, 'input content should limit to maxlength')
     30 
     31            done();
     32          }
     33      });
     34    </script>
     35  </body>
     36 </html>