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

Commit

Permalink
fix(property-descriptor): do not use document object in Safari web wo…
Browse files Browse the repository at this point in the history
…rker

In propertyDescriptorPatch(), when running is Safari browser, patchViaCapturingAllTheEvents() is called
which uses document.addEventListener().
When this code runs in a web worker, there is no document.
Fix by changing document.addEventListener() to self.addEventListener.
  • Loading branch information
urimor authored and nadavsinai committed Sep 29, 2016
1 parent 737f8d8 commit 51f2e1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/browser/property-descriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function patchViaCapturingAllTheEvents() {
for(let i = 0; i < eventNames.length; i++) {
const property = eventNames[i];
const onproperty = 'on' + property;
document.addEventListener(property, function (event) {
self.addEventListener(property, function (event) {
let elt = <Node>event.target, bound, source;
if (elt) {
source = elt.constructor['name'] + '.' + onproperty;
Expand Down

0 comments on commit 51f2e1f

Please sign in to comment.