(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn)
| 8492 | } |
| 8493 | |
| 8494 | function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) { |
| 8495 | var linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element, |
| 8496 | attrs, removeScopeBindingWatches, removeControllerBindingWatches; |
| 8497 | |
| 8498 | if (compileNode === linkNode) { |
| 8499 | attrs = templateAttrs; |
| 8500 | $element = templateAttrs.$$element; |
| 8501 | } else { |
| 8502 | $element = jqLite(linkNode); |
| 8503 | attrs = new Attributes($element, templateAttrs); |
| 8504 | } |
| 8505 | |
| 8506 | controllerScope = scope; |
| 8507 | if (newIsolateScopeDirective) { |
| 8508 | isolateScope = scope.$new(true); |
| 8509 | } else if (newScopeDirective) { |
| 8510 | controllerScope = scope.$parent; |
| 8511 | } |
| 8512 | |
| 8513 | if (boundTranscludeFn) { |
| 8514 | // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn` |
| 8515 | // is later passed as `parentBoundTranscludeFn` to `publicLinkFn` |
| 8516 | transcludeFn = controllersBoundTransclude; |
| 8517 | transcludeFn.$$boundTransclude = boundTranscludeFn; |
| 8518 | } |
| 8519 | |
| 8520 | if (controllerDirectives) { |
| 8521 | elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope); |
| 8522 | } |
| 8523 | |
| 8524 | if (newIsolateScopeDirective) { |
| 8525 | // Initialize isolate scope bindings for new isolate scope directive. |
| 8526 | compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective || |
| 8527 | templateDirective === newIsolateScopeDirective.$$originalDirective))); |
| 8528 | compile.$$addScopeClass($element, true); |
| 8529 | isolateScope.$$isolateBindings = |
| 8530 | newIsolateScopeDirective.$$isolateBindings; |
| 8531 | removeScopeBindingWatches = initializeDirectiveBindings(scope, attrs, isolateScope, |
| 8532 | isolateScope.$$isolateBindings, |
| 8533 | newIsolateScopeDirective); |
| 8534 | if (removeScopeBindingWatches) { |
| 8535 | isolateScope.$on('$destroy', removeScopeBindingWatches); |
| 8536 | } |
| 8537 | } |
| 8538 | |
| 8539 | // Initialize bindToController bindings |
| 8540 | for (var name in elementControllers) { |
| 8541 | var controllerDirective = controllerDirectives[name]; |
| 8542 | var controller = elementControllers[name]; |
| 8543 | var bindings = controllerDirective.$$bindings.bindToController; |
| 8544 | |
| 8545 | if (controller.identifier && bindings) { |
| 8546 | removeControllerBindingWatches = |
| 8547 | initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective); |
| 8548 | } |
| 8549 | |
| 8550 | var controllerResult = controller(); |
| 8551 | if (controllerResult !== controller.instance) { |
no test coverage detected