From 1924ec8ba0b795d087be150a44dff9c8d162155b Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Tue, 7 Jul 2015 18:27:44 -0700 Subject: [PATCH] Fixes #1974: Correct custom property regexp's so that `--foo: \n var(--bar);` is supported. --- src/lib/style-properties.html | 8 ++++---- test/unit/styling-cross-scope-var.html | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/style-properties.html b/src/lib/style-properties.html index 7f796f91f1..f2a4271e33 100644 --- a/src/lib/style-properties.html +++ b/src/lib/style-properties.html @@ -344,15 +344,15 @@ }, rx: { - VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*?(?:([^;{]*?)|{([^}]*)})(?:(?=[;\n])|$)/gim, - MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/im, + VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\n])|$)/gi, + MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i, // note, this supports: // var(--a) // var(--a, --b) // var(--a, fallback-literal) // var(--a, fallback-literal(with-one-nested-parens)) - VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gim, - VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gim, + VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi, + VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi, IS_VAR: /^--/, BRACKETED: /\{[^}]*\}/g, HOST_PREFIX: '(?:^|[^.#[:])', diff --git a/test/unit/styling-cross-scope-var.html b/test/unit/styling-cross-scope-var.html index f4b8f9f3c7..d994508d8e 100644 --- a/test/unit/styling-cross-scope-var.html +++ b/test/unit/styling-cross-scope-var.html @@ -91,7 +91,8 @@ } #gc4 { - --grand-child-scope-var: var(--gc4-scope); + --grand-child-scope-var: + var(--gc4-scope); }