tor-browser

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

invalid-after-clone.html (1168B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
      4 <link rel="author" title="Mozilla" href="https://mozilla.org">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/resources/testdriver.js"></script>
      8 <script src="/resources/testdriver-vendor.js"></script>
      9 <input>
     10 <textarea></textarea>
     11 <script>
     12 promise_test(async () => {
     13  for (let tag of ["input", "textarea"]) {
     14    let element = document.querySelector(tag);
     15    await test_driver.send_keys(element, 'something');
     16 
     17    assert_true(element.validity.valid, tag + ' should be valid');
     18 
     19    element.maxLength = 0;
     20    assert_true(element.matches(":invalid"), tag + ' should match :invalid');
     21    assert_false(element.validity.valid, tag + ' should be invalid');
     22 
     23    let clone = element.cloneNode(true);
     24    assert_true(clone.matches(":invalid"), tag + ' clone should match :invalid');
     25    assert_false(clone.validity.valid, tag + 'clone should be invalid');
     26  }
     27 }, 'Cloned invalid inputs / textareas with interactive changes get their validity state copied correctly');
     28 </script>