mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-27 04:34:59 +01:00
Fix nested selector ordering.
This commit is contained in:
parent
79630cdc47
commit
98c5ffae9a
@ -69,14 +69,15 @@ class SelectorList extends Selector {
|
||||
}
|
||||
|
||||
if (!_containsParentSelector) {
|
||||
return new SelectorList(components.expand((complex) {
|
||||
return parent.components.map((newComplex) => new ComplexSelector(
|
||||
newComplex.components.toList()..addAll(complex.components)));
|
||||
return new SelectorList(parent.components.expand((parentComplex) {
|
||||
return components.map((childComplex) => new ComplexSelector(
|
||||
parentComplex.components.toList()
|
||||
..addAll(childComplex.components)));
|
||||
}));
|
||||
}
|
||||
|
||||
// TODO: handle line breaks
|
||||
return new SelectorList(components.expand((complex) {
|
||||
return new SelectorList(flattenVertically(components.map((complex) {
|
||||
var newComplexes = [<ComplexSelectorComponent>[]];
|
||||
for (var component in complex.components) {
|
||||
if (component is CompoundSelector) {
|
||||
@ -99,7 +100,7 @@ class SelectorList extends Selector {
|
||||
}
|
||||
}
|
||||
return newComplexes.map((newComplex) => new ComplexSelector(newComplex));
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
Iterable<Iterable<ComplexSelectorComponent>> _resolveParentSelectorsCompound(
|
||||
|
@ -37,6 +37,20 @@ String pluralize(String name, int number, {String plural}) {
|
||||
return '${name}s';
|
||||
}
|
||||
|
||||
List/*<T>*/ flattenVertically/*<T>*/(Iterable<Iterable/*<T>*/ > iterable) {
|
||||
var queues = iterable.map((inner) => new QueueList.from(inner)).toList();
|
||||
if (queues.length == 1) return queues.first;
|
||||
|
||||
var result = /*<T>*/ [];
|
||||
while (queues.isNotEmpty) {
|
||||
queues.removeWhere((queue) {
|
||||
result.add(queue.removeFirst());
|
||||
return queue.isEmpty;
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int codepointIndexToCodeUnitIndex(String string, int codepointIndex) {
|
||||
var codeUnitIndex = 0;
|
||||
for (var i = 0; i < codepointIndex; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user