<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Color Level 4: Parsing and serialization of colors using invalid RGB notation</title>
<link rel="help" href="https://drafts.csswg.org/css-color-4/#rgb-functions">
<link rel="help" href="https://drafts.csswg.org/css-color-4/#resolving-sRGB-values">
<link rel="help" href="https://drafts.csswg.org/css-color-4/#serializing-sRGB-values">
<link rel="author" title="Chris Nardi" href="mailto:[email protected]">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
tests = [
["rgb(none, none, none)", "The none keyword is invalid in legacy color syntax"],
["rgba(none, none, none, none)", "The none keyword is invalid in legacy color syntax"],
["rgb(128, 0, none)", "The none keyword is invalid in legacy color syntax"],
["rgb(255, 255, 255, none)", "The none keyword is invalid in legacy color syntax"],
["rgb(10%, 50%, 0)", "Values must be all numbers or all percentages"],
["rgb(255, 50%, 0%)", "Values must be all numbers or all percentages"],
["rgb(0, 0 0)", "Comma optional syntax requires no commas at all"],
["rgb(,0, 0, 0)", "Leading commas are invalid"],
["rgb(0, 0,, 0)", "Double commas are invalid"],
["rgb(0, 0, 0deg)", "Angles are not accepted in the rgb function"],
["rgb(0, 0, light)", "Keywords are not accepted in the rgb function"],
["rgb()", "The rgb function requires 3 or 4 arguments"],
["rgb(0)", "The rgb function requires 3 or 4 arguments"],
["rgb(0, 0)", "The rgb function requires 3 or 4 arguments"],
["rgb(0%)", "The rgb function requires 3 or 4 arguments"],
["rgb(0%, 0%)", "The rgb function requires 3 or 4 arguments"],
["rgba(10%, 50%, 0, 1)", "Values must be all numbers or all percentages"],
["rgba(255, 50%, 0%, 1)", "Values must be all numbers or all percentages"],
["rgba(0, 0, 0 0)", "Comma optional syntax requires no commas at all"],
["rgba(0, 0, 0, 0deg)", "Angles are not accepted in the rgb function"],
["rgba(0, 0, 0, light)", "Keywords are not accepted in the rgb function"],
["rgba()", "The rgba function requires 3 or 4 arguments"],
["rgba(0)", "The rgba function requires 3 or 4 arguments"],
["rgba(0, 0, 0, 0, 0)", "The rgba function requires 3 or 4 arguments"],
["rgba(0%)", "The rgba function requires 3 or 4 arguments"],
["rgba(0%, 0%)", "The rgba function requires 3 or 4 arguments"],
["rgba(0%, 0%, 0%, 0%, 0%)", "The rgba function requires 3 or 4 arguments"],
["rgb(257, 0, 5 / 0)", "Cannot mix legacy and non-legacy formats"],
];
for (const test of tests) {
test_invalid_value("color", test[0]);
}
</script>
</body>
</html>