-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat($compile): Throw error on incorrect casing #11281
Conversation
@@ -779,6 +779,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { | |||
return bindings; | |||
} | |||
|
|||
function assertFirstLetterIsLowerCased(name) { | |||
var letter = name.charAt(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the lowercase
function as it handles some locale issues
6389355
to
9d842a1
Compare
@@ -779,6 +779,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { | |||
return bindings; | |||
} | |||
|
|||
function assertValidDirectiveName(name) { | |||
var letter = name.charAt(0); | |||
if (letter && (letter !== lowercase(letter))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be if (!letter || letter !== lowercase(letter)) {
- Adds error message for when the first letter of the directive name is not capitalized in the definition - Refactor according to CR - More fixes as per CR - Change back to && - Change back, add missing !
e8d33dc
to
4e2e3aa
Compare
We can't use ng:badname as this refers to using |
Moreover, the test was not actually running, since you have to also request that the injector instantiates the It is better to follow the example of the I will fix this up too. |
Directive names must start with a lower case letter. Previously the compiler would quietly fail. This change adds an assertion that fails if this is not the case. Closes angular#11281 Closes angular#11109
not capitalized in the definition
This addresses #11109 .