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

Commit 51f2e1f

Browse files
urimornadavsinai
authored andcommitted
fix(property-descriptor): do not use document object in Safari web worker
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.
1 parent 737f8d8 commit 51f2e1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: lib/browser/property-descriptor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function patchViaCapturingAllTheEvents() {
6565
for(let i = 0; i < eventNames.length; i++) {
6666
const property = eventNames[i];
6767
const onproperty = 'on' + property;
68-
document.addEventListener(property, function (event) {
68+
self.addEventListener(property, function (event) {
6969
let elt = <Node>event.target, bound, source;
7070
if (elt) {
7171
source = elt.constructor['name'] + '.' + onproperty;

0 commit comments

Comments
 (0)