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

Fix regression with imported css #4991

Merged
merged 2 commits into from
Dec 13, 2017
Merged

Conversation

dfreedm
Copy link
Member

@dfreedm dfreedm commented Dec 12, 2017

Fix case where <link rel="import" type="css"> is the only styling for
an element

Fixes #4986

Fix case where `<link rel="import" type="css">` is the only styling for
an element

Fixes #4986
Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

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

Seems like an easy fix, just one question regarding implementation (but given the test passes it is correct).

let templateStyle = templateStyles[templateStyleIndex];
// if no styles in the template, fall back to first element child of template
let templateStyle = templateStyles.length ?
templateStyles[templateStyleIndex] : template.content.firstElementChild;
Copy link
Contributor

Choose a reason for hiding this comment

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

Lacking the knowledge, but I assume the firstElementChild represents the style tag represents the .css file?

Copy link
Contributor

Choose a reason for hiding this comment

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

This just says put any non-local styles either before the closest local template style or at the top of the template

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the <link> element won't make it into the template.

Copy link
Contributor

Choose a reason for hiding this comment

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

This will still throw if there's no firstElementChild.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, good point. Let me make the smallest possible repro.

Always put `<link rel="import" type="css">` styles at the top
@dfreedm dfreedm merged commit f618af4 into master Dec 13, 2017
@dfreedm dfreedm deleted the fix-style-processing-only-link branch December 13, 2017 22:25
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.

4 participants