mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-22 13:51:31 +01:00
Support reference combinators.
This commit is contained in:
parent
20eb3584bc
commit
a3142d526e
@ -123,3 +123,15 @@ class Combinator implements ComplexSelectorComponent {
|
||||
|
||||
String toString() => _text;
|
||||
}
|
||||
|
||||
/// A reference combinator, like `/for/`.
|
||||
class ReferenceCombinator implements Combinator {
|
||||
/// The name of the attribute being selected for.
|
||||
final String name;
|
||||
|
||||
String get _text => "/$name/";
|
||||
|
||||
ReferenceCombinator(this.name);
|
||||
|
||||
String toString() => _text;
|
||||
}
|
||||
|
@ -95,6 +95,12 @@ class SelectorParser extends Parser {
|
||||
component = Combinator.followingSibling;
|
||||
break;
|
||||
|
||||
case $slash:
|
||||
scanner.readChar();
|
||||
component = new ReferenceCombinator(identifier());
|
||||
scanner.expectChar($slash);
|
||||
break;
|
||||
|
||||
case $lbracket:
|
||||
case $dot:
|
||||
case $hash:
|
||||
|
@ -1814,7 +1814,7 @@ abstract class StylesheetParser extends Parser {
|
||||
if (scanComment()) {
|
||||
buffer.write(scanner.substring(commentStart));
|
||||
} else {
|
||||
buffer.write(scanner.readChar());
|
||||
buffer.writeCharCode(scanner.readChar());
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user