CascadingStyleSheet.getAllStyleRules() does not return rules from @media
See original GitHub issueHow can I loop through all the style rules including those from @media
?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Find all CSS rules that apply to an element - Stack Overflow
getMatchedCSSRules does NOT show you the final styles that apply to the element. It returns an array of all the CSSStyleRule objects that...
Read more >CSS Object Model (CSSOM) - W3C
To compare media queries m1 and m2 means to serialize them both and return true if they are a case-sensitive match and false...
Read more >com.helger.css.reader.CSSReader.readFromString java code ...
Read the CSS from the passed String using a character stream. An eventually contained @charset rule is ignored. Popular methods of CSSReader.
Read more >At-rules - CSS: Cascading Style Sheets - MDN Web Docs
@media — A conditional group rule that will apply its content if the device meets the criteria of the condition defined using a...
Read more >CSS @media rule in JavaScript - Arek Nawo
It either provides functionalities that can't be found anywhere else ... The insertRule() method returns the index at which the new CSS rule...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I extracted a common base class that does the handling for the top level rules in a type-safe way. This should resolve the issue also for the future. Thanks again for your input.
I personally don’t need it, but it may be useful for someone to add getAllStyleRules() to CSSMediaRule. Anyway I just found out, that I need to use CascadingStyleSheet.getAllRules() and filter them manually for my application. Many thanks for support.