|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <meta charset=utf-8>
|
3 | 3 | <title>Document.createEvent</title>
|
4 |
| -<link rel=help href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createevent"> |
| 4 | +<link rel=help href="http://dom.spec.whatwg.org/#dom-document-createevent"> |
5 | 5 | <script src="/resources/testharness.js"></script>
|
6 | 6 | <script src="/resources/testharnessreport.js"></script>
|
7 | 7 | <div id="log"></div>
|
8 | 8 | <script>
|
9 |
| -// TODO: values of attributes |
10 | 9 | function testAlias(arg, iface) {
|
| 10 | + var ev; |
11 | 11 | test(function() {
|
12 |
| - if (iface === "Event" || iface in window) { |
13 |
| - var ev = document.createEvent(arg); |
14 |
| - assert_true(ev instanceof window[iface]); |
15 |
| - assert_true(ev instanceof Event); |
16 |
| - } |
| 12 | + ev = document.createEvent(arg); |
| 13 | + assert_true(ev instanceof window[iface]); |
| 14 | + assert_true(ev instanceof Event); |
17 | 15 | }, arg + " should be an alias for " + iface + ".");
|
| 16 | + test(function() { |
| 17 | + assert_equals(ev.type, "", |
| 18 | + "type should be initialized to the empty string"); |
| 19 | + assert_equals(ev.target, null, |
| 20 | + "target should be initialized to null"); |
| 21 | + assert_equals(ev.currentTarget, null, |
| 22 | + "currentTarget should be initialized to null"); |
| 23 | + assert_equals(ev.eventPhase, 0, |
| 24 | + "eventPhase should be initialized to NONE (0)"); |
| 25 | + assert_equals(ev.bubbles, false, |
| 26 | + "bubbles should be initialized to false"); |
| 27 | + assert_equals(ev.cancelable, false, |
| 28 | + "cancelable should be initialized to false"); |
| 29 | + assert_equals(ev.defaultPrevented, false, |
| 30 | + "defaultPrevented should be initialized to false"); |
| 31 | + assert_equals(ev.isTrusted, false, |
| 32 | + "isTrusted should be initialized to false"); |
| 33 | + }, "createEvent('" + arg + "') should be initialized correctly."); |
18 | 34 | }
|
19 | 35 | [
|
| 36 | + ["CustomEvent", "CustomEvent"], |
20 | 37 | ["Event", "Event"],
|
21 | 38 | ["Events", "Event"],
|
22 | 39 | ["HTMLEvents", "Event"],
|
|
38 | 55 | // 'LATIN CAPITAL LETTER I WITH DOT ABOVE' (U+0130)
|
39 | 56 | var evt = document.createEvent("U\u0130Event");
|
40 | 57 | });
|
| 58 | + assert_throws("NOT_SUPPORTED_ERR", function() { |
| 59 | + // 'LATIN SMALL LETTER DOTLESS I' (U+0131) |
| 60 | + var evt = document.createEvent("U\u0131Event"); |
| 61 | + }); |
41 | 62 | }, "Should throw NOT_SUPPORTED_ERR for unrecognized arguments");
|
42 | 63 | </script>
|
0 commit comments