fix(ivy): classes should not mess up matching for bound dir attributes (#30002)
Previously, we had a bug where directive matching could fail if the directive attribute was bound and followed a certain number of classes. This is because in the matching logic, we were treating classes like normal attributes. We should instead be skipping classes in the attribute matching logic. Otherwise classes will match for directives with attribute selectors, and as we are iterating through them in twos (when they are stored as name-only, not in name-value pairs), it may throw off directive matching for any bound attributes that come after. This commit changes the directive matching logic to skip classes altogether. PR Close #30002
This commit is contained in:
@ -205,6 +205,14 @@ function findAttrIndexInNode(
|
||||
return i;
|
||||
} else if (maybeAttrName === AttributeMarker.Bindings) {
|
||||
bindingsMode = true;
|
||||
} else if (maybeAttrName === AttributeMarker.Classes) {
|
||||
let value = attrs[++i];
|
||||
// We should skip classes here because we have a separate mechanism for
|
||||
// matching classes in projection mode.
|
||||
while (typeof value === 'string') {
|
||||
value = attrs[++i];
|
||||
}
|
||||
continue;
|
||||
} else if (maybeAttrName === AttributeMarker.Template) {
|
||||
// We do not care about Template attributes in this scenario.
|
||||
break;
|
||||
|
Reference in New Issue
Block a user