Include custom properties in CSSRuleParser

Bug: 1268754
Change-Id: If21278e5e5eb52626d6d02054509664d8fdf1257
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3563071
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Changhao Han <changhaohan@chromium.org>
This commit is contained in:
Changhao Han
2022-04-01 10:15:11 +00:00
committed by Devtools-frontend LUCI CQ
parent cbfa6b8665
commit ced8121dfd
2 changed files with 5 additions and 1 deletions
@@ -96,7 +96,7 @@ export function parseCSS(text: string, chunkCallback: ChunkCallback): void {
}
break;
case CSSParserStates.Style:
if (tokenType.has('meta') || tokenType.has('property')) {
if (tokenType.has('meta') || tokenType.has('property') || tokenType.has('variable-2')) {
property = {
name: tokenValue,
value: '',
@@ -17,6 +17,7 @@ describe('panels/utils', async () => {
.child {
display: grid;
--child-theme-color: 100, 200, 0;
}
`;
const current = `
@@ -27,6 +28,7 @@ describe('panels/utils', async () => {
.child {
display: grid;
--child-theme-color: 5, 10, 15;
padding: 10px;
}`;
const diff = Diff.Diff.DiffWrapper.lineDiff(original.split('\n'), current.split('\n'));
@@ -40,6 +42,8 @@ describe('panels/utils', async () => {
}
.child {
/* --child-theme-color: 100, 200, 0; */
--child-theme-color: 5, 10, 15;
padding: 10px;
}`,
'formatted CSS changes are not correct');