dialog-close-event-async.html (959B)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 2 <html> 3 <head> 4 <title>dialog element: close()</title> 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"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 </head> 10 <body> 11 <dialog id="d1" open> 12 <p>foobar</p> 13 <button>OK</button> 14 </dialog> 15 <script> 16 var d1 = document.getElementById('d1'), 17 t = async_test("close() fires a close event"), 18 was_queued = false; 19 20 d1.onclose = t.step_func_done(function(e) { 21 assert_true(was_queued, "close event should be queued"); 22 assert_true(e.isTrusted, "close event is trusted"); 23 assert_false(e.bubbles, "close event doesn't bubble"); 24 assert_false(e.cancelable, "close event is not cancelable"); 25 }); 26 27 t.step(function() { 28 d1.close(); 29 was_queued = true; 30 }) 31 </script> 32 </body> 33 </html>