mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-22 05:41:14 +01:00
commit
ac939f5bfe
@ -13,6 +13,8 @@
|
||||
|
||||
* Properly handle placeholder selectors in selector pseudos.
|
||||
|
||||
* Properly short-circuit the `or` and `and` operators.
|
||||
|
||||
* Support `--$variable`.
|
||||
|
||||
* Don't consider unitless numbers equal to numbers with units.
|
||||
@ -66,6 +68,11 @@
|
||||
|
||||
* Error out if a function is passed an unknown named parameter.
|
||||
|
||||
* Don't consider browser-prefixed selector pseudos to be superselectors of
|
||||
differently- or non-prefixed selector pseudos with the same base name.
|
||||
|
||||
* Fix an `@extend` edge case involving multiple combinators in a row.
|
||||
|
||||
## 1.0.0-alpha.8
|
||||
|
||||
* Add the `content-exists()` function.
|
||||
|
@ -302,9 +302,9 @@ List<List<List<ComplexSelectorComponent>>> _mergeFinalCombinators(
|
||||
// is a supersequence of the other, use that, otherwise give up.
|
||||
var lcs = longestCommonSubsequence(combinators1, combinators2);
|
||||
if (listEquals(lcs, combinators1)) {
|
||||
result.add([new List.from(combinators2.reversed)]);
|
||||
result.addFirst([new List.from(combinators2.reversed)]);
|
||||
} else if (listEquals(lcs, combinators2)) {
|
||||
result.add([new List.from(combinators1.reversed)]);
|
||||
result.addFirst([new List.from(combinators1.reversed)]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -711,7 +711,7 @@ bool _selectorPseudoIsSuperselector(
|
||||
switch (pseudo1.normalizedName) {
|
||||
case 'matches':
|
||||
case 'any':
|
||||
var pseudos = _selectorPseudosNamed(compound2, pseudo1.normalizedName);
|
||||
var pseudos = _selectorPseudosNamed(compound2, pseudo1.name);
|
||||
return pseudos.any((pseudo2) {
|
||||
return pseudo1.selector.isSuperselector(pseudo2.selector);
|
||||
}) ||
|
||||
@ -724,7 +724,7 @@ bool _selectorPseudoIsSuperselector(
|
||||
case 'has':
|
||||
case 'host':
|
||||
case 'host-context':
|
||||
return _selectorPseudosNamed(compound2, pseudo1.normalizedName)
|
||||
return _selectorPseudosNamed(compound2, pseudo1.name)
|
||||
.any((pseudo2) => pseudo1.selector.isSuperselector(pseudo2.selector));
|
||||
|
||||
case 'not':
|
||||
@ -775,4 +775,4 @@ Iterable<PseudoSelector> _selectorPseudosNamed(
|
||||
simple is PseudoSelector &&
|
||||
simple.isClass &&
|
||||
simple.selector != null &&
|
||||
simple.normalizedName == name));
|
||||
simple.name == name));
|
||||
|
@ -235,12 +235,6 @@ abstract class Value {
|
||||
Value singleEquals(Value other) =>
|
||||
new SassString("${toCssString()}=${other.toCssString()}");
|
||||
|
||||
/// The SassScript `or` operation.
|
||||
Value or(Value other) => this;
|
||||
|
||||
/// The SassScript `and` operation.
|
||||
Value and(Value other) => other;
|
||||
|
||||
/// The SassScript `>` operation.
|
||||
SassBoolean greaterThan(Value other) =>
|
||||
throw new SassScriptException('Undefined operation "$this > $other".');
|
||||
|
@ -31,9 +31,5 @@ class SassBoolean extends Value {
|
||||
|
||||
SassBoolean assertBoolean([String name]) => this;
|
||||
|
||||
Value or(Value other) => value ? this : other;
|
||||
|
||||
Value and(Value other) => value ? other : this;
|
||||
|
||||
Value unaryNot() => value ? sassFalse : sassTrue;
|
||||
}
|
||||
|
@ -20,9 +20,5 @@ class SassNull extends Value {
|
||||
|
||||
/*=T*/ accept/*<T>*/(ValueVisitor/*<T>*/ visitor) => visitor.visitNull(this);
|
||||
|
||||
Value or(Value other) => other;
|
||||
|
||||
Value and(Value other) => this;
|
||||
|
||||
Value unaryNot() => sassTrue;
|
||||
}
|
||||
|
@ -964,33 +964,55 @@ class _PerformVisitor
|
||||
Value visitBinaryOperationExpression(BinaryOperationExpression node) {
|
||||
return _addExceptionSpan(node.span, () {
|
||||
var left = node.left.accept(this);
|
||||
var right = node.right.accept(this);
|
||||
switch (node.operator) {
|
||||
case BinaryOperator.singleEquals:
|
||||
var right = node.right.accept(this);
|
||||
return left.singleEquals(right);
|
||||
|
||||
case BinaryOperator.or:
|
||||
return left.or(right);
|
||||
return left.isTruthy ? left : node.right.accept(this);
|
||||
|
||||
case BinaryOperator.and:
|
||||
return left.and(right);
|
||||
return left.isTruthy ? node.right.accept(this) : left;
|
||||
|
||||
case BinaryOperator.equals:
|
||||
var right = node.right.accept(this);
|
||||
return new SassBoolean(left == right);
|
||||
|
||||
case BinaryOperator.notEquals:
|
||||
var right = node.right.accept(this);
|
||||
return new SassBoolean(left != right);
|
||||
|
||||
case BinaryOperator.greaterThan:
|
||||
var right = node.right.accept(this);
|
||||
return left.greaterThan(right);
|
||||
|
||||
case BinaryOperator.greaterThanOrEquals:
|
||||
var right = node.right.accept(this);
|
||||
return left.greaterThanOrEquals(right);
|
||||
|
||||
case BinaryOperator.lessThan:
|
||||
var right = node.right.accept(this);
|
||||
return left.lessThan(right);
|
||||
|
||||
case BinaryOperator.lessThanOrEquals:
|
||||
var right = node.right.accept(this);
|
||||
return left.lessThanOrEquals(right);
|
||||
|
||||
case BinaryOperator.plus:
|
||||
var right = node.right.accept(this);
|
||||
return left.plus(right);
|
||||
|
||||
case BinaryOperator.minus:
|
||||
var right = node.right.accept(this);
|
||||
return left.minus(right);
|
||||
|
||||
case BinaryOperator.times:
|
||||
var right = node.right.accept(this);
|
||||
return left.times(right);
|
||||
|
||||
case BinaryOperator.dividedBy:
|
||||
var right = node.right.accept(this);
|
||||
var result = left.dividedBy(right);
|
||||
if (node.allowsSlash && left is SassNumber && right is SassNumber) {
|
||||
var leftSlash = left.asSlash ?? _toCss(left, node.left.span);
|
||||
@ -1000,7 +1022,9 @@ class _PerformVisitor
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
|
||||
case BinaryOperator.modulo:
|
||||
var right = node.right.accept(this);
|
||||
return left.modulo(right);
|
||||
default:
|
||||
return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user