Skip to content

Commit

Permalink
Add <dimension-token> type-checking to CSSNumericValue::parse()
Browse files Browse the repository at this point in the history
This patch implements a recent spec bug fix:

w3c/css-houdini-drafts#1065

Fixed: 1291603
Change-Id: I3adae8148dd47b24d4516448e492daccce7ecd91
  • Loading branch information
xiaochengh authored and chromium-wpt-export-bot committed Jan 28, 2022
1 parent 6ad4eb8 commit fd846bd
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
assert_throws_dom("SyntaxError", () => CSSNumericValue.parse('calc(calc(1px * 2s) + 3%)'));
}, 'Parsing a calc with incompatible units throws a SyntaxError');

test(() => {
assert_throws_dom("SyntaxError", () => CSSNumericValue.parse('1xyz'));
}, 'Parsing a <dimension-token> with invalid units throws a SyntaxError');

test(() => {
assert_style_value_equals(new CSSUnitValue(1, 'px'), CSSNumericValue.parse(' 1px '));
}, 'Parsing ignores surrounding spaces');
Expand Down

0 comments on commit fd846bd

Please sign in to comment.