| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Event.initEvent</title> | 2 <title>Event.initEvent</title> |
| 3 <link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com"> | 3 <link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com"> |
| 4 <script src="/resources/testharness.js"></script> | 4 <script src="/resources/testharness.js"></script> |
| 5 <script src="/resources/testharnessreport.js"></script> | 5 <script src="/resources/testharnessreport.js"></script> |
| 6 <div id="log"></div> | 6 <div id="log"></div> |
| 7 <script> | 7 <script> |
| 8 var booleans = [true, false]; | 8 var booleans = [true, false]; |
| 9 booleans.forEach(function(bubbles) { | 9 booleans.forEach(function(bubbles) { |
| 10 booleans.forEach(function(cancelable) { | 10 booleans.forEach(function(cancelable) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 this.done() | 78 this.done() |
| 79 }, "Calling initEvent must not have an effect during dispatching.") | 79 }, "Calling initEvent must not have an effect during dispatching.") |
| 80 | 80 |
| 81 test(function() { | 81 test(function() { |
| 82 var e = document.createEvent("Event") | 82 var e = document.createEvent("Event") |
| 83 e.stopPropagation() | 83 e.stopPropagation() |
| 84 e.initEvent("type", false, false) | 84 e.initEvent("type", false, false) |
| 85 var target = document.createElement("div") | 85 var target = document.createElement("div") |
| 86 var called = false | 86 var called = false |
| 87 target.addEventListener("type", function() { called = true }, false) | 87 target.addEventListener("type", function() { called = true }, false) |
| 88 assert_false(e.cancelBubble, "cancelBubble must be false") |
| 88 assert_true(target.dispatchEvent(e), "dispatchEvent must return true") | 89 assert_true(target.dispatchEvent(e), "dispatchEvent must return true") |
| 89 assert_true(called, "Listener must be called") | 90 assert_true(called, "Listener must be called") |
| 90 }, "Calling initEvent must unset the stop propagation flag.") | 91 }, "Calling initEvent must unset the stop propagation flag.") |
| 91 | 92 |
| 92 test(function() { | 93 test(function() { |
| 93 var e = document.createEvent("Event") | 94 var e = document.createEvent("Event") |
| 94 e.stopImmediatePropagation() | 95 e.stopImmediatePropagation() |
| 95 e.initEvent("type", false, false) | 96 e.initEvent("type", false, false) |
| 96 var target = document.createElement("div") | 97 var target = document.createElement("div") |
| 97 var called = false | 98 var called = false |
| (...skipping 11 matching lines...) Expand all Loading... |
| 109 e.initEvent("type2", true, true); | 110 e.initEvent("type2", true, true); |
| 110 assert_equals(e.type, "type", "initEvent type setter should short-circuit"); | 111 assert_equals(e.type, "type", "initEvent type setter should short-circuit"); |
| 111 assert_false(e.bubbles, "initEvent bubbles setter should short-circuit"); | 112 assert_false(e.bubbles, "initEvent bubbles setter should short-circuit"); |
| 112 assert_false(e.cancelable, "initEvent cancelable setter should short-circuit
"); | 113 assert_false(e.cancelable, "initEvent cancelable setter should short-circuit
"); |
| 113 }), false) | 114 }), false) |
| 114 assert_equals(target.dispatchEvent(e), true, "dispatchEvent must return true") | 115 assert_equals(target.dispatchEvent(e), true, "dispatchEvent must return true") |
| 115 | 116 |
| 116 this.done() | 117 this.done() |
| 117 }, "Calling initEvent during propagation.") | 118 }, "Calling initEvent during propagation.") |
| 118 </script> | 119 </script> |
| OLD | NEW |