-
Notifications
You must be signed in to change notification settings - Fork 7
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
Always use restrictTo #44
base: master
Are you sure you want to change the base?
Conversation
Good idea! I think that going for an allow-list approach makes sense. In this case though we shouldn't use Since we want to go for an opt-in (allowlist) approach instead opt-out (blacklist), we should remove the concept of let defaultClasses = [':hover', ':active', ':focus', ':visited', ':focus-visible', ':focus-within'];
if (typeof options.custom === "function") {
defaultClasses = options.custom(defaultClasses);
if (false === Array.isArray(defaultClasses)) {
throw new Error("options.custom: Invalid return value. The function should return an array of strings");
}
} |
if you want |
@giuseppeg I updated API to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome thank you! We'll release 0.5.0 once all these changes are merged
I need to merge it to |
I will add changes to that PR to avoid merging |
I also moved to modern JS syntax, but I think we need to merge #46 to fix CI. But these 2 PRs is all changes which I am suggesting. We can merge them and release. |
Merged the other, feel free to rebase. |
f5fd3bc
to
a14ed72
Compare
Rebased and fixed. Merge and release when you will be ready. |
Thanks! Will do it tomorrow morning because I am not home |
}; | ||
|
||
const plugin = function (options = {}) { | ||
options.preserveBeforeAfter = options.preserveBeforeAfter ?? true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly to pseudo classes we can add support for pseudo elements, defaulting to :before and :after only, we would need a matching custom
option similar to the one for pseudo classes to customize these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have done it in separated PR? I am not sure why we need to process :after
at all.
const blacklist = { | ||
':root': true, | ||
':host': true, | ||
':host-context': true | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since now we are using an allowlist pattern, this is not necessary right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure to be honest. Do you remember why you added it?
Co-authored-by: Giuseppe <giuseppeg@users.noreply.github.com>
Co-authored-by: Giuseppe <giuseppeg@users.noreply.github.com>
Co-authored-by: Giuseppe <giuseppeg@users.noreply.github.com>
I suggest to always have allow-list of states, because right now we prefix
:where()
,:not()
and many other CSS functions like this.Even if we blacklist when, new will be added in the future. It is more likely to add new non-interactive pseudo-state.