From ab8c285b60b88696d28311d45afce12a2d9fcdfa Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Tue, 23 Jun 2015 20:08:24 -0700 Subject: [PATCH] Fixes #1938: make host selector not tripped up by id, attr, or pseudo properties Fixes #1874, #1761: maintain static declarations within declarations that contain custom properties Fixes #1927: make custom property parser able to see property endings of ; or \n or end token. --- src/lib/css-parse.html | 8 +-- src/lib/style-properties.html | 19 +++--- test/unit/styling-cross-scope-apply.html | 73 +++++++++++++++++++++++- test/unit/styling-cross-scope-var.html | 28 ++++++++- 4 files changed, 112 insertions(+), 16 deletions(-) diff --git a/src/lib/css-parse.html b/src/lib/css-parse.html index 60ea596c48..f4ccdd38e3 100644 --- a/src/lib/css-parse.html +++ b/src/lib/css-parse.html @@ -154,10 +154,10 @@ var rx = { comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim, port: /@import[^;]*;/gim, - customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?;/gim, - mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?};?/gim, - mixinApply: /@apply[\s]*\([^)]*?\)[\s]*;/gim, - varApply: /[^;:]*?:[^;]*var[^;]*;/gim, + customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?(?:[;\n]|$)/gim, + mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?}(?:[;\n]|$)?/gim, + mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim, + varApply: /[^;:]*?:[^;]*var[^;]*(?:[;\n]|$)?/gim, keyframesRule: /^@[^\s]*keyframes/, }; diff --git a/src/lib/style-properties.html b/src/lib/style-properties.html index e8eee5edbf..9b17690957 100644 --- a/src/lib/style-properties.html +++ b/src/lib/style-properties.html @@ -84,14 +84,13 @@ // but not production, so strip out {...} cssText = cssText.replace(this.rx.BRACKETED, '') .replace(this.rx.VAR_ASSIGN, ''); - var parts = cssText.split(';'); - for (var i=0, p; i+~])' }, diff --git a/test/unit/styling-cross-scope-apply.html b/test/unit/styling-cross-scope-apply.html index cfd2ad181c..de8f21a4d9 100644 --- a/test/unit/styling-cross-scope-apply.html +++ b/test/unit/styling-cross-scope-apply.html @@ -19,6 +19,32 @@ + + + + + + + + diff --git a/test/unit/styling-cross-scope-var.html b/test/unit/styling-cross-scope-var.html index 624d25d917..e22d84d82c 100644 --- a/test/unit/styling-cross-scope-var.html +++ b/test/unit/styling-cross-scope-var.html @@ -302,7 +302,10 @@ --button-border: 16px solid tomato; --after: 17px solid brown; - } + + --end-term: 19px solid blue} + + :root{--ws-term: 18px solid orange} #me { border: var(--scope-var); @@ -350,6 +353,11 @@ --grand-child-scope-var: 9px solid orange; } + #overridesConcrete { + border: var(--scope-var); + border: 4px solid steelblue; + } + #calc { border: solid red; border-width: calc(var(--a) + var(--b)); @@ -372,6 +380,12 @@ content: 'after'; border: var(--after); } + + #wsTerm { + border: var(--ws-term) + } + + #endTerm {border: var(--end-term)}