Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

A way of getting a ruleset by element/class #5

Open
arski opened this issue Aug 30, 2013 · 2 comments
Open

A way of getting a ruleset by element/class #5

arski opened this issue Aug 30, 2013 · 2 comments

Comments

@arski
Copy link

arski commented Aug 30, 2013

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

@SimonSapin
Copy link
Member

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
Copy link
Member

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants