tor-browser

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

test_link_attributes_reflection.html (2332B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for HTMLLinkElement attributes reflection</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <script type="application/javascript" src="reflect.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      8 </head>
      9 <body>
     10 <p id="display"></p>
     11 <div id="content" style="display: none">
     12 </div>
     13 <pre id="test">
     14 <script type="application/javascript">
     15 
     16 /** Test for HTMLLinkElement attributes reflection */
     17 
     18 // .href (URL)
     19 reflectURL({
     20  element: document.createElement("link"),
     21  attribute: "href",
     22 });
     23 
     24 // .crossOrigin (String or null)
     25 reflectLimitedEnumerated({
     26  element: document.createElement("link"),
     27  attribute: "crossOrigin",
     28  // "" is a valid value per spec, but gets mapped to the "anonymous" state,
     29  // just like invalid values, so just list it under invalidValues
     30  validValues: [ "anonymous", "use-credentials" ],
     31  invalidValues: [
     32    "", "  aNOnYmous   ", "  UsE-CreDEntIALS  ", "foobar", "FOOBAR", " fOoBaR  "
     33  ],
     34  defaultValue: { invalid: "anonymous", missing: null },
     35  nullable: true,
     36 })
     37 
     38 // .rel (String)
     39 reflectString({
     40  element: document.createElement("link"),
     41  attribute: "rel",
     42 });
     43 
     44 // .media (String)
     45 reflectString({
     46  element: document.createElement("link"),
     47  attribute: "media",
     48 });
     49 
     50 // .hreflang (String)
     51 reflectString({
     52  element: document.createElement("link"),
     53  attribute: "hreflang",
     54 });
     55 
     56 // .type (String)
     57 reflectString({
     58  element: document.createElement("link"),
     59  attribute: "type",
     60 });
     61 
     62 
     63 // .charset (String)
     64 reflectString({
     65  element: document.createElement("link"),
     66  attribute: "charset",
     67 });
     68 
     69 // .rev (String)
     70 reflectString({
     71  element: document.createElement("link"),
     72  attribute: "rev",
     73 });
     74 
     75 // .target (String)
     76 reflectString({
     77  element: document.createElement("link"),
     78  attribute: "target",
     79 });
     80 
     81 // .as (String)
     82 reflectLimitedEnumerated({
     83  element: document.createElement("link"),
     84  attribute: "as",
     85  validValues: [ "fetch", "audio", "font", "image", "script", "style",  "track", "video" ],
     86  invalidValues: [
     87    "", "audi", "doc", "Emb", "foobar", "FOOBAR", " fOoBaR  ", "OBJ", "document", "embed", "manifest", "object", "report", "serviceworker", "sharedworker", "worker", "xslt"
     88  ],
     89  defaultValue: { invalid: "", missing: "" },
     90  nullable: false,
     91 })
     92 
     93 </script>
     94 </pre>
     95 </body>
     96 </html>