Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(theming): fix CSS with nested rules parsing when registering a theme #12049

Merged
merged 1 commit into from
Dec 9, 2020

Conversation

Splaktar
Copy link
Contributor

@Splaktar Splaktar commented Dec 6, 2020

PR Checklist

Please check your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added or this is not a bug fix / enhancement
  • Docs have been added, updated, or were not required

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Enhancement
[ ] Documentation content changes
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

  • the regex used to split the CSS string breaks nested media query rules

Fixes #9869. Closes #9872.

What is the new behavior?

  • replace the regex used to split the CSS string with a function that takes into account nested rules
  • remove unused ruleMatchRegex

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

This PR continues the great work by @natete in PR #9872, which was thoroughly reviewed. This PR just rebases, resolves conflicts, and makes some minor formatting and naming changes.

You can see screenshots of how this is broken and how the correct rendering should look (which this PR achieves) in #9869 (comment).

- replace the regex used to split the CSS string with a function that takes into account nested rules
- remove unused `ruleMatchRegex`

Fixes #9869
@Splaktar Splaktar added this to the 1.2.2 milestone Dec 6, 2020
@Splaktar Splaktar self-assigned this Dec 6, 2020
@google-cla
Copy link

google-cla bot commented Dec 6, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ label Dec 6, 2020
@Splaktar
Copy link
Contributor Author

Splaktar commented Dec 6, 2020

@natete can you please add your consent here as requested in the previous comment? ¡Gracias!

@Splaktar Splaktar requested a review from mmalerba December 6, 2020 02:15
@Splaktar Splaktar added the pr: merge ready This PR is ready for a caretaker to review label Dec 6, 2020
@Splaktar Splaktar requested review from wagnermaciel and removed request for mmalerba December 7, 2020 18:45
@Splaktar
Copy link
Contributor Author

Splaktar commented Dec 9, 2020

Consent posted over in the old PR here: #9872 (comment)

@Splaktar Splaktar added the pr: lgtm This PR has been approved by the reviewer label Dec 9, 2020
@Splaktar Splaktar merged commit 71dc4eb into master Dec 9, 2020
@Splaktar Splaktar deleted the theming-breaks-nested-media-queries branch December 9, 2020 13:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ P2: required Issues that must be fixed. pr: lgtm This PR has been approved by the reviewer pr: merge ready This PR is ready for a caretaker to review type: bug ui: CSS ui: theme
Projects
None yet
Development

Successfully merging this pull request may close these issues.

theming: parsing a registered style with Media Queries or keyframes produces incorrect rules
3 participants