Skip to content

Commit d3bda2b

Browse files
committed
Allow any space character or even { and } (before and after capturing pattern correspondingly) as pattern boundaries instead of new lines only
1 parent 1e90906 commit d3bda2b

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/lib/style-properties.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@
350350
},
351351

352352
rx: {
353-
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\n])|$)/gi,
353+
VAR_ASSIGN: /(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\s}])|$)/gi,
354354
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i,
355355
// note, this supports:
356356
// var(--a)

test/unit/custom-style.html

+24-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
};
5454
}
5555

56+
:root{--blue-text:{color:#0000ff};--dummy-mixin:{};--bold-text:{font-weight:700}}
57+
5658

5759
:root {
5860

@@ -124,6 +126,8 @@
124126

125127
<x-red-text></x-red-text>
126128

129+
<x-blue-bold-text></x-blue-bold-text>
130+
127131
<br><br>
128132
<div id="after"></div>
129133

@@ -176,14 +180,23 @@
176180
<dom-module id="x-red-text">
177181
<style>
178182
:host {
179-
;@apply(--red-text);
183+
@apply(--red-text);
180184
}
181185
</style>
182186
<template>
183187
x-red-text
184188
</template>
185189
</dom-module>
186190

191+
<dom-module id="x-blue-bold-text">
192+
<style>
193+
:host {@apply(--blue-text);@apply(--bold-text);}
194+
</style>
195+
<template>
196+
x-blue-bold-text
197+
</template>
198+
</dom-module>
199+
187200
<script>
188201

189202
suite('x-style', function() {
@@ -206,6 +219,10 @@
206219
is: 'x-red-text'
207220
});
208221

222+
Polymer({
223+
is: 'x-blue-bold-text'
224+
});
225+
209226
xBar = document.querySelector('x-bar');
210227
xFoo = document.querySelector('x-foo');
211228

@@ -240,6 +257,12 @@
240257
assertComputed(red, 'rgb(255, 0, 0)', 'color');
241258
});
242259

260+
test('custom properties in minified css', function() {
261+
var blue = document.querySelector('x-blue-bold-text');
262+
assertComputed(blue, 'rgb(0, 0, 255)', 'color');
263+
assertComputed(blue, '700', 'fontWeight');
264+
});
265+
243266
test('custom-styles apply normal and property values to main document', function() {
244267
var bag = document.querySelector('.bag');
245268
var italic = document.querySelector('.italic');

0 commit comments

Comments
 (0)