($provide, $$sanitizeUriProvider)
| 6961 | */ |
| 6962 | $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; |
| 6963 | function $CompileProvider($provide, $$sanitizeUriProvider) { |
| 6964 | var hasDirectives = {}, |
| 6965 | Suffix = 'Directive', |
| 6966 | COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/, |
| 6967 | CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/, |
| 6968 | ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), |
| 6969 | REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; |
| 6970 | |
| 6971 | // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes |
| 6972 | // The assumption is that future DOM event attribute names will begin with |
| 6973 | // 'on' and be composed of only English letters. |
| 6974 | var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; |
| 6975 | |
| 6976 | function parseIsolateBindings(scope, directiveName, isController) { |
| 6977 | var LOCAL_REGEXP = /^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/; |
| 6978 | |
| 6979 | var bindings = {}; |
| 6980 | |
| 6981 | forEach(scope, function(definition, scopeName) { |
| 6982 | var match = definition.match(LOCAL_REGEXP); |
| 6983 | |
| 6984 | if (!match) { |
| 6985 | throw $compileMinErr('iscp', |
| 6986 | "Invalid {3} for directive '{0}'." + |
| 6987 | " Definition: {... {1}: '{2}' ...}", |
| 6988 | directiveName, scopeName, definition, |
| 6989 | (isController ? "controller bindings definition" : |
| 6990 | "isolate scope definition")); |
| 6991 | } |
| 6992 | |
| 6993 | bindings[scopeName] = { |
| 6994 | mode: match[1][0], |
| 6995 | collection: match[2] === '*', |
| 6996 | optional: match[3] === '?', |
| 6997 | attrName: match[4] || scopeName |
| 6998 | }; |
| 6999 | }); |
| 7000 | |
| 7001 | return bindings; |
| 7002 | } |
| 7003 | |
| 7004 | function parseDirectiveBindings(directive, directiveName) { |
| 7005 | var bindings = { |
| 7006 | isolateScope: null, |
| 7007 | bindToController: null |
| 7008 | }; |
| 7009 | if (isObject(directive.scope)) { |
| 7010 | if (directive.bindToController === true) { |
| 7011 | bindings.bindToController = parseIsolateBindings(directive.scope, |
| 7012 | directiveName, true); |
| 7013 | bindings.isolateScope = {}; |
| 7014 | } else { |
| 7015 | bindings.isolateScope = parseIsolateBindings(directive.scope, |
| 7016 | directiveName, false); |
| 7017 | } |
| 7018 | } |
| 7019 | if (isObject(directive.bindToController)) { |
| 7020 | bindings.bindToController = |
nothing calls this directly
no test coverage detected