Skip to content

Commit

Permalink
Merge pull request #3841 from Polymer/apply-shim-var-better-fix
Browse files Browse the repository at this point in the history
Do not insert semicolon when fixing var() syntax
  • Loading branch information
kevinpschaaf authored Aug 5, 2016
2 parents 8b89f02 + 0a338a7 commit a44f177
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/apply-shim.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@
}

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

// produce variable consumption at the site of mixin consumption
Expand Down
5 changes: 5 additions & 0 deletions test/unit/styling-cross-scope-var.html
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@
#badFallback {
border: var(--undefined, --default1);
}
#funkyFallback {
color: var(--undefined, var(--undefined, --primary-color));
}
</style>
<div id="me">x-scope</div>
<x-keyframes id="keyframes"></x-keyframes>
Expand Down Expand Up @@ -535,6 +538,7 @@
<div id="doubleNestedFallback"></div>
<div id="cornerFallback"></div>
<div id="badFallback"></div>
<div id="funkyFallback"></div>
</template>
<script>
HTMLImports.whenReady(function() {
Expand Down Expand Up @@ -1197,6 +1201,7 @@

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

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

0 comments on commit a44f177

Please sign in to comment.