| Nicolás Peña Moreno | bc01db7 | 2020-04-18 00:14:01 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <meta charset=utf-8 /> |
| 4 | <script src=/resources/testharness.js></script> |
| 5 | <script src=/resources/testharnessreport.js></script> |
| 6 | <script src=/resources/testdriver.js></script> |
| 7 | <script src=/resources/testdriver-vendor.js></script> |
| 8 | |
| 9 | <script src=resources/event-timing-test-utils.js></script> |
| 10 | |
| 11 | <button id='the_button'>ClickMe</button> |
| 12 | |
| 13 | <script> |
| 14 | async_test(function(t) { |
| 15 | assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.'); |
| 16 | const observer = new PerformanceObserver(t.step_func_done((entryList) => { |
| Hongbo Song | 13817e2 | 2021-12-14 22:42:11 | [diff] [blame] | 17 | const entries = entryList.getEntries().filter(e => e.name === 'pointerdown'); |
| Nicolás Peña Moreno | e3c77c7 | 2020-05-17 20:45:18 | [diff] [blame] | 18 | if (entries.length === 0) |
| 19 | return; |
| Nicolás Peña Moreno | bc01db7 | 2020-04-18 00:14:01 | [diff] [blame] | 20 | // There must only be one click entry. |
| 21 | assert_equals(entries.length, 1); |
| 22 | const entry = entries[0]; |
| 23 | // This checks that entry.target returns the correct button Node. |
| 24 | verifyClickEvent(entry, 'the_button', true); |
| 25 | const button = document.getElementById('the_button'); |
| 26 | button.parentNode.removeChild(button); |
| 27 | // After removing the button, entry.target should now return null. |
| 28 | assert_equals(entry.target, null); |
| 29 | })); |
| 30 | observer.observe({entryTypes: ['event']}); |
| 31 | clickAndBlockMain('the_button'); |
| 32 | }, "Event Timing: when target is disconnected, entry.target returns null."); |
| 33 | </script> |
| 34 | </html> |