MCPcopy
hub / github.com/angular-ui/ui-grid / $CompileProvider

Function $CompileProvider

lib/test/angular/1.6.7/angular.js:8117–10795  ·  view source on GitHub ↗

@this

($provide, $$sanitizeUriProvider)

Source from the content-addressed store, hash-verified

8115$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
8116/** @this */
8117function $CompileProvider($provide, $$sanitizeUriProvider) {
8118 var hasDirectives = {},
8119 Suffix = 'Directive',
8120 COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/,
8121 CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/,
8122 ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
8123 REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
8124
8125 // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
8126 // The assumption is that future DOM event attribute names will begin with
8127 // 'on' and be composed of only English letters.
8128 var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
8129 var bindingCache = createMap();
8130
8131 function parseIsolateBindings(scope, directiveName, isController) {
8132 var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*([\w$]*)\s*$/;
8133
8134 var bindings = createMap();
8135
8136 forEach(scope, function(definition, scopeName) {
8137 if (definition in bindingCache) {
8138 bindings[scopeName] = bindingCache[definition];
8139 return;
8140 }
8141 var match = definition.match(LOCAL_REGEXP);
8142
8143 if (!match) {
8144 throw $compileMinErr('iscp',
8145 'Invalid {3} for directive \'{0}\'.' +
8146 ' Definition: {... {1}: \'{2}\' ...}',
8147 directiveName, scopeName, definition,
8148 (isController ? 'controller bindings definition' :
8149 'isolate scope definition'));
8150 }
8151
8152 bindings[scopeName] = {
8153 mode: match[1][0],
8154 collection: match[2] === '*',
8155 optional: match[3] === '?',
8156 attrName: match[4] || scopeName
8157 };
8158 if (match[4]) {
8159 bindingCache[definition] = bindings[scopeName];
8160 }
8161 });
8162
8163 return bindings;
8164 }
8165
8166 function parseDirectiveBindings(directive, directiveName) {
8167 var bindings = {
8168 isolateScope: null,
8169 bindToController: null
8170 };
8171 if (isObject(directive.scope)) {
8172 if (directive.bindToController === true) {
8173 bindings.bindToController = parseIsolateBindings(directive.scope,
8174 directiveName, true);

Callers

nothing calls this directly

Calls 15

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
getDirectiveRestrictFunction · 0.70
reverseParamsFunction · 0.70

Tested by

no test coverage detected