Description
This issue was originally filed by @bp74
What steps will reproduce the problem?
- Here is a sample which shows the problem:
class Test1 {
Test1() {
document.body.on.click.add(_onBodyClick);
}
_onBodyClick(event) {
print("Test1: onBodyClick");
document.body.on.click.remove(_onBodyClick);
}
}
class Test2 {
EventListener _eventListener;
Test2() {
_eventListener = _onBodyClick;
document.body.on.click.add(_eventListener);
}
_onBodyClick(event) {
print("Test2: onBodyClick");
document.body.on.click.remove(_eventListener);
}
}
void main() {
Test1 test1 = new Test1();
Test2 test2 = new Test2();
}
What is the expected output? What do you see instead?
Both classes add an EventListener to the click event of the body, but only the "Test2" class can remove the EventListener again. The funny thing is that it is the same in the Dart-VM and in all browsers when compilied to JavaSscript. It almost looks like "works as desingend" but if this is by purpose i think it should be changed.
What version of the product are you using? On what operating system?
Dart Build 7696 32 bit, Windows 7 64 bit