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