tor-browser

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

custom-attrs.html (1383B)


      1 <!DOCTYPE html>
      2 <html>
      3    <head>
      4        <title>Element Custom Attributes</title>
      5        <link rel="author" title="Bruno de Oliveira Abinader" href="mailto:bruno.d@partner.samsung.com">
      6        <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-dataset">
      7        <link rel="help" href="https://html.spec.whatwg.org/multipage/#xml">
      8        <script src="/resources/testharness.js"></script>
      9        <script src="/resources/testharnessreport.js"></script>
     10        <script src="/dom/nodes/attributes.js"></script>
     11    </head>
     12    <body>
     13        <h1>Element Custom Attributes</h1>
     14        <div id="log"></div>
     15        <script>
     16            test(function() {
     17                var div = document.createElement("div");
     18                div.setAttributeNS("foo", "data-my-custom-attr", "first");
     19                div.setAttributeNS("bar", "data-my-custom-attr", "second");
     20                div.dataset.myCustomAttr = "third";
     21 
     22                assert_equals(div.attributes.length, 3);
     23                attributes_are(div, [["data-my-custom-attr", "first", "foo"],
     24                                     ["data-my-custom-attr", "second", "bar"],
     25                                     ["data-my-custom-attr", "third", null]]);
     26            }, "Setting an Element's dataset property should not interfere with namespaced attributes with same name");
     27        </script>
     28    </body>
     29 </html>