diff --git a/HISTORY.md b/HISTORY.md index b101252..e205df7 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -8,6 +8,7 @@ https://github.com/josdejong/jsoneditor - Improved JSON schema titles on fields. Fixes #321. Thanks @AdamVig. - Added Simplified Chinese localization. Thanks @long2ice. - Added Turkish localization. Thanks @beratpostalci. +- Fix #657: `onClassName` throwing an error when a node is removed. ## 2019-01-23, version 5.28.2 diff --git a/src/js/Node.js b/src/js/Node.js index 00bd47b..b89eb78 100644 --- a/src/js/Node.js +++ b/src/js/Node.js @@ -932,7 +932,7 @@ Node.prototype._updateCssClassName = function () { Node.prototype.recursivelyUpdateCssClassesOnNodes = function () { this._updateCssClassName(); - if (this.childs !== 'undefined') { + if (Array.isArray(this.childs)) { for (var i = 0; i < this.childs.length; i++) { this.childs[i].recursivelyUpdateCssClassesOnNodes(); }