MCPcopy Index your code
hub / github.com/angular-ui/ui-router / $CompileProvider

Function $CompileProvider

test/angular/1.5/angular.js:7735–10324  ·  view source on GitHub ↗

@this

($provide, $$sanitizeUriProvider)

Source from the content-addressed store, hash-verified

7733$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
7734/** @this */
7735function $CompileProvider($provide, $$sanitizeUriProvider) {
7736 var hasDirectives = {},
7737 Suffix = 'Directive',
7738 COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/,
7739 CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/,
7740 ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
7741 REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
7742
7743 // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
7744 // The assumption is that future DOM event attribute names will begin with
7745 // 'on' and be composed of only English letters.
7746 var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
7747 var bindingCache = createMap();
7748
7749 function parseIsolateBindings(scope, directiveName, isController) {
7750 var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*([\w$]*)\s*$/;
7751
7752 var bindings = createMap();
7753
7754 forEach(scope, function(definition, scopeName) {
7755 if (definition in bindingCache) {
7756 bindings[scopeName] = bindingCache[definition];
7757 return;
7758 }
7759 var match = definition.match(LOCAL_REGEXP);
7760
7761 if (!match) {
7762 throw $compileMinErr('iscp',
7763 'Invalid {3} for directive \'{0}\'.' +
7764 ' Definition: {... {1}: \'{2}\' ...}',
7765 directiveName, scopeName, definition,
7766 (isController ? 'controller bindings definition' :
7767 'isolate scope definition'));
7768 }
7769
7770 bindings[scopeName] = {
7771 mode: match[1][0],
7772 collection: match[2] === '*',
7773 optional: match[3] === '?',
7774 attrName: match[4] || scopeName
7775 };
7776 if (match[4]) {
7777 bindingCache[definition] = bindings[scopeName];
7778 }
7779 });
7780
7781 return bindings;
7782 }
7783
7784 function parseDirectiveBindings(directive, directiveName) {
7785 var bindings = {
7786 isolateScope: null,
7787 bindToController: null
7788 };
7789 if (isObject(directive.scope)) {
7790 if (directive.bindToController === true) {
7791 bindings.bindToController = parseIsolateBindings(directive.scope,
7792 directiveName, true);

Callers

nothing calls this directly

Calls 15

fnFunction · 0.85
isArrayFunction · 0.85
makeMapFunction · 0.70
createMapFunction · 0.70
assertArgFunction · 0.70
assertNotHasOwnPropertyFunction · 0.70
isStringFunction · 0.70
assertValidDirectiveNameFunction · 0.70
forEachFunction · 0.70
isFunctionFunction · 0.70
valueFnFunction · 0.70
getDirectiveRequireFunction · 0.70

Tested by

no test coverage detected