Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
* **Breaking change:** A variable definition may now only have a single
`!global` flag or `!default` flag, or one of each.

* **Potentially breaking bug fix:** In some cases involving a `:has()` selector
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random: my favorite bugs/fixes are things like "when this, this, and that, something failed"

with a leading combinator being `@extend`ed by a selector that contained its
own combinators, `@extend` used to generate incorrect selectors. This has been
fixed.

* When extending selectors in `:is()`, `:has()`, or `:where()`, `@extend` will
now generate `:is()` selectors rather than manually combining selectors, since
there are no browser compatibility concerns in that context. This fixes
several related extension bugs in this context.

### Bogus Combinators

* **Breaking change:** Selectors with more than one combinator in a row, such as
Expand Down
10 changes: 10 additions & 0 deletions lib/src/ast/selector/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ final class SelectorList extends Selector {
/// [relative selector]: https://www.w3.org/TR/selectors-4/#relative-selector
bool get isRelative => components.every((complex) => complex.isRelative);

/// If this selector list is composed of a single complex selector, returns
/// it.
///
/// Otherwise, returns null.
///
/// @nodoc
@internal
ComplexSelector? get singleComplex =>
components.length == 1 ? components.first : null;

/// Throws a [SassException] if `this` isn't a CSS selector that's valid in
/// various places in the document, depending on the arguments passed.
///
Expand Down
8 changes: 8 additions & 0 deletions lib/src/ast/selector/pseudo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ final class PseudoSelector extends SimpleSelector {
normalizedName = unvendor(name),
super(span);

/// A shorthand for creating an `:is()` selector.
///
/// @nodoc
@internal
factory PseudoSelector.isSelector(
Iterable<ComplexSelector> components, FileSpan span) =>
PseudoSelector('is', span, selector: SelectorList(components, span));

/// Returns whether [name] is the name of a pseudo-element that can be written
/// with pseudo-class syntax (`:before`, `:after`, `:first-line`, or
/// `:first-letter`)
Expand Down
2 changes: 2 additions & 0 deletions lib/src/extend/empty_extension_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ final class EmptyExtensionStore implements ExtensionStore {
EmptyExtensionStore(),
{},
);

void trimModernSelectors() {}
}
Loading
Loading