summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/dom/elements/global-attributes/dataset-prototype.html
blob: 6b1661846126bc200d54075f8a36c4460cd9ee01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html>
  <head>
    <title>Dataset - element.dataset is an instance of DOMStringMap</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
    <h1>Dataset - element.dataset is an instance of DOMStringMap</h1>
    <div id="log"></div>
    <script>
      test(function() { assert_true(document.createElement("div").dataset instanceof window.DOMStringMap); },
        "An elements dataset property is an instance of a DOMStringMap");
      test(function() {
        var dataset = document.createElement("div").dataset;
        assert_true("toString" in dataset, '"toString" in dataset');
        assert_equals(dataset.toString, Object.prototype.toString);
        assert_false("expando" in dataset, '"expando" in dataset');
        assert_equals(dataset.expando, undefined);
        Object.prototype.expando = 42;
        assert_true("expando" in dataset, '"expando" in dataset');
        assert_equals(dataset.expando, 42);
      }, "Properties on Object.prototype should shine through.");
    </script>
  </body>
</html>