tor-browser

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

dataset-enumeration.html (953B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>Dataset - Enumeration</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7  </head>
      8  <body>
      9    <h1>Dataset - Enumeration</h1>
     10    <div id="log"></div>
     11    <script>
     12      function testEnumeration(array)
     13      {
     14        var d = document.createElement("div");
     15        for (var i = 0; i < array.length; ++i)
     16          d.setAttribute(array[i], "value");
     17 
     18        var count = 0;
     19        for (var item in d.dataset)
     20          count++;
     21 
     22        return count;
     23      }
     24 
     25      test(function() { assert_equals(testEnumeration(['data-foo', 'data-bar', 'data-baz']), 3); },
     26        "A dataset should be enumeratable.");
     27      test(function() { assert_equals(testEnumeration(['data-foo', 'data-bar', 'dataFoo']), 2); },
     28        "Only attributes who qualify as dataset properties should be enumeratable in the dataset.");
     29    </script>
     30  </body>
     31 </html>