@this
($provide, $$sanitizeUriProvider)
| 8700 | $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; |
| 8701 | /** @this */ |
| 8702 | function $CompileProvider($provide, $$sanitizeUriProvider) { |
| 8703 | var hasDirectives = {}, |
| 8704 | Suffix = 'Directive', |
| 8705 | COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/, |
| 8706 | CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/, |
| 8707 | ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), |
| 8708 | REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; |
| 8709 | |
| 8710 | // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes |
| 8711 | // The assumption is that future DOM event attribute names will begin with |
| 8712 | // 'on' and be composed of only English letters. |
| 8713 | var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; |
| 8714 | var bindingCache = createMap(); |
| 8715 | |
| 8716 | function parseIsolateBindings(scope, directiveName, isController) { |
| 8717 | var LOCAL_REGEXP = /^([@&]|[=<](\*?))(\??)\s*([\w$]*)$/; |
| 8718 | |
| 8719 | var bindings = createMap(); |
| 8720 | |
| 8721 | forEach(scope, function(definition, scopeName) { |
| 8722 | definition = definition.trim(); |
| 8723 | |
| 8724 | if (definition in bindingCache) { |
| 8725 | bindings[scopeName] = bindingCache[definition]; |
| 8726 | return; |
| 8727 | } |
| 8728 | var match = definition.match(LOCAL_REGEXP); |
| 8729 | |
| 8730 | if (!match) { |
| 8731 | throw $compileMinErr('iscp', |
| 8732 | 'Invalid {3} for directive \'{0}\'.' + |
| 8733 | ' Definition: {... {1}: \'{2}\' ...}', |
| 8734 | directiveName, scopeName, definition, |
| 8735 | (isController ? 'controller bindings definition' : |
| 8736 | 'isolate scope definition')); |
| 8737 | } |
| 8738 | |
| 8739 | bindings[scopeName] = { |
| 8740 | mode: match[1][0], |
| 8741 | collection: match[2] === '*', |
| 8742 | optional: match[3] === '?', |
| 8743 | attrName: match[4] || scopeName |
| 8744 | }; |
| 8745 | if (match[4]) { |
| 8746 | bindingCache[definition] = bindings[scopeName]; |
| 8747 | } |
| 8748 | }); |
| 8749 | |
| 8750 | return bindings; |
| 8751 | } |
| 8752 | |
| 8753 | function parseDirectiveBindings(directive, directiveName) { |
| 8754 | var bindings = { |
| 8755 | isolateScope: null, |
| 8756 | bindToController: null |
| 8757 | }; |
| 8758 | if (isObject(directive.scope)) { |
| 8759 | if (directive.bindToController === true) { |
nothing calls this directly
no test coverage detected