fix(core): treat [class]
and [className]
as unrelated bindings (#35668)
Before this change `[class]` and `[className]` were both converted into `ɵɵclassMap`. The implication of this is that at runtime we could not differentiate between the two and as a result we treated `@Input('class')` and `@Input('className)` as equivalent. This change makes `[class]` and `[className]` distinct. The implication of this is that `[class]` becomes `ɵɵclassMap` instruction but `[className]` becomes `ɵɵproperty' instruction. This means that `[className]` will no longer participate in styling and will overwrite the DOM `class` value. Fix #35577 PR Close #35668
This commit is contained in:
@ -53,6 +53,5 @@ export function setDirectiveInputsWhichShadowsStyling(
|
||||
const inputs = tNode.inputs !;
|
||||
const property = isClassBased ? 'class' : 'style';
|
||||
// We support both 'class' and `className` hence the fallback.
|
||||
const stylingInputs = inputs[property] || (isClassBased && inputs['className']);
|
||||
setInputsForProperty(tView, lView, stylingInputs, property, value);
|
||||
setInputsForProperty(tView, lView, inputs[property], property, value);
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ function initializeInputAndOutputAliases(tView: TView, tNode: TNode): void {
|
||||
}
|
||||
|
||||
if (inputsStore !== null) {
|
||||
if (inputsStore.hasOwnProperty('class') || inputsStore.hasOwnProperty('className')) {
|
||||
if (inputsStore.hasOwnProperty('class')) {
|
||||
tNode.flags |= TNodeFlags.hasClassInput;
|
||||
}
|
||||
if (inputsStore.hasOwnProperty('style')) {
|
||||
|
Reference in New Issue
Block a user