From e4f7e349809c7a27dcb0729ad100036cbb6fd7cf Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 28 Apr 2014 23:18:37 +0200 Subject: [PATCH] perf(tagging_view_factory): Move a test out of the loop --- lib/core_dom/tagging_view_factory.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/core_dom/tagging_view_factory.dart b/lib/core_dom/tagging_view_factory.dart index 0722f9f40..614fd0889 100644 --- a/lib/core_dom/tagging_view_factory.dart +++ b/lib/core_dom/tagging_view_factory.dart @@ -60,13 +60,15 @@ class TaggingViewFactory implements ViewFactory { if (node.nodeType == 1) { var elts = node.querySelectorAll('.ng-binding'); - // HACK: querySelectorAll doesn't return the node. - var startIndex = node.classes.contains('ng-binding') ? -1 : 0; - for (int j = startIndex, jj = elts.length; j < jj; j++, elementBinderIndex++) { + // querySelectorAll doesn't return the node itself + if (node.classes.contains('ng-binding')) { + var tagged = elementBinders[elementBinderIndex]; + _bindTagged(tagged, elementBinderIndex, rootInjector, elementInjectors, view, node); + elementBinderIndex++; + } + for (int j = 0; j < elts.length; j++, elementBinderIndex++) { TaggedElementBinder tagged = elementBinders[elementBinderIndex]; - var boundNode = j == -1 ? node : elts[j]; - - _bindTagged(tagged, elementBinderIndex, rootInjector, elementInjectors, view, boundNode); + _bindTagged(tagged, elementBinderIndex, rootInjector, elementInjectors, view, elts[j]); } } else if (node.nodeType == 3 || node.nodeType == 8) { TaggedElementBinder tagged = elementBinders[elementBinderIndex];