mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-27 04:34:59 +01:00
Fix str-slice() again.
This commit is contained in:
parent
566c06df0e
commit
ca4d411362
@ -33,6 +33,8 @@
|
||||
* Properly handle a placeholder selector that isn't at the beginning of a
|
||||
compound selector.
|
||||
|
||||
* Fix more `str-slice()` bugs.
|
||||
|
||||
## 1.0.0-alpha.8
|
||||
|
||||
* Add the `content-exists()` function.
|
||||
|
@ -534,10 +534,16 @@ void defineCoreFunctions(Environment environment) {
|
||||
end.assertNoUnits("end");
|
||||
|
||||
var lengthInCodepoints = string.text.runes.length;
|
||||
|
||||
// No matter what the start index is, an end index of 0 will produce an
|
||||
// empty string.
|
||||
var endInt = end.assertInt();
|
||||
if (endInt == 0) return new SassString.empty(quotes: string.hasQuotes);
|
||||
|
||||
var startCodepoint =
|
||||
_codepointForIndex(start.assertInt(), lengthInCodepoints);
|
||||
var endCodepoint = _codepointForIndex(end.assertInt(), lengthInCodepoints,
|
||||
allowNegative: true);
|
||||
var endCodepoint =
|
||||
_codepointForIndex(endInt, lengthInCodepoints, allowNegative: true);
|
||||
if (endCodepoint == lengthInCodepoints) endCodepoint -= 1;
|
||||
if (endCodepoint < startCodepoint) {
|
||||
return new SassString.empty(quotes: string.hasQuotes);
|
||||
|
@ -12,7 +12,7 @@ import '../value.dart';
|
||||
final _emptyQuoted = new SassString("", quotes: true);
|
||||
|
||||
/// An unquoted empty string, returned by [SassString.empty].
|
||||
final _emptyUnquoted = new SassString("", quotes: true);
|
||||
final _emptyUnquoted = new SassString("", quotes: false);
|
||||
|
||||
/// A SassScript string.
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user