summaryrefslogtreecommitdiffstats
path: root/dom/events/test/test_marquee_events.html
blob: 22d0eafdf12497d067af705c98bd8c896e36dfeb (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
27
28
29
30
31
<html>
<head>
  <meta charset="utf-8">
  <title>Test for bug 1425874</title>
  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
  <script>
    var wasEventCalled;
    function callEventWithAttributeHandler(element, evt) {
      wasEventCalled = false;
      let el = document.createElement(element);
      el.setAttribute(`on${evt}`, "wasEventCalled = true");
      el.dispatchEvent(new Event(evt));
      return wasEventCalled;
    }

    info("Make sure the EventNameType_HTMLMarqueeOnly events only compile for marquee");

    ok(!callEventWithAttributeHandler("div", "bounce"), "no onbounce for div");
    ok(!callEventWithAttributeHandler("div", "finish"), "no onfinish for div");
    ok(!callEventWithAttributeHandler("div", "start"), "no onstart for div");

    ok(callEventWithAttributeHandler("marquee", "bounce"), "onbounce for marquee");
    ok(callEventWithAttributeHandler("marquee", "finish"), "onfinish for marquee");
    ok(callEventWithAttributeHandler("marquee", "start"), "onstart for marquee");
  </script>
</body>
</html>