Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyfill for shadowRoot.styleSheets in Safari #11267

Merged
merged 2 commits into from Sep 11, 2017

Conversation

cvializ
Copy link
Contributor

@cvializ cvializ commented Sep 11, 2017

Fixes #11266

It creates a new list each access, but it will always be up to date if any stylesheets are added. Open to suggestions.

if (!shadowRoot.styleSheets) {
Object.defineProperty(shadowRoot, 'styleSheets', {
get: function() {
return new StyleSheetListImpl(shadowRoot);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately, everywhere we use this property is via array access. E.g. x.styleSheets[0]. I'm thinking maybe let's use array instead? Or any other idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I missed that, I was just reading the spec which only offers an items property.

@dvoytenko dvoytenko merged commit 4577fbf into ampproject:master Sep 11, 2017
erwinmombay pushed a commit that referenced this pull request Sep 11, 2017
* Polyfill for shadowRoot.styleSheets in Safari

* Use array instead of adding an index operator
zhouyx pushed a commit that referenced this pull request Sep 13, 2017
* Polyfill for shadowRoot.styleSheets in Safari

* Use array instead of adding an index operator
zhouyx pushed a commit that referenced this pull request Sep 13, 2017
* Polyfill for shadowRoot.styleSheets in Safari

* Use array instead of adding an index operator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants