deadweight icon indicating copy to clipboard operation
deadweight copied to clipboard

Refactor for performance and features

Open MaxLap opened this issue 9 years ago • 2 comments

This is a set of changes that improve deadweight's performance and adds support for more css.

Normalizing the selectors to minimize the number that needs to be checked.

By making a tree with selectors that imply each other, we can only search a subset of the selectors at a time. Ex: if you have the two selectors: ".hello" and ".hello.world", then ".hello.world" implies that ".hello" would match. So until you find a ".hello", there is no reason to look for a ".hello.world". This can greatly improve the speed nested styles.

Now supporting many pseudo-classes (Based on nokogiri's supported pseudoclasses, needed to update the Gemfile.lock for nokogiri to handle some of them correctly). Additionnally, we strip the :hover and :valid since logically, if you find the element, that the :hover is also found...

When a rule is not supported, it is now handled correctly. Output wise, it remains a simple "unused" rule. That could be improved in the future to distinguish them.

MaxLap avatar May 25 '15 21:05 MaxLap

Just wanted to say that the reason the build fails is because Nokogiri 1.6.6.2 isn't supported for 1.8.7 it seems.

MaxLap avatar May 26 '15 13:05 MaxLap

Thanks! I have very little time to look after deadweight these days, but I'll take a look as soon as I can.

aanand avatar May 26 '15 14:05 aanand