Skip to content

Commit 1924ec8

Browse files
author
Steven Orvell
committed
Fixes #1974: Correct custom property regexp's so that --foo: \n var(--bar); is supported.
1 parent b97788d commit 1924ec8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/lib/style-properties.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,15 @@
344344
},
345345

346346
rx: {
347-
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*?(?:([^;{]*?)|{([^}]*)})(?:(?=[;\n])|$)/gim,
348-
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/im,
347+
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\n])|$)/gi,
348+
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i,
349349
// note, this supports:
350350
// var(--a)
351351
// var(--a, --b)
352352
// var(--a, fallback-literal)
353353
// var(--a, fallback-literal(with-one-nested-parens))
354-
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gim,
355-
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gim,
354+
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi,
355+
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi,
356356
IS_VAR: /^--/,
357357
BRACKETED: /\{[^}]*\}/g,
358358
HOST_PREFIX: '(?:^|[^.#[:])',

test/unit/styling-cross-scope-var.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
}
9292

9393
#gc4 {
94-
--grand-child-scope-var: var(--gc4-scope);
94+
--grand-child-scope-var:
95+
var(--gc4-scope);
9596
}
9697
</style>
9798

0 commit comments

Comments
 (0)