Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ef2588

Browse files
committed
perF($compile): don't create jq wrapper for linkNode needlesly
when compileNode and linkNode are the same, we can reuse the existing jqLite wrapper.
1 parent f8f7a1d commit 2ef2588

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/ng/compile.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,12 +1479,16 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
14791479

14801480

14811481
function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
1482-
var i, ii, linkFn, controller, isolateScope, elementControllers, transcludeFn;
1482+
var i, ii, linkFn, controller, isolateScope, elementControllers, transcludeFn, $element,
1483+
attrs;
14831484

1484-
var $element = jqLite(linkNode);
1485-
var attrs = (compileNode === linkNode)
1486-
? templateAttrs
1487-
: new Attributes($element, templateAttrs);
1485+
if (compileNode === linkNode) {
1486+
attrs = templateAttrs;
1487+
$element = templateAttrs.$$element;
1488+
} else {
1489+
$element = jqLite(linkNode);
1490+
attrs = new Attributes($element, templateAttrs);
1491+
}
14881492

14891493
if (newIsolateScopeDirective) {
14901494
var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/;

0 commit comments

Comments
 (0)