fix(ivy): type checking - apply attribute to property name mapping (#30675)
Some HTML attributes don't correspond to their DOM property name, in which case the runtime will apply the appropriate transformation when assigning a property using its attribute name. One example of this is the `for` attribute, for which the DOM property is named `htmlFor`. The type-checking machinery in ngtsc must also take this mapping into account, as it generates type-check code in which unclaimed property bindings are assigned to properties of (subtypes of) `HTMLElement`. Fixes #30607 Fixes FW-1327 PR Close #30675
This commit is contained in:
@ -765,8 +765,10 @@ export function generatePropertyAliases(tNode: TNode, direction: BindingDirectio
|
||||
}
|
||||
|
||||
/**
|
||||
* Mapping between attributes names that don't correspond to their element property names.
|
||||
*/
|
||||
* Mapping between attributes names that don't correspond to their element property names.
|
||||
* Note: this mapping has to be kept in sync with the equally named mapping in the template
|
||||
* type-checking machinery of ngtsc.
|
||||
*/
|
||||
const ATTR_TO_PROP: {[name: string]: string} = {
|
||||
'class': 'className',
|
||||
'for': 'htmlFor',
|
||||
|
Reference in New Issue
Block a user