* Compile function matches each node in nodeList against the directives. Once all directives * for a particular node are collected their compile functions are executed. The compile * functions return values - the linking functions - are combined into a composite lin
(nodeList,
transcludeFn,
$rootElement,
maxPriority,
ignoreDirective,
previousCompileContext)
| 8190 | * @returns {Function} A composite linking function of all of the matched directives or null. |
| 8191 | */ |
| 8192 | function compileNodes(nodeList, |
| 8193 | transcludeFn, |
| 8194 | $rootElement, |
| 8195 | maxPriority, |
| 8196 | ignoreDirective, |
| 8197 | previousCompileContext) { |
| 8198 | var linkFns = [], |
| 8199 | attrs, |
| 8200 | directives, |
| 8201 | nodeLinkFn, |
| 8202 | childNodes, |
| 8203 | childLinkFn, |
| 8204 | linkFnFound, |
| 8205 | nodeLinkFnFound; |
| 8206 | |
| 8207 | for (var i = 0; i < nodeList.length; i++) { |
| 8208 | attrs = new Attributes(); |
| 8209 | |
| 8210 | // we must always refer to nodeList[i] since the nodes can be replaced underneath us. |
| 8211 | directives = collectDirectives(nodeList[i], |
| 8212 | [], |
| 8213 | attrs, |
| 8214 | i === 0 ? maxPriority : undefined, |
| 8215 | ignoreDirective); |
| 8216 | |
| 8217 | nodeLinkFn = (directives.length) |
| 8218 | ? applyDirectivesToNode(directives, |
| 8219 | nodeList[i], |
| 8220 | attrs, |
| 8221 | transcludeFn, |
| 8222 | $rootElement, |
| 8223 | null, |
| 8224 | [], |
| 8225 | [], |
| 8226 | previousCompileContext) |
| 8227 | : null; |
| 8228 | |
| 8229 | if (nodeLinkFn && nodeLinkFn.scope) { |
| 8230 | compile.$$addScopeClass(attrs.$$element); |
| 8231 | } |
| 8232 | |
| 8233 | childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || |
| 8234 | !(childNodes = nodeList[i].childNodes) || |
| 8235 | !childNodes.length) |
| 8236 | ? null |
| 8237 | : compileNodes(childNodes, |
| 8238 | nodeLinkFn |
| 8239 | ? ( |
| 8240 | (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) && |
| 8241 | nodeLinkFn.transclude) |
| 8242 | : transcludeFn); |
| 8243 | |
| 8244 | if (nodeLinkFn || childLinkFn) { |
| 8245 | linkFns.push(i, nodeLinkFn, childLinkFn); |
| 8246 | linkFnFound = true; |
| 8247 | nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn; |
| 8248 | } |
| 8249 |
no test coverage detected