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

Idea: Using wikimedia/css-sanitizer to validate color #77

Open
lens0021 opened this issue Apr 15, 2022 · 0 comments
Open

Idea: Using wikimedia/css-sanitizer to validate color #77

lens0021 opened this issue Apr 15, 2022 · 0 comments

Comments

@lens0021
Copy link
Sponsor Contributor

\PortableInfobox\Helpers\InfoboxParamsValidator::validateColorValue() validates CSS Color Module Level 3 (or 4, I am not sure which) and wikimedia/css-sanitizer is a package for Extension:TemplateStyles and \Wikimedia\CSS\Grammar\MatcherFactory::color() seems to be matches colors.

I think implementing and maintaining the validation of CSS Color 3 in this extension is overdoing. So we should consider using an external library.

But there are a few problems, for example, css-sanitizer doesn't know about #rrggbbaa (T265675 RGBA hexadecimal value is not supported in background-color (no support for transparency value)). In fact, the regular expression that this extension uses is more detailed and accepts usual values. This is why I think this is an idea.

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

No branches or pull requests

1 participant