Skip to content

Commit

Permalink
Fixes #1389 (reviewed by @kevinpschaaf)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Orvell committed May 23, 2015
1 parent 3573f63 commit 6433f62
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/css-parse.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@
var rx = {
comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
port: /@import[^;]*;/gim,
customProp: /--[^;{]*?:[^{};]*?;/gim,
mixinProp: /--[^;{]*?:[^{;]*?{[^}]*?};?/gim,
customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?;/gim,
mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?};?/gim,
mixinApply: /@apply[\s]*\([^)]*?\)[\s]*;/gim,
varApply: /[^;:]*?:[^;]*var[^;]*;/gim,
keyframesRule: /^@[^\s]*keyframes/,
Expand Down
11 changes: 11 additions & 0 deletions test/unit/styling-cross-scope-var.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<dom-module id="x-scope">
<style>
:host {
x--invalid: 15px solid gray;
display: block;
padding: 8px;
--scope-var: 1px solid black;
Expand Down Expand Up @@ -207,6 +208,10 @@
x-host-property {
border: 10px solid purple;
}

#invalid {
border: var(--invalid);
}
</style>

<template>
Expand All @@ -220,6 +225,7 @@
<div id="applyDefault2">var default</div>
<div id="calc">Calc</div>
<div id="shadow">Shadow</div>
<div id="invalid">invalid</div>
<x-host-property id="hostProp"></x-host-property>
<x-has-if id="iffy"></x-has-if>
</template>
Expand Down Expand Up @@ -272,6 +278,11 @@

});

test('invalid variables not parsed', function() {
assert.notProperty(styled._styleProperties, 'x--invalid');
assertComputed(styled.$.invalid, '0px');
});

test('simple variables applied correctly between scopes', function() {
assertComputed(styled.$.me, '1px');
assertComputed(styled.$.child.$.me, '2px');
Expand Down

0 comments on commit 6433f62

Please sign in to comment.