@this
($provide, $$sanitizeUriProvider)
| 8252 | $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; |
| 8253 | /** @this */ |
| 8254 | function $CompileProvider($provide, $$sanitizeUriProvider) { |
| 8255 | var hasDirectives = {}, |
| 8256 | Suffix = 'Directive', |
| 8257 | COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/, |
| 8258 | CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/, |
| 8259 | ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), |
| 8260 | REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; |
| 8261 | |
| 8262 | // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes |
| 8263 | // The assumption is that future DOM event attribute names will begin with |
| 8264 | // 'on' and be composed of only English letters. |
| 8265 | var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; |
| 8266 | var bindingCache = createMap(); |
| 8267 | |
| 8268 | function parseIsolateBindings(scope, directiveName, isController) { |
| 8269 | var LOCAL_REGEXP = /^([@&<]|=(\*?))(\??)\s*([\w$]*)$/; |
| 8270 | |
| 8271 | var bindings = createMap(); |
| 8272 | |
| 8273 | forEach(scope, function(definition, scopeName) { |
| 8274 | definition = definition.trim(); |
| 8275 | |
| 8276 | if (definition in bindingCache) { |
| 8277 | bindings[scopeName] = bindingCache[definition]; |
| 8278 | return; |
| 8279 | } |
| 8280 | var match = definition.match(LOCAL_REGEXP); |
| 8281 | |
| 8282 | if (!match) { |
| 8283 | throw $compileMinErr('iscp', |
| 8284 | 'Invalid {3} for directive \'{0}\'.' + |
| 8285 | ' Definition: {... {1}: \'{2}\' ...}', |
| 8286 | directiveName, scopeName, definition, |
| 8287 | (isController ? 'controller bindings definition' : |
| 8288 | 'isolate scope definition')); |
| 8289 | } |
| 8290 | |
| 8291 | bindings[scopeName] = { |
| 8292 | mode: match[1][0], |
| 8293 | collection: match[2] === '*', |
| 8294 | optional: match[3] === '?', |
| 8295 | attrName: match[4] || scopeName |
| 8296 | }; |
| 8297 | if (match[4]) { |
| 8298 | bindingCache[definition] = bindings[scopeName]; |
| 8299 | } |
| 8300 | }); |
| 8301 | |
| 8302 | return bindings; |
| 8303 | } |
| 8304 | |
| 8305 | function parseDirectiveBindings(directive, directiveName) { |
| 8306 | var bindings = { |
| 8307 | isolateScope: null, |
| 8308 | bindToController: null |
| 8309 | }; |
| 8310 | if (isObject(directive.scope)) { |
| 8311 | if (directive.bindToController === true) { |
nothing calls this directly
no test coverage detected