phax / ph-css

Advanced Java CSS 3 parser and builder
Apache License 2.0
155 stars 23 forks source link

Getting declaration in a specific selector block #102

Closed subbudvk closed 1 month ago

subbudvk commented 2 months ago

While visiting CSS, I see I can get, list of selectors and list of declarations (css properties like background-color)

1) Is there a way to get css properties in a specific selector block?

For example a { color:red} b{} , I need to get properties seperated for each selector 2) With getSelectors I can get selector string, is there a way to get what typr it is actually like it is a tag/attribute selector etc.,

subbudvk commented 2 months ago

@phax

phax commented 1 month ago

Actually you can. Please look eg. at the test https://github.com/phax/ph-css/blob/master/ph-css/src/test/java/com/helger/css/decl/CSSStyleRuleTest.java#L73 on how to do it best. hth

subbudvk commented 1 month ago

@phax thanks I figured out i can get for question #2, can you share some examples for #1? That is getting css declaratons inside scope of a specific selector block

subbudvk commented 1 month ago

Figured out thanks

phax commented 1 month ago

Thanks. Sorry, the css stuff is currently not very high on my priority list ...