From 9ef6bb5743d70a2ec117535d981c4b9748a293de Mon Sep 17 00:00:00 2001 From: Andrey Taritsyn Date: Wed, 15 Oct 2014 21:46:07 +0400 Subject: [PATCH] Simplify regular expressions in compile.js --- src/ng/compile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ng/compile.js b/src/ng/compile.js index 912b45bb9854..92de577764b6 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -680,8 +680,8 @@ $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; function $CompileProvider($provide, $$sanitizeUriProvider) { var hasDirectives = {}, Suffix = 'Directive', - COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w_\-]+)\s+(.*)$/, - CLASS_DIRECTIVE_REGEXP = /(([\d\w_\-]+)(?:\:([^;]+))?;?)/, + COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/, + CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/, ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; @@ -2434,7 +2434,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { }]; } -var PREFIX_REGEXP = /^(x[\:\-_]|data[\:\-_])/i; +var PREFIX_REGEXP = /^((?:x|data)[\:\-_])/i; /** * Converts all accepted directives format into proper directive name. * All of these will become 'myDirective':