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

Commit

Permalink
Merge pull request #506 from arv/safari-8
Browse files Browse the repository at this point in the history
Add workaround for broken Safari 8 DOM
  • Loading branch information
arv committed Sep 9, 2014
2 parents 740d3d3 + cfaa850 commit 3c90686
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/wrappers.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ window.ShadowDOMPolyfill = {};
}
}

// Safari 8 exposes WebIDL attributes as an invalid accessor property. Its
// descriptor has {get: undefined, set: undefined}. We therefore ignore the
// shape of the descriptor and make all properties read-write.
// https://bugs.webkit.org/show_bug.cgi?id=49739
var isBrokenSafari = function() {
var descr = Object.getOwnPropertyDescriptor(Node.prototype, 'nodeType');
return !!descr && 'set' in descr;
}();

function installProperty(source, target, allowMethod, opt_blacklist) {
var names = getOwnPropertyNames(source);
for (var i = 0; i < names.length; i++) {
Expand Down Expand Up @@ -204,7 +213,7 @@ window.ShadowDOMPolyfill = {};
else
getter = getGetter(name);

if (descriptor.writable || descriptor.set) {
if (descriptor.writable || descriptor.set || isBrokenSafari) {
if (isEvent)
setter = scope.getEventHandlerSetter(name);
else
Expand Down

0 comments on commit 3c90686

Please sign in to comment.