Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 3c90686

Browse files
committed
Merge pull request #506 from arv/safari-8
Add workaround for broken Safari 8 DOM
2 parents 740d3d3 + cfaa850 commit 3c90686

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/wrappers.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ window.ShadowDOMPolyfill = {};
174174
}
175175
}
176176

177+
// Safari 8 exposes WebIDL attributes as an invalid accessor property. Its
178+
// descriptor has {get: undefined, set: undefined}. We therefore ignore the
179+
// shape of the descriptor and make all properties read-write.
180+
// https://bugs.webkit.org/show_bug.cgi?id=49739
181+
var isBrokenSafari = function() {
182+
var descr = Object.getOwnPropertyDescriptor(Node.prototype, 'nodeType');
183+
return !!descr && 'set' in descr;
184+
}();
185+
177186
function installProperty(source, target, allowMethod, opt_blacklist) {
178187
var names = getOwnPropertyNames(source);
179188
for (var i = 0; i < names.length; i++) {
@@ -204,7 +213,7 @@ window.ShadowDOMPolyfill = {};
204213
else
205214
getter = getGetter(name);
206215

207-
if (descriptor.writable || descriptor.set) {
216+
if (descriptor.writable || descriptor.set || isBrokenSafari) {
208217
if (isEvent)
209218
setter = scope.getEventHandlerSetter(name);
210219
else

0 commit comments

Comments
 (0)