| <html> |
| <head> |
| <script> |
| function print(message) |
| { |
| var item = document.createElement("li"); |
| item.appendChild(document.createTextNode(message)); |
| document.getElementById("console").appendChild(item); |
| } |
| var count = 0; |
| function eventHandler(event) |
| { |
| ++count; |
| print("event handler called: " + count); |
| } |
| function test() |
| { |
| if (window.layoutTestController) |
| layoutTestController.dumpAsText(); |
| var event = document.createEvent("Events"); |
| event.initEvent("foo", true, false); |
| addEventListener("foo", eventHandler, false); |
| document.dispatchEvent(event); |
| removeEventListener("foo", eventHandler, false); |
| document.dispatchEvent(event); |
| } |
| </script> |
| <head> |
| <body onload="test()"> |
| <p>Regression test to ensure that removeEventListener works.</p> |
| <p>If the test is successful, you'll see only one call of the event handler. If it fails, you'll typically see two.</p> |
| <ol id="console"></ol> |
| </body> |
| </html> |