mootools / slick

Standalone CSS Selector Parser and Engine. An official MooTools project.
MIT License
149 stars 22 forks source link

Make it possible to parse comma separated selector to array of selector objects #14

Open Inviz opened 13 years ago

Inviz commented 13 years ago

Right now, Slick parses comma separated selectors into an array of expressions and wrap those into a single slick selector instance. Can you add a way to get 2 (or more) selector objects in array instead? Objects should have .raw attributes set correctly.

I do a split by comma now, but it doesnt take escaped strings into account so I feel so dirty to use it (i spend hours in shower thinking of how to clean my soul and get over it, but i cant).

Usage pattern: Parse css file, parse comma separated selectors, treat them as separate rule declarations (because they have different specificity & such).

Thank you guys for work on this. Slick saved my life.

Inviz commented 13 years ago

Maybe there is a smart workaround on how to split a selector without effing up attribute declarations with commas and other stuff? Should I use one of those \'\' regexes?

subtleGradient commented 13 years ago

You could get Slick to parse it and then loop through the expressions and pass each expression's raw into Slick.Parser again. Kindof a waste, but it would work!

subtleGradient commented 13 years ago

We should add .raw properties for each expression.