Disconnect dom in invisible tabs (#790)

* Clear dom in invisible tabs

* Disconnect DOM of inactive tabs
This commit is contained in:
Andrey 2018-01-21 07:47:04 +02:00 committed by Paulus Schoutsen
parent aced689207
commit 31d2b6ffe1

View File

@ -51,7 +51,7 @@
}
</style>
<div class='main'>
<div id='main'>
<template is='dom-if' if='[[cards.badges]]'>
<div class='badges'>
<template is='dom-if' if='[[cards.demo]]'>
@ -184,7 +184,13 @@
orderedGroups
) {
if (!panelVisible || !viewVisible) {
if (this.$.main.parentNode) {
this.$.main._parentNode = this.$.main.parentNode;
this.$.main.parentNode.removeChild(this.$.main);
}
return;
} else if (!this.$.main.parentNode && this.$.main._parentNode) {
this.$.main._parentNode.appendChild(this.$.main);
}
this._debouncer = Polymer.Debouncer.debounce(
this._debouncer,
@ -198,14 +204,19 @@
);
}
computeCards(columns, states, orderedGroups) {
const hass = this.hass;
const cards = {
emptyCards() {
return {
demo: false,
badges: [],
columns: [],
};
}
computeCards(columns, states, orderedGroups) {
const hass = this.hass;
const cards = this.emptyCards();
const entityCount = [];
for (let i = 0; i < columns; i++) {
cards.columns.push([]);