Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor for performance and features #32

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

MaxLap
Copy link

@MaxLap MaxLap commented May 25, 2015

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 added 8 commits May 20, 2015 15:42
This can improve performance for large stylesheets.
May allow for shorter outputs by displaying only the normalized ones.
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"
Some of the changes fix things needed by deadweight.
Support for pseudo-classes
Unsupported rules are now handled without errors
Now even generates implied rules to have less rules to search for at a time.
@MaxLap
Copy link
Author

MaxLap commented May 26, 2015

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.

@aanand
Copy link
Owner

aanand commented May 26, 2015

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

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

Successfully merging this pull request may close these issues.

2 participants