From 51f2e1f2e0a1c395fd4a00240e2d31bafd3ef7fa Mon Sep 17 00:00:00 2001 From: Uri Mor Date: Wed, 24 Aug 2016 19:14:48 +0300 Subject: [PATCH] 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. --- lib/browser/property-descriptor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browser/property-descriptor.ts b/lib/browser/property-descriptor.ts index 802ac5680..b4465aa39 100644 --- a/lib/browser/property-descriptor.ts +++ b/lib/browser/property-descriptor.ts @@ -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 = event.target, bound, source; if (elt) { source = elt.constructor['name'] + '.' + onproperty;