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

fix #60 - writable for polyfilled properties #61

Merged
merged 2 commits into from
May 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,10 @@ if (!('attachShadow' in document.createElement('div'))) {

// All properties should be configurable.
memberProperty.configurable = true;
// Applying to the data properties only since we can't have writable accessor properties
if (memberProperty.hasOwnProperty('value')) {
memberProperty.writable = true
}

// Polyfill as much as we can and work around WebKit in other areas.
if (canPatchNativeAccessors || polyfillAtRuntime.indexOf(memberName) === -1) {
Expand Down
7 changes: 7 additions & 0 deletions test/unit/shadow/polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ describe('shadow/polyfill', function () {
});
}

it('polyfilled properties with value should be writable', function() {
let elem = create('div');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be const, but nitpick :)


expect(elem.removeEventListener).not.to.equal("");
elem.removeEventListener = "";
expect(elem.removeEventListener).to.equal("");
});

describe('api', function () {
let host, root;
Expand Down