From e0ac8343eb836834f82f64c2cc4d4109a41ba955 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Tue, 14 Jan 2014 14:58:56 -0800 Subject: [PATCH] Keep track of inserted/removed for every upgraded element The code that counts the inserted/removed state must not be gated on callbacks since the attached and detached callbacks can be set without its the twin, which would break the counting code. Fixes #89 --- src/Observer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Observer.js b/src/Observer.js index 5ee22a8..3047bf4 100644 --- a/src/Observer.js +++ b/src/Observer.js @@ -151,7 +151,7 @@ function _inserted(element) { // TODO(sjmiles): when logging, do work on all custom elements so we can // track behavior even when callbacks not defined //console.log('inserted: ', element.localName); - if (element.attachedCallback || (element.__upgraded__ && logFlags.dom)) { + if (element.__upgraded__) { logFlags.dom && console.group('inserted:', element.localName); if (inDocument(element)) { element.__inserted = (element.__inserted || 0) + 1; @@ -193,7 +193,7 @@ function removed(element) { function _removed(element) { // TODO(sjmiles): temporary: do work on all custom elements so we can track // behavior even when callbacks not defined - if (element.detachedCallback || (element.__upgraded__ && logFlags.dom)) { + if (element.__upgraded__) { logFlags.dom && console.group('removed:', element.localName); if (!inDocument(element)) { element.__inserted = (element.__inserted || 0) - 1;