<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<body>
<script>
description('EventTarget.addEventListener and EventTarget.removeEventLister should throw on invalid arguments.');
function listener(event)
{
}
debug('Signature:')
debug('void addEventListener(DOMString type, EventListener? listener, optional boolean useCapture)');
shouldThrow('document.addEventListener()');
shouldThrow('document.addEventListener("foo")');
shouldNotThrow('document.addEventListener("foo", listener)');
shouldNotThrow('document.addEventListener("", listener)');
shouldNotThrow('document.addEventListener("", function(){})');
shouldNotThrow('document.addEventListener("bar", listener, false)');
shouldNotThrow('document.addEventListener("bar", listener, true)');
// null
shouldNotThrow('document.addEventListener(null, listener)');
shouldNotThrow('document.addEventListener("foo", null)');
shouldNotThrow('document.addEventListener("zork", listener, null)');
// undefined
shouldNotThrow('document.addEventListener(undefined, listener)');
shouldNotThrow('document.addEventListener("foo", undefined)');
shouldNotThrow('document.addEventListener("zork", listener, undefined)');
debug('');
debug('Signature:');
debug('void removeEventListener(DOMString type, EventListener? listener, optional boolean useCapture)');
shouldThrow('document.removeEventListener()');
shouldThrow('document.removeEventListener("foo")');
shouldNotThrow('document.removeEventListener("foo", listener)');
shouldNotThrow('document.removeEventListener("foo", listener, true)');
shouldNotThrow('document.removeEventListener("bar", listener, false)');
shouldNotThrow('document.removeEventListener("bar", listener, false)');
shouldNotThrow('document.removeEventListener("bar", listener, true)');
// null
shouldNotThrow('document.removeEventListener(null, listener)');
shouldNotThrow('document.removeEventListener("foo", null)');
shouldNotThrow('document.removeEventListener("zork", listener, null)');
// undefined
shouldNotThrow('document.removeEventListener(undefined, listener)');
shouldNotThrow('document.removeEventListener("foo", undefined)');
shouldNotThrow('document.removeEventListener("zork", listener, undefined)');
</script>