This repository was archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
theming: parsing a registered style with Media Queries or keyframes produces incorrect rules #9869
Labels
has: Pull Request
A PR has been created to address this issue
P2: required
Issues that must be fixed.
resolution: fixed
type: bug
ui: CSS
Milestone
Comments
natete
added a commit
to natete/material
that referenced
this issue
Oct 20, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 20, 2016
Add a new test to validate the style generated by registerStyle when CSS has nested rules. References angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 21, 2016
Apply suggested corrections to improve code style. References angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 22, 2016
Ignore anything inside quotes to prevent bad parsing when a curly brace is found inside quotes as in a content rule References angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 23, 2016
…levels Add a new to validate the style generated by registerStyle when the CSS has multiple levels of nesting. References angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 23, 2016
Fix bad variable names. References angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 24, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 24, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 24, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 24, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 24, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 24, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 25, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 25, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 25, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
natete
added a commit
to natete/material
that referenced
this issue
Oct 25, 2016
Replace the regex used to split the CSS string with a function that takes into account nested rules. Fixes angular#9869
@EladBezalel the attached PR was failing tests and wasn't committed. Might need a fresh attempt. |
Some details on the given CodePen and this reproduction:
.md-test-theme * {
color: blue;
font-weight: bold;
font-size: 6px;
} Instead of @media (max-width: 700px) and (min-width: 0) .md-test-theme * {
color: blue;
font-weight: bold;
font-size: 6px;
} BrokenIt should render this way |
Splaktar
pushed a commit
that referenced
this issue
Dec 6, 2020
- replace the regex used to split the CSS string with a function that takes into account nested rules - remove unused `ruleMatchRegex` Fixes #9869
3 tasks
Splaktar
pushed a commit
that referenced
this issue
Dec 9, 2020
- replace the regex used to split the CSS string with a function that takes into account nested rules - remove unused `ruleMatchRegex` Fixes #9869
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
has: Pull Request
A PR has been created to address this issue
P2: required
Issues that must be fixed.
resolution: fixed
type: bug
ui: CSS
Actual Behavior:
What is the issue? *
When a CSS stylesheet containing media queries (or keyframes or anything that can have nesting) is registered using the Theming Provider, Angular Material processes it in a wrong way causing an incorrect result.Now the string representing the CSS is split using a regex that doesn't take into account nesting, causing nested rules to be considered independent rules. For example:
Will be parsed:
Causing a bad behavior because styles defined to p elements will be applied regardless the screen size.
What is the expected behavior?
Parsing a CSS should take into account nesting. In the example the correct result would be:CodePen (or steps to reproduce the issue): *
CodePen Demo which shows your issue:
http://codepen.io/natete/pen/BLGPbdDetails:
Second rule inside the media query is extracted from it causing the rules to be applied in a wrong manner.Angular Versions: *
Angular Version:
1.5.8Angular Material Version:
1.1.1Additional Information:
Browser Type: *
allBrowser Version: *
allOS: *
allStack Traces:
Shortcut to create a new CodePen Demo.
Note:
*
indicates required information. Without this information, your issue may be auto-closed.The text was updated successfully, but these errors were encountered: