Skip to content

Commit 5fa8135

Browse files
authored
Merge pull request #3136 from mgreter/bugfix/pseudo-extend
Fix obvious backporting error in pseudo extend
2 parents 701317f + 47ad22b commit 5fa8135

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/extender.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ namespace Sass {
228228
// EO registerSelector
229229

230230
// ##########################################################################
231-
// Returns an extension that combines [left] and [right]. Throws
232-
// a [SassException] if [left] and [right] have incompatible
231+
// Returns an extension that combines [left] and [right]. Throws
232+
// a [SassException] if [left] and [right] have incompatible
233233
// media contexts. Throws an [ArgumentError] if [left]
234234
// and [right] don't have the same extender and target.
235235
// ##########################################################################
@@ -281,7 +281,7 @@ namespace Sass {
281281
// ##########################################################################
282282
// Adds an extension to this extender. The [extender] is the selector for the
283283
// style rule in which the extension is defined, and [target] is the selector
284-
// passed to `@extend`. The [extend] provides the extend span and indicates
284+
// passed to `@extend`. The [extend] provides the extend span and indicates
285285
// whether the extension is optional. The [mediaContext] defines the media query
286286
// context in which the extension is defined. It can only extend selectors
287287
// within the same context. A `null` context indicates no media queries.
@@ -353,7 +353,7 @@ namespace Sass {
353353

354354
ExtSelExtMap newExtensionsByTarget;
355355
newExtensionsByTarget.insert(std::make_pair(target, newExtensions));
356-
// ToDo: do we really need to fetch again (see top off fn)
356+
// ToDo: do we really need to fetch again (see top off fn)
357357
auto existingExtensions = extensionsByExtender.find(target);
358358
if (existingExtensions != extensionsByExtender.end()) {
359359
if (hasExistingExtensions && !existingExtensions->second.empty()) {
@@ -373,7 +373,7 @@ namespace Sass {
373373

374374
}
375375
// EO addExtension
376-
376+
377377
// ##########################################################################
378378
// Extend [extensions] using [newExtensions].
379379
// ##########################################################################
@@ -446,7 +446,7 @@ namespace Sass {
446446
bool first = false, containsExtension =
447447
ObjEqualityFn(selectors.front(), extension.extender);
448448
for (const ComplexSelectorObj& complex : selectors) {
449-
// If the output contains the original complex
449+
// If the output contains the original complex
450450
// selector, there's no need to recreate it.
451451
if (containsExtension && first) {
452452
first = false;
@@ -614,7 +614,7 @@ namespace Sass {
614614
// ToDo: either change weave or paths to work with the same data?
615615
sass::vector<sass::vector<ComplexSelectorObj>>
616616
paths = permutate(extendedNotExpanded);
617-
617+
618618
for (const sass::vector<ComplexSelectorObj>& path : paths) {
619619
// Unpack the inner complex selector to component list
620620
sass::vector<sass::vector<SelectorComponentObj>> _paths;
@@ -977,15 +977,15 @@ namespace Sass {
977977
if (innerPseudo->normalized() != "matches") return {};
978978
return innerPseudo->selector()->elements();
979979
}
980-
else if (name == "matches" && name == "any" && name == "current" && name == "nth-child" && name == "nth-last-child") {
980+
else if (name == "matches" || name == "any" || name == "current" || name == "nth-child" || name == "nth-last-child") {
981981
// As above, we could theoretically support :not within :matches, but
982982
// doing so would require this method and its callers to handle much
983983
// more complex cases that likely aren't worth the pain.
984984
if (innerPseudo->name() != pseudo->name()) return {};
985985
if (!ObjEquality()(innerPseudo->argument(), pseudo->argument())) return {};
986986
return innerPseudo->selector()->elements();
987987
}
988-
else if (name == "has" && name == "host" && name == "host-context" && name == "slotted") {
988+
else if (name == "has" || name == "host" || name == "host-context" || name == "slotted") {
989989
// We can't expand nested selectors here, because each layer adds an
990990
// additional layer of semantics. For example, `:has(:has(img))`
991991
// doesn't match `<div><img></div>` but `:has(img)` does.
@@ -1031,7 +1031,7 @@ namespace Sass {
10311031
}
10321032
}
10331033
}
1034-
1034+
10351035
sass::vector<ComplexSelectorObj> expanded = expand(
10361036
complexes, extendPseudoComplex, pseudo, mediaQueryContext);
10371037

@@ -1051,7 +1051,7 @@ namespace Sass {
10511051
}
10521052

10531053
SelectorListObj list = SASS_MEMORY_NEW(SelectorList, "[phony]");
1054-
list->concat(complexes);
1054+
list->concat(expanded);
10551055
return { pseudo->withSelector(list) };
10561056

10571057
}
@@ -1088,7 +1088,7 @@ namespace Sass {
10881088
{
10891089

10901090
// Avoid truly horrific quadratic behavior.
1091-
// TODO(nweiz): I think there may be a way to get perfect trimming
1091+
// TODO(nweiz): I think there may be a way to get perfect trimming
10921092
// without going quadratic by building some sort of trie-like
10931093
// data structure that can be used to look up superselectors.
10941094
// TODO(mgreter): Check how this performs in C++ (up the limit)
@@ -1130,7 +1130,7 @@ namespace Sass {
11301130
maxSpecificity = std::max(maxSpecificity, maxSourceSpecificity(compound));
11311131
}
11321132
}
1133-
1133+
11341134

11351135
// Look in [result] rather than [selectors] for selectors after [i]. This
11361136
// ensures we aren't comparing against a selector that's already been trimmed,

0 commit comments

Comments
 (0)