Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Keep track of inserted/removed for every upgraded element
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dfreedm committed Jan 14, 2014
1 parent 96f3790 commit e0ac834
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e0ac834

Please sign in to comment.