Skip to content

Add tests for the rules for parsing a legacy color value - #65856

Open
zcorpan wants to merge 1 commit into
masterfrom
zcorpan/legacy-colour-parsing
Open

zcorpan wants to merge 1 commit into
masterfrom
zcorpan/legacy-colour-parsing

Conversation

@zcorpan

@zcorpan zcorpan commented Nov 29, 2026

Copy link
Copy Markdown
Member

Cover each step of the algorithm via <font color> in standards and quirks mode, and check that the other legacy color attributes use it.

Locally, Chrome Canary and Safari TP truncate to 128 characters after dropping a leading # (the spec truncates first). Firefox Nightly treats whitespace-only values as failure, collapses internal whitespace, and maps transparent to rgba(0, 0, 0, 0) instead of failure.

Cover each step of the algorithm via `<font color>` in standards and quirks mode, and check that the other legacy color attributes use it.
// [input, expected computed color or null for failure, description]
const cases = [
["", null, "empty string"],
[" ", "rgb(0, 0, 0)", "single space"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems weird that the empty string and spaces are different.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, we can change it together with whatwg/html#13337

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants