diff --git a/src/js/core/cell/Cell.js b/src/js/core/cell/Cell.js index bc68ae0e7..c2fbbf9c8 100644 --- a/src/js/core/cell/Cell.js +++ b/src/js/core/cell/Cell.js @@ -98,10 +98,8 @@ export default class Cell extends CoreFeature{ //generate cell contents _generateContents(){ - var val; - - val = this.chain("cell-format", this, null, () => { - return this.element.innerHTML = this.value; + const val = this.chain("cell-format", this, null, () => { + return this.value; }); switch(typeof val){ @@ -109,11 +107,10 @@ export default class Cell extends CoreFeature{ if(val instanceof Node){ //clear previous cell contents - while(this.element.firstChild) this.element.removeChild(this.element.firstChild); - + this._clearCellContent(); this.element.appendChild(val); }else{ - this.element.innerHTML = ""; + this._clearCellContent(); if(val != null){ console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", val); @@ -121,13 +118,17 @@ export default class Cell extends CoreFeature{ } break; case "undefined": - this.element.innerHTML = ""; + this._clearCellContent(); break; default: this.element.innerHTML = val; } } + _clearCellContent(){ + while(this.element.firstChild) this.element.removeChild(this.element.firstChild); + } + cellRendered(){ this.dispatch("cell-rendered", this); }