| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| description("Tests support for 'once' member in AddEventListenerOptions."); |
| |
| var listenerCallCount = 0; |
| function listenerFunction() |
| { |
| ++listenerCallCount; |
| |
| if (listenerCallCount == 1) |
| document.body.dispatchEvent(new Event('test')); |
| } |
| |
| evalAndLog("document.body.addEventListener('test', listenerFunction, { 'once': true })"); |
| shouldBe("listenerCallCount", "0"); |
| evalAndLog("document.body.dispatchEvent(new Event('test'))"); |
| shouldBe("listenerCallCount", "1"); |
| evalAndLog("document.body.dispatchEvent(new Event('test'))"); |
| shouldBe("listenerCallCount", "1"); |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |