Skip to content

Commit a44f177

Browse files
authored
Merge pull request Polymer#3841 from Polymer/apply-shim-var-better-fix
Do not insert semicolon when fixing var() syntax
2 parents 8b89f02 + 0a338a7 commit a44f177

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/lib/apply-shim.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@
219219
}
220220

221221
// fix shim'd var syntax
222-
// var(--a, --b) -> var(--a, var(--b));
222+
// var(--a, --b) -> var(--a,var(--b))
223223
function fixVars(matchText, varA, varB) {
224224
// if fallback doesn't exist, or isn't a broken variable, abort
225-
return 'var(' + varA + ',' + 'var(' + varB + '));';
225+
return 'var(' + varA + ',' + 'var(' + varB + '))';
226226
}
227227

228228
// produce variable consumption at the site of mixin consumption

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@
502502
#badFallback {
503503
border: var(--undefined, --default1);
504504
}
505+
#funkyFallback {
506+
color: var(--undefined, var(--undefined, --primary-color));
507+
}
505508
</style>
506509
<div id="me">x-scope</div>
507510
<x-keyframes id="keyframes"></x-keyframes>
@@ -535,6 +538,7 @@
535538
<div id="doubleNestedFallback"></div>
536539
<div id="cornerFallback"></div>
537540
<div id="badFallback"></div>
541+
<div id="funkyFallback"></div>
538542
</template>
539543
<script>
540544
HTMLImports.whenReady(function() {
@@ -1197,6 +1201,7 @@
11971201

11981202
test('bad fallback syntax `var(--a, --b)` is corrected', function() {
11991203
assertComputed(styled.$.badFallback, '6px');
1204+
assertComputed(styled.$.funkyFallback, 'rgb(128, 128, 128)', null, 'color');
12001205
});
12011206

12021207
test('invalid @media rules do not match', function() {

0 commit comments

Comments
 (0)