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

Commit fc70a98

Browse files
TaritsynIgorMinar
authored andcommitted
refactor($compile): simplify regular expressions
Closes #9637
1 parent 49d03a5 commit fc70a98

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ng/compile.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,8 @@ $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
680680
function $CompileProvider($provide, $$sanitizeUriProvider) {
681681
var hasDirectives = {},
682682
Suffix = 'Directive',
683-
COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w_\-]+)\s+(.*)$/,
684-
CLASS_DIRECTIVE_REGEXP = /(([\d\w_\-]+)(?:\:([^;]+))?;?)/,
683+
COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/,
684+
CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/,
685685
ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
686686
REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
687687

@@ -2434,7 +2434,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
24342434
}];
24352435
}
24362436

2437-
var PREFIX_REGEXP = /^(x[\:\-_]|data[\:\-_])/i;
2437+
var PREFIX_REGEXP = /^((?:x|data)[\:\-_])/i;
24382438
/**
24392439
* Converts all accepted directives format into proper directive name.
24402440
* All of these will become 'myDirective':

0 commit comments

Comments
 (0)