Skip to content

Commit

Permalink
1.6.2
Browse files Browse the repository at this point in the history
* Added removal of lastChild when it is empty.
  • Loading branch information
Gluwc committed Nov 12, 2019
1 parent 9346a47 commit a4f97b7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bar-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ class BarCard extends HTMLElement {
this.attachShadow({ mode: 'open' })
}
setConfig (config) {
while(this.shadowRoot.lastChild)
this.shadowRoot.removeChild(this.shadowRoot.lastChild);

// Default Card variables
const initialConfig = Object.assign({}, config)

Expand Down Expand Up @@ -1000,7 +1003,7 @@ class BarCard extends HTMLElement {
}
return
}

// Define config
const config = this._configAttributeCheck(entity, index)

Expand All @@ -1027,7 +1030,7 @@ class BarCard extends HTMLElement {
} else {
entityState = entityObject.state
}

if(!isNaN(entityState)){
entityState = Number(entityState)
}
Expand All @@ -1036,7 +1039,7 @@ class BarCard extends HTMLElement {
entityState = Math.min(entityState, configMax)
entityState = Math.max(entityState, configMin)
}

if (config.decimal !== false) {
entityState = entityState.toFixed(config.decimal)
}
Expand Down Expand Up @@ -1223,7 +1226,7 @@ class BarCard extends HTMLElement {
customElements.define('bar-card', BarCard)

console.info(
`%cBAR-CARD\n%cVersion: 1.6.1`,
`%cBAR-CARD\n%cVersion: 1.6.2`,
"color: green; font-weight: bold;",
""
);

0 comments on commit a4f97b7

Please sign in to comment.