This repository was archived by the owner on Apr 12, 2024. It is now read-only.
ng-attr-* entry in $attrs has incorrect casing
#16624
Milestone
$attrs has incorrect casing
#16624
I'm submitting a ...
Current behavior:
The entries in
$attrscreated byng-attr-*have the incorrect camel casing when the attribute has mixed case.Details
Normally the keys in
$attrsget normalized bydirectiveNormalize(name.toLowerCase()): https://github.com/angular/angular.js/blob/v1.7.2/src/ng/compile.js#L2274But for
ng-attr-*the name gets partially normalized by theng-attr-*logic before being normalized again in the standard way. I think this has existed since mixed case attributes were supported.This causes things like
ng-attr-my-camel_prop="..."to be$attrs.myCamelpropinstead of$attrs.myCamelProp. Wheremy-camel_prop="..."would be$attrs.myCamelProp.Note that the actual attribute put onto the element is correct, it's only the entry in
$attrsand$attrs.$attrthat have the incorrect casing. For exampleng-attr-my-camel_casecorrectly maps to themy-camelCaseattribute, its just the key in$attrs.myCamelcaseand$attrs.$attr.myCamelcasethat are wrong.Expected / new behavior:
Consistent attribute name normalizing between
ng-attr-*and normal attributes.Anything else:
I wonder if
$attrs.$sethas any issues? https://github.com/angular/angular.js/blob/v1.7.2/src/ng/compile.js#L1762-L1765The text was updated successfully, but these errors were encountered: