Skip to content

Add details on adoptedStyleSheets, loading, URL, content-type - #35

Merged
rakina merged 5 commits into
gh-pagesfrom
details
Sep 12, 2018
Merged

rakina merged 5 commits into
gh-pagesfrom
details

Conversation

@rakina

@rakina rakina commented Aug 30, 2018 •

Copy link
Copy Markdown
Member

Adding details on how to use constructed stylesheets to adoptedStyleSheets, defining a constructor for StyleSheetList and restricting where it can be used for resolving #23.

Also adding details on what content-type can @imports inside the sheet can handle (only text/css) for resolving #14, the URL of the sheet for resolving #10 , and reason of rejecting failed loads.


Preview | Diff

@rakina
rakina requested a review from tabatkins August 30, 2018 12:15
@rakina

rakina commented Sep 6, 2018

Copy link
Copy Markdown
Member Author

Friendly ping for review @tabatkins

Comment thread index.bs Outdated
6. Let <var>promise</var> be a promise.
7. Wait for loading of <a spec=css-cascade-4>@import</a> rules in <var>sheet</var>.
* If any of them failed to load, reject <var>promise</var>.
* If any of them resulted in a resource with a <a spec=html>Content-Type metadata</a> of anything other than `text/css`, reject <var>promise</var> with a {{TypeError}}.

@ewilligers ewilligers Sep 11, 2018 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

<code>text/css</code>

@ewilligers

Copy link
Copy Markdown
Collaborator

To fully resolve #23, should we prevent a constructed style sheet from being added to two documents?

@rakina

rakina commented Sep 11, 2018

Copy link
Copy Markdown
Member Author

To fully resolve #23, should we prevent a constructed style sheet from being added to two documents?

Under "Using Constructed Stylesheets", there is a line saying a CSSStyleSheetcan only be applied to the Document it is constructed on, or any ShadowRoot in the Document it is constructed on. Should we make it clearer, or maybe should we throw errors if we add to another Document's adoptedStyleSheets?

@ewilligers ewilligers left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks good.

@ewilligers

Copy link
Copy Markdown
Collaborator

Under "Using Constructed Stylesheets", there is a line saying a CSSStyleSheetcan only be applied to the Document it is constructed on, or any ShadowRoot in the Document it is constructed on. Should we make it clearer, or maybe should we throw errors if we add to another Document's adoptedStyleSheets?

Yes, we should make it clear that an exception is thrown if we attempt to assign to adoptedStyleSheets any CSSStyleSheet not made by createCSSStyleSheet(text) or createEmptyCSSStyleSheet() calls, or any CSSStyleSheet made by calls on a different document.

Currently it is not obvious if an exception occurs or if such style sheets are silently ignored.

@rakina

rakina commented Sep 12, 2018 •

Copy link
Copy Markdown
Member Author

Yes, we should make it clear that an exception is thrown if we attempt to assign to adoptedStyleSheets any CSSStyleSheet not made by createCSSStyleSheet(text) or createEmptyCSSStyleSheet() calls, or any CSSStyleSheet made by calls on a different document.

Currently it is not obvious if an exception occurs or if such style sheets are silently ignored.

I see. Added a line detailing TypeError is thrown. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants