tor-browser

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

values.window.js (2017B)


      1 // https://html.spec.whatwg.org/#case-sensitivity-of-selectors
      2 [
      3  "accept",
      4  "accept-charset",
      5  "align",
      6  "alink",
      7  "axis",
      8  "bgcolor",
      9  "charset",
     10  "checked",
     11  "clear",
     12  "codetype",
     13  "color",
     14  "compact",
     15  "declare",
     16  "defer",
     17  "dir",
     18  "direction",
     19  "disabled",
     20  "enctype",
     21  "face",
     22  "frame",
     23  "hreflang",
     24  "http-equiv",
     25  "lang",
     26  "language",
     27  "link",
     28  "media",
     29  "method",
     30  "multiple",
     31  "nohref",
     32  "noresize",
     33  "noshade",
     34  "nowrap",
     35  "readonly",
     36  "rel",
     37  "rev",
     38  "rules",
     39  "scope",
     40  "scrolling",
     41  "selected",
     42  "shape",
     43  "target",
     44  "text",
     45  "type",
     46  "valign",
     47  "valuetype",
     48  "vlink",
     49 ].forEach(attributeName => {
     50  const xmlDocument = new Document();
     51  const htmlDocument = document;
     52  [
     53    {
     54      input: xmlDocument.createElementNS("http://www.w3.org/1999/xhtml", "a"),
     55      expected: false,
     56      title: "<html:a> in XML",
     57    },
     58    {
     59      input: xmlDocument.createElementNS("http://www.w3.org/1999/xhtml", "unknown"),
     60      expected: false,
     61      title: "<html:unknown> in XML",
     62    },
     63    {
     64      input: xmlDocument.createElementNS("", "unknown"),
     65      expected: false,
     66      title: "<:unknown> in XML"
     67    },
     68    {
     69      input: htmlDocument.createElementNS("http://www.w3.org/1999/xhtml", "a"),
     70      expected: true,
     71      title: "<html:a> in HTML",
     72    },
     73    {
     74      input: htmlDocument.createElementNS("http://www.w3.org/1999/xhtml", "unknown"),
     75      expected: true,
     76      title: "<html:unknown> in HTML",
     77    },
     78    {
     79      input: htmlDocument.createElementNS("", "unknown"),
     80      expected: false,
     81      title: "<:unknown> in HTML"
     82    },
     83  ].forEach(({ input, expected, title }) => {
     84    test(t => {
     85      t.add_cleanup(() => input.removeAttribute(attributeName));
     86      input.setAttribute(attributeName, "HEYƏ");
     87      assert_equals(input.matches(`[${attributeName}^=hey]`), expected, `^=hey`);
     88      assert_false(input.matches(`[${attributeName}^=heyi]`));
     89    }, `${attributeName}'s value is properly ASCII-case-insensitive for ${title}`);
     90  });
     91 });