Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 3a8deef

Browse files
committed
fix(property-descriptor): do not fail for events without targets
See #323
1 parent ebd4526 commit 3a8deef

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/browser/property-descriptor.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ function patchViaCapturingAllTheEvents() {
6666
const property = eventNames[i];
6767
const onproperty = 'on' + property;
6868
document.addEventListener(property, function (event) {
69-
let elt = <Node>event.target, bound;
70-
const source = elt.constructor['name'] + '.' + onproperty;
69+
let elt = <Node>event.target, bound, source;
70+
if (elt) {
71+
source = elt.constructor['name'] + '.' + onproperty;
72+
} else {
73+
source = 'unknown.' + onproperty;
74+
}
7175
while (elt) {
7276
if (elt[onproperty] && !elt[onproperty][unboundKey]) {
7377
bound = Zone.current.wrap(elt[onproperty], source);

0 commit comments

Comments
 (0)