@this
($provide, $$sanitizeUriProvider)
| 8635 | $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; |
| 8636 | /** @this */ |
| 8637 | function $CompileProvider($provide, $$sanitizeUriProvider) { |
| 8638 | var hasDirectives = {}, |
| 8639 | Suffix = 'Directive', |
| 8640 | COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/, |
| 8641 | CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/, |
| 8642 | ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), |
| 8643 | REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; |
| 8644 | |
| 8645 | // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes |
| 8646 | // The assumption is that future DOM event attribute names will begin with |
| 8647 | // 'on' and be composed of only English letters. |
| 8648 | var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; |
| 8649 | var bindingCache = createMap(); |
| 8650 | |
| 8651 | function parseIsolateBindings(scope, directiveName, isController) { |
| 8652 | var LOCAL_REGEXP = /^([@&]|[=<](\*?))(\??)\s*([\w$]*)$/; |
| 8653 | |
| 8654 | var bindings = createMap(); |
| 8655 | |
| 8656 | forEach(scope, function(definition, scopeName) { |
| 8657 | definition = definition.trim(); |
| 8658 | |
| 8659 | if (definition in bindingCache) { |
| 8660 | bindings[scopeName] = bindingCache[definition]; |
| 8661 | return; |
| 8662 | } |
| 8663 | var match = definition.match(LOCAL_REGEXP); |
| 8664 | |
| 8665 | if (!match) { |
| 8666 | throw $compileMinErr('iscp', |
| 8667 | 'Invalid {3} for directive \'{0}\'.' + |
| 8668 | ' Definition: {... {1}: \'{2}\' ...}', |
| 8669 | directiveName, scopeName, definition, |
| 8670 | (isController ? 'controller bindings definition' : |
| 8671 | 'isolate scope definition')); |
| 8672 | } |
| 8673 | |
| 8674 | bindings[scopeName] = { |
| 8675 | mode: match[1][0], |
| 8676 | collection: match[2] === '*', |
| 8677 | optional: match[3] === '?', |
| 8678 | attrName: match[4] || scopeName |
| 8679 | }; |
| 8680 | if (match[4]) { |
| 8681 | bindingCache[definition] = bindings[scopeName]; |
| 8682 | } |
| 8683 | }); |
| 8684 | |
| 8685 | return bindings; |
| 8686 | } |
| 8687 | |
| 8688 | function parseDirectiveBindings(directive, directiveName) { |
| 8689 | var bindings = { |
| 8690 | isolateScope: null, |
| 8691 | bindToController: null |
| 8692 | }; |
| 8693 | if (isObject(directive.scope)) { |
| 8694 | if (directive.bindToController === true) { |
nothing calls this directly
no test coverage detected