tinycss icon indicating copy to clipboard operation
tinycss copied to clipboard

A way of getting a ruleset by element/class

Open arski opened this issue 12 years ago • 2 comments

Hi there, just wondering if you ever considered something that could help one get the styles for a certain element and/or class from the list of rules.. say if I have a parsed stylesheet, and want to know what styles would apply to ".foo" or "p#bar" - even at a very crude level of exact matching, without any inheritance, overwriting etc..

Cheers

arski avatar Aug 30 '13 15:08 arski

No. This is out of scope for a parser. But you might want to have a look at cssselect as well as how to use it with tinycss.

SimonSapin avatar Aug 30 '13 15:08 SimonSapin

See also how WeasyPrint implements the full CSS cascade based on cssselect and tinycss, or how CairoSVG does it somewhat simplified.

SimonSapin avatar Aug 30 '13 15:08 SimonSapin