Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ng-attr-* entry in $attrs has incorrect casing #16624

Open
1 task done
jbedard opened this issue Jul 6, 2018 · 0 comments
Open
1 task done

ng-attr-* entry in $attrs has incorrect casing #16624

jbedard opened this issue Jul 6, 2018 · 0 comments

Comments

@jbedard
Copy link
Contributor

jbedard commented Jul 6, 2018

I'm submitting a ...

  • bug report

Current behavior:
The entries in $attrs created by ng-attr-* have the incorrect camel casing when the attribute has mixed case.

Details
Normally the keys in $attrs get normalized by directiveNormalize(name.toLowerCase()): https://github.com/angular/angular.js/blob/v1.7.2/src/ng/compile.js#L2274

But for ng-attr-* the name gets partially normalized by the ng-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.myCamelprop instead of $attrs.myCamelProp. Where my-camel_prop="..." would be $attrs.myCamelProp.

Note that the actual attribute put onto the element is correct, it's only the entry in $attrs and $attrs.$attr that have the incorrect casing. For example ng-attr-my-camel_case correctly maps to the my-camelCase attribute, its just the key in $attrs.myCamelcase and $attrs.$attr.myCamelcase that are wrong.

Expected / new behavior:
Consistent attribute name normalizing between ng-attr-* and normal attributes.

Anything else:
I wonder if $attrs.$set has any issues? https://github.com/angular/angular.js/blob/v1.7.2/src/ng/compile.js#L1762-L1765

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants