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

Conversation

adevnadia
Copy link
Contributor

The problem is connected to the #41
Since jQuery uses assignment for removeEventListener in tests

@@ -749,6 +749,8 @@ 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
!(memberProperty.hasOwnProperty('get') || memberProperty.hasOwnProperty('set')) && (memberProperty.writable = true);
Copy link
Member

@treshugart treshugart May 3, 2016

Choose a reason for hiding this comment

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

It might be a more robust check to do something like:

if (memberProperty.hasOwnProperty('value')) {
  memberProperty.writable = true
}

Or something. I think the only one's we care about making writable are the ones we specify a hard value for. The ones we don't want to be writable we're specifying using the staticProp() function that uses Object.defineProperty().

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree :)

@joscha
Copy link
Contributor

joscha commented May 3, 2016

Is there a test we should write for this?

@adevnadia
Copy link
Contributor Author

Don't know, maybe.

@treshugart
Copy link
Member

Yeah, could write a test to see if we can override methods.

@treshugart
Copy link
Member

lgtm

@@ -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 :)

@joscha
Copy link
Contributor

joscha commented May 3, 2016

LGTM

@adevnadia adevnadia merged commit 27bd2fc into master May 3, 2016
@adevnadia adevnadia deleted the fix-60-writable-for-polyfills branch May 3, 2016 05:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants