mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'fix-for-multiple-spaces' of https://github.com/nazar-pc/polymer into nazar-pc-fix-for-multiple-spaces
This commit is contained in:
commit
51a4b2c9b5
@ -61,6 +61,7 @@ Polymer.CssParse = (function() {
|
||||
var ss = node.previous ? node.previous.end : node.parent.start;
|
||||
t = text.substring(ss, node.start-1);
|
||||
t = this._expandUnicodeEscapes(t);
|
||||
t = t.replace(this._rx.multipleSpaces, ' ');
|
||||
// TODO(sorvell): ad hoc; make selector include only after last ;
|
||||
// helps with mixin syntax
|
||||
t = t.substring(t.lastIndexOf(';')+1);
|
||||
@ -175,6 +176,7 @@ Polymer.CssParse = (function() {
|
||||
mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim,
|
||||
varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,
|
||||
keyframesRule: /^@[^\s]*keyframes/,
|
||||
multipleSpaces: /\s+/g
|
||||
},
|
||||
|
||||
VAR_START: '--',
|
||||
|
@ -89,6 +89,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
border-top: 3px solid red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style id="multiple-spaces">
|
||||
.foo .bar {}
|
||||
.foo .bar {}
|
||||
.foo
|
||||
|
||||
|
||||
.bar {}
|
||||
</style>
|
||||
<script>
|
||||
|
||||
function sanitizeCss(text) {
|
||||
@ -157,6 +166,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
assert.equal(t.rules[3].selector, '.\\0c3333d-model');
|
||||
assert.equal(t.rules[4].selector, '.\\d33333d-model');
|
||||
assert.equal(t.rules[5].selector, '.\\e33333d-model');
|
||||
});
|
||||
test('multiple consequent spaces in CSS selector', function() {
|
||||
var s4 = document.querySelector('#multiple-spaces');
|
||||
var t = css.parse(s4.textContent);
|
||||
assert.equal(t.rules[0].selector, '.foo .bar');
|
||||
assert.equal(t.rules[1].selector, '.foo .bar');
|
||||
assert.equal(t.rules[2].selector, '.foo .bar');
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user