mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-26 20:24:42 +01:00
Add PseudoSelector.normalizedName.
This commit is contained in:
parent
2b120f005d
commit
b5b4cd5a8b
@ -8,9 +8,13 @@ import 'package:charcode/charcode.dart';
|
||||
|
||||
import '../selector.dart';
|
||||
|
||||
final _vendorPrefix = new Regex(r'^-[a-zA-Z0-9]+-');
|
||||
|
||||
class PseudoSelector extends SimpleSelector {
|
||||
final String name;
|
||||
|
||||
final String normalizedName;
|
||||
|
||||
final PseudoType type;
|
||||
|
||||
final String argument;
|
||||
@ -29,7 +33,9 @@ class PseudoSelector extends SimpleSelector {
|
||||
}
|
||||
int _maxSpecificity;
|
||||
|
||||
PseudoSelector(this.name, this.type, {this.argument, this.selector});
|
||||
PseudoSelector(String name, this.type, {this.argument, this.selector})
|
||||
: name = name,
|
||||
normalizedName = name.replaceFirst(_vendorPrefix, '');
|
||||
|
||||
List<SimpleSelector> unify(List<SimpleSelector> compound) {
|
||||
if (compound.contains(this)) return compound;
|
||||
|
@ -187,7 +187,7 @@ bool _simpleIsSuperselectorOfCompound(SimpleSelector simple,
|
||||
|
||||
// Some selector pseudoclasses can match normal selectors.
|
||||
if (theirSimple is PseudoSelector && theirSimple.selector != null &&
|
||||
_subselectorPseudos.contains(theirSimple.name)) {
|
||||
_subselectorPseudos.contains(theirSimple.normalizedName)) {
|
||||
return theirSimple.selector.components.any((complex) {
|
||||
if (complex.components.length != 1) return false;
|
||||
var compound = complex.components.single as CompoundSelector;
|
||||
|
Loading…
Reference in New Issue
Block a user