-
Notifications
You must be signed in to change notification settings - Fork 25
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
Selectors #9
Comments
seems like in this case we could just delete the whole rule, no? |
especially because 'normal' might not be the inherited style. |
|
That'd be ideal |
Here's a list of all the selectors by CSS version http://www.w3.org/TR/css3-selectors/#selectors Quite a bit of regex going on... but I think we tackle each selector one by one. I'll maybe work on those this evening. |
It may actually be easier than all that. Since we are going through, rule by rule, we could naiively do something like this: if ( rule.match(/\:nth-last-child/g) ) {
newRule = "";
} BUT i think when you go through the rules that have multiple selectors, one of which is valid, another which isn't, it gets hairier. li:nth-last-child(2),
li.last {
border: bold;
} So maybe we keep the rule but turn the pseudo selector into something nonsensical, but valid: rule.replace( /\:nth-last-child\(\d+\)/g, '.supermegafarts' ); li.supermegafarts,
li.last {
border: bold;
} |
Important fact: if part of a selector is invalid, the whole thing becomes invalid.
In a browser that doesn't support :nth-list-child, strongs will NOT be red. That's a fact for every browser in the world that I know of, except IE 7. So not sure what the best plan would be there. But overall I think this becomes easier. |
oh, hmm. that actually might end up being harder now that i look at the code. :/ I'll see what I can do. |
OH EASY Just replace the rule with something invalid! Then IE (if we supported it...) would technically have the right behavior, etc. li:nth-last-child(2),
strong {
color: red;
} becomes INVALIDSELECTOR:INVALID,
strong {
color: red;
} |
That's perfect, and solves the IE 7 issue too. |
Although, obviously, the selector needs to be:
|
The reason I ultimately gave up on mine was that selectors are way harder to remove than properties and values. Ultimately it would be cool if this could negate selectors...
so I guess it would find that, and either somehow remove it or go through each property and negate it:
The text was updated successfully, but these errors were encountered: