fix(zone.js): should remove on symbol property after removeAllListeners (#31644)

Close #31643

PR Close #31644
This commit is contained in:
JiaLiPassion
2019-07-19 14:49:55 +09:00
committed by Miško Hevery
parent 17b32b5fd4
commit a182714703
2 changed files with 33 additions and 5 deletions

View File

@ -540,6 +540,13 @@ export function patchEventTarget(
// remove globalZoneAwareCallback and remove the task cache from target
(existingTask as any).allRemoved = true;
target[symbolEventName] = null;
// in the target, we have an event listener which is added by on_property
// such as target.onclick = function() {}, so we need to clear this internal
// property too if all delegates all removed
if (typeof eventName === 'string') {
const onPropertySymbol = ZONE_SYMBOL_PREFIX + 'ON_PROPERTY' + eventName;
target[onPropertySymbol] = null;
}
}
existingTask.zone.cancelTask(existingTask);
if (returnTarget) {