Skip to content

Commit

Permalink
fix(property-descriptor): do not fail for events without targets
Browse files Browse the repository at this point in the history
  • Loading branch information
juliemr committed Apr 19, 2016
1 parent ebd4526 commit 3a8deef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/browser/property-descriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ function patchViaCapturingAllTheEvents() {
const property = eventNames[i];
const onproperty = 'on' + property;
document.addEventListener(property, function (event) {
let elt = <Node>event.target, bound;
const source = elt.constructor['name'] + '.' + onproperty;
let elt = <Node>event.target, bound, source;
if (elt) {
source = elt.constructor['name'] + '.' + onproperty;
} else {
source = 'unknown.' + onproperty;
}
while (elt) {
if (elt[onproperty] && !elt[onproperty][unboundKey]) {
bound = Zone.current.wrap(elt[onproperty], source);
Expand Down

0 comments on commit 3a8deef

Please sign in to comment.