tor-browser

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

wrap-enumerated-ascii-case-insensitive.html (2634B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <link rel="help" href="https://html.spec.whatwg.org/#attr-textarea-wrap">
      4 <link rel="help" href="https://html.spec.whatwg.org/#enumerated-attribute">
      5 <meta name="assert" content="textarea@wrap values are ASCII case-insensitive">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <form target="child" method="GET" action="wrap-enumerated-ascii-case-insensitive-child.html">
      9  <textarea name="a" wrap="hard" cols="7">hello world</textarea>
     10  <textarea name="b" wrap="HaRd" cols="7">hello world</textarea>
     11  <textarea name="c" wrap="soft" cols="7">hello world</textarea>
     12  <textarea name="d" wrap="SoFt" cols="7">hello world</textarea>
     13  <textarea name="e" wrap="ſoft" cols="7">hello world</textarea>
     14 </form>
     15 <iframe name="child"></iframe>
     16 <script>
     17 // #dom-textarea-wrap reflects the content attribute, but it isn’t a nullable
     18 // DOMString, nor is it #limited-to-only-known-values, so we can’t just take
     19 // the shortcut of asserting the IDL attribute like most other attributes
     20 async_test(function() {
     21  // we use a message rather than the iframe’s load event to avoid dealing with
     22  // spurious load events that some browsers dispatch on the initial about:blank
     23  addEventListener("message", this.step_func_done(event => {
     24    const params = new URL(event.data).searchParams;
     25 
     26    // #textarea-wrapping-transformation says that a UA-defined algorithm wraps
     27    // values by inserting CRLF pairs, so "hello \r\nworld" and "hello w\r\norld"
     28    // are two of many valid outcomes for cols=7
     29    assert_true(params.get("a").includes("\r\n"), "lowercase “hard” valid");
     30    assert_true(params.get("b").includes("\r\n"), "mixed case “hard” valid");
     31    assert_false(params.get("c").includes("\r\n"), "lowercase “soft” valid");
     32 
     33    // vacuous: the invalid value default is currently soft, so even if the UA
     34    // treats this as invalid, the observable behaviour would still be correct
     35    assert_false(params.get("d").includes("\r\n"), "mixed case “soft” valid");
     36 
     37    // vacuous: the invalid value default is currently soft, so even if the UA
     38    // treats this as valid, the observable behaviour would still be correct
     39    assert_false(params.get("e").includes("\r\n"), "non-ASCII “soft” invalid");
     40  }));
     41 
     42  // we submit the form in GET mode to observe the values [#concept-fe-value] of
     43  // the textareas, because IDL gives us the API value [#concept-fe-api-value],
     44  // which isn’t subject to hard wrapping [#textarea-wrapping-transformation]
     45  document.querySelector("form").submit();
     46 }, "keywords");
     47 </script>