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

Function $CompileProvider

test/angular/1.6/angular.js:8190–10866  ·  view source on GitHub ↗

@this

($provide, $$sanitizeUriProvider)

Source from the content-addressed store, hash-verified

8188$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
8189/** @this */
8190function $CompileProvider($provide, $$sanitizeUriProvider) {
8191 var hasDirectives = {},
8192 Suffix = 'Directive',
8193 COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/,
8194 CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/,
8195 ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
8196 REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
8197
8198 // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
8199 // The assumption is that future DOM event attribute names will begin with
8200 // 'on' and be composed of only English letters.
8201 var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
8202 var bindingCache = createMap();
8203
8204 function parseIsolateBindings(scope, directiveName, isController) {
8205 var LOCAL_REGEXP = /^([@&<]|=(\*?))(\??)\s*([\w$]*)$/;
8206
8207 var bindings = createMap();
8208
8209 forEach(scope, function(definition, scopeName) {
8210 definition = definition.trim();
8211
8212 if (definition in bindingCache) {
8213 bindings[scopeName] = bindingCache[definition];
8214 return;
8215 }
8216 var match = definition.match(LOCAL_REGEXP);
8217
8218 if (!match) {
8219 throw $compileMinErr('iscp',
8220 'Invalid {3} for directive \'{0}\'.' +
8221 ' Definition: {... {1}: \'{2}\' ...}',
8222 directiveName, scopeName, definition,
8223 (isController ? 'controller bindings definition' :
8224 'isolate scope definition'));
8225 }
8226
8227 bindings[scopeName] = {
8228 mode: match[1][0],
8229 collection: match[2] === '*',
8230 optional: match[3] === '?',
8231 attrName: match[4] || scopeName
8232 };
8233 if (match[4]) {
8234 bindingCache[definition] = bindings[scopeName];
8235 }
8236 });
8237
8238 return bindings;
8239 }
8240
8241 function parseDirectiveBindings(directive, directiveName) {
8242 var bindings = {
8243 isolateScope: null,
8244 bindToController: null
8245 };
8246 if (isObject(directive.scope)) {
8247 if (directive.bindToController === 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