blob: 4c2fb4e9a9f3b0e50e452cc77ed7af5c2132258c [file] [log] [blame]
<!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>