You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I didn't see any way to return all the rules associated with a particular selector. Looks like I would just have to iterate over all delcaration blocks and then get the selector and return the values if a hit was found. Any plans on adding something similar or am I missing anything? Thanks and great library.
The text was updated successfully, but these errors were encountered:
No, there is no such thing (assuming I’m understanding you correctly). That’s mostly because selectors are (apart from being split at the comma) not really parsed at all and thus, very fragile. Selectors are also not normalized, so searching for #test > a will not yield any results when your selector is #test>a.
Parsing selectors is high on my would-really-improve-the-quality-of-the-software list (especially as it would help me get rid of a lot of bugs such as the selector a[href~="{"] yielding a parse error since CSSParser doesn’t know that the { is not really the start of a declaration block but instead part of the selector) but unfortunately, it’s not high on the list of priorities because parsing selectors is difficult and I’ve never needed it in any of my projects.
That being said, however, feel free to fork the project, add a utility method to CSSDocument or CSSList that iterates through all declaration blocks and returns the ones where one of the selectors matches a given pattern and I’ll merge your changes.
Hi, I didn't see any way to return all the rules associated with a particular selector. Looks like I would just have to iterate over all delcaration blocks and then get the selector and return the values if a hit was found. Any plans on adding something similar or am I missing anything? Thanks and great library.
The text was updated successfully, but these errors were encountered: