OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>dialog element: close()</title> | 4 <title>dialog element: close()</title> |
5 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> | 5 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> |
6 <link rel=help href="https://html.spec.whatwg.org/multipage/#the-dialog-element"
> | 6 <link rel=help href="https://html.spec.whatwg.org/multipage/#the-dialog-element"
> |
7 <script src="../resources/testharness.js"></script> | 7 <script src="../../resources/testharness.js"></script> |
8 <script src="../resources/testharnessreport.js"></script> | 8 <script src="../../resources/testharnessreport.js"></script> |
9 </head> | 9 </head> |
10 <body> | 10 <body> |
11 <dialog id="d1" open> | 11 <dialog id="d1" open> |
12 <p>foobar</p> | 12 <p>foobar</p> |
13 <button>OK</button> | 13 <button>OK</button> |
14 </dialog> | 14 </dialog> |
15 <script> | 15 <script> |
16 var d1 = document.getElementById('d1'), | 16 var d1 = document.getElementById('d1'), |
17 t = async_test("close() fires a close event"), | 17 t = async_test("close() fires a close event"), |
18 was_queued = false; | 18 was_queued = false; |
19 | 19 |
20 d1.onclose = t.step_func_done(function(e) { | 20 d1.onclose = t.step_func_done(function(e) { |
21 assert_true(was_queued, "close event should be queued"); | 21 assert_true(was_queued, "close event should be queued"); |
22 assert_true(e.isTrusted, "close event is trusted"); | 22 assert_true(e.isTrusted, "close event is trusted"); |
23 assert_false(e.bubbles, "close event doesn't bubble"); | 23 assert_false(e.bubbles, "close event doesn't bubble"); |
24 assert_false(e.cancelable, "close event is not cancelable"); | 24 assert_false(e.cancelable, "close event is not cancelable"); |
25 }); | 25 }); |
26 | 26 |
27 t.step(function() { | 27 t.step(function() { |
28 d1.close(); | 28 d1.close(); |
29 was_queued = true; | 29 was_queued = true; |
30 }) | 30 }) |
31 </script> | 31 </script> |
32 </body> | 32 </body> |
33 </html> | 33 </html> |
OLD | NEW |