Skip to content

Commit 3a6bf0d

Browse files
revert: fix($compile): throw error on invalid directive name
This reverts commit 634e467, which introduced a breaking change between 1.3.15 and 1.3.16. Closes angular#12169
1 parent e201f90 commit 3a6bf0d

File tree

3 files changed

+0
-27
lines changed

3 files changed

+0
-27
lines changed

docs/content/error/$compile/baddir.ngdoc

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/ng/compile.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -757,14 +757,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
757757
return bindings;
758758
}
759759

760-
function assertValidDirectiveName(name) {
761-
var letter = name.charAt(0);
762-
if (!letter || letter !== lowercase(letter)) {
763-
throw $compileMinErr('baddir', "Directive name '{0}' is invalid. The first character must be a lowercase letter", name);
764-
}
765-
return name;
766-
}
767-
768760
/**
769761
* @ngdoc method
770762
* @name $compileProvider#directive
@@ -783,7 +775,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
783775
this.directive = function registerDirective(name, directiveFactory) {
784776
assertNotHasOwnProperty(name, 'directive');
785777
if (isString(name)) {
786-
assertValidDirectiveName(name);
787778
assertArg(directiveFactory, 'directiveFactory');
788779
if (!hasDirectives.hasOwnProperty(name)) {
789780
hasDirectives[name] = [];

test/ng/compileSpec.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ describe('$compile', function() {
147147

148148

149149
describe('configuration', function() {
150-
151150
it('should register a directive', function() {
152151
module(function() {
153152
directive('div', function(log) {
@@ -202,15 +201,6 @@ describe('$compile', function() {
202201
});
203202
inject(function($compile) {});
204203
});
205-
206-
it('should throw an exception if a directive name starts with a non-lowercase letter', function() {
207-
module(function() {
208-
expect(function() {
209-
directive('BadDirectiveName', function() { });
210-
}).toThrowMinErr('$compile','baddir', "Directive name 'BadDirectiveName' is invalid. The first character must be a lowercase letter");
211-
});
212-
inject(function($compile) {});
213-
});
214204
});
215205

216206

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy