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

Function $CompileProvider

lib/test/angular/1.5.0/angular.js:7358–9616  ·  view source on GitHub ↗
($provide, $$sanitizeUriProvider)

Source from the content-addressed store, hash-verified

7356 */
7357$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
7358function $CompileProvider($provide, $$sanitizeUriProvider) {
7359 var hasDirectives = {},
7360 Suffix = 'Directive',
7361 COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/,
7362 CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/,
7363 ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
7364 REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
7365
7366 // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
7367 // The assumption is that future DOM event attribute names will begin with
7368 // 'on' and be composed of only English letters.
7369 var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
7370
7371 function parseIsolateBindings(scope, directiveName, isController) {
7372 var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/;
7373
7374 var bindings = {};
7375
7376 forEach(scope, function(definition, scopeName) {
7377 var match = definition.match(LOCAL_REGEXP);
7378
7379 if (!match) {
7380 throw $compileMinErr('iscp',
7381 "Invalid {3} for directive '{0}'." +
7382 " Definition: {... {1}: '{2}' ...}",
7383 directiveName, scopeName, definition,
7384 (isController ? "controller bindings definition" :
7385 "isolate scope definition"));
7386 }
7387
7388 bindings[scopeName] = {
7389 mode: match[1][0],
7390 collection: match[2] === '*',
7391 optional: match[3] === '?',
7392 attrName: match[4] || scopeName
7393 };
7394 });
7395
7396 return bindings;
7397 }
7398
7399 function parseDirectiveBindings(directive, directiveName) {
7400 var bindings = {
7401 isolateScope: null,
7402 bindToController: null
7403 };
7404 if (isObject(directive.scope)) {
7405 if (directive.bindToController === true) {
7406 bindings.bindToController = parseIsolateBindings(directive.scope,
7407 directiveName, true);
7408 bindings.isolateScope = {};
7409 } else {
7410 bindings.isolateScope = parseIsolateBindings(directive.scope,
7411 directiveName, false);
7412 }
7413 }
7414 if (isObject(directive.bindToController)) {
7415 bindings.bindToController =

Callers

nothing calls this directly

Calls 15

makeMapFunction · 0.70
assertNotHasOwnPropertyFunction · 0.70
isStringFunction · 0.70
assertValidDirectiveNameFunction · 0.70
assertArgFunction · 0.70
forEachFunction · 0.70
isFunctionFunction · 0.70
valueFnFunction · 0.70
parseDirectiveBindingsFunction · 0.70
isObjectFunction · 0.70
reverseParamsFunction · 0.70
isDefinedFunction · 0.70

Tested by

no test coverage detected