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

Ignore title attributes on <link rel=stylesheet> in shadow trees #535

Closed
hayatoito opened this issue Aug 1, 2016 · 6 comments
Closed

Ignore title attributes on <link rel=stylesheet> in shadow trees #535

hayatoito opened this issue Aug 1, 2016 · 6 comments
Assignees

Comments

@hayatoito
Copy link
Contributor

In #530, we have not discussed anything about how title= attribute should be treated in <link rel="stylesheet">. Yeah, that's our mistake. :)

I would like to have a consensus on the behavior here before proceeding this code review further.

My proposal is that we ignore title= attribute completely, as we did that for <style> elements in #391.

Note that the difference between <style> and <link> here is that <link> can specify alternative stylesheet by rel=alternate. See https://developer.mozilla.org/en-US/docs/Web/CSS/Alternative_style_sheets for general information about alternative style sheets.

The proposal is effectively making:

1)  <link rel="stylesheet" title="x">
2)  <link rel="alternate stylesheet" title="x">

behave as:

1)  <link rel="stylesheet"> // always enabled
2)  <link rel="alternate stylesheet"> // never enabled

See https://codereview.chromium.org/2177163002#msg52 for the rationale. I agree with @rune-opera 's rational there.

@hayatoito hayatoito changed the title Ignore title attributes on <link ref=stylesheet> in shadow trees Ignore title attributes on <link rel=stylesheet> in shadow trees Aug 1, 2016
@domenic
Copy link
Collaborator

domenic commented Aug 2, 2016

I spent some time learning about this and agree with @hayatoito and @rune-opera that we should ignore title attributes for stylesheet links inside a shadow tree. The reasoning is basically the same as was decided (before my time, in #391) for style elements. The title attribute has a global affect on the document, both in terms of adding to the list of named stylesheets and in terms of changing some defaults and preventing some other stylesheets from applying. It would be better to avoid this global affect from components that are supposed to be encapsulated.

I put together https://ns-jmzlbrrfkc.now.sh/ as a demo page for anyone else who would like help understanding how the title attribute works in combination with alternate. In Firefox you can switch between style sheets using the menu, View, Page Style.

I hope we can get consensus on this quickly (@smaug----, @travisleithead, @rniwa). It might be a bit tricky to spec rigorously until we first straighten out whatwg/html#848, but if everyone is agreed we can record consensus here or maybe just with a non-rigorous line in the shadow DOM spec.

@rniwa
Copy link
Collaborator

rniwa commented Aug 2, 2016

Yeah, ignoring title attribute here seems sensible to me.

@smaug----
Copy link

yes, ignoring sounds good.

@zcorpan
Copy link
Contributor

zcorpan commented Aug 12, 2016

I suppose when HTML says to "Create a CSS style sheet" (for both link and style) we just don't pass anything in for the "title" if it's in a shadow tree, right?

@annevk
Copy link
Collaborator

annevk commented Aug 12, 2016

Yeah, that is probably the easiest. And we should test that StyleSheet.prototype.title returns null.

@hayatoito
Copy link
Contributor Author

hayatoito commented Aug 15, 2016

Sounds good to me because StyleSheet.prototype.title is a read only attribute.

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

No branches or pull requests

6 participants