blob: befd91646dafab4ba7891ea0bf63337491bf3107 [file] [log] [blame]
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// @assertion void removeEventListener(String type, EventListener listener,
/// [bool useCapture])
/// Removes an event listener from the EventTarget.
/// @description Checks that that correct listener is removed
import "dart:html";
import "../../../Utils/expect.dart";
main() {
var type = 'click';
var x = new ButtonElement();
EventListener handler1 = (e) {
Expect.equals(type, e.type);
var seen = false;
EventListener? handler2;
handler2 = (e) {
if (seen)'should be run once');
Expect.equals(type, e.type);
x.removeEventListener(type, handler2); // remove itself when triggered
seen = true;
x.addEventListener(type, handler1);
x.addEventListener(type, handler2);
asyncMultiStart(3); // first time two handlers, second time one handler
var event = new Event(type);
event = new Event(type);