From 53a4f57dda947efd031aaab72a44f1c667d93b97 Mon Sep 17 00:00:00 2001 From: jos Date: Thu, 14 Feb 2019 20:42:23 +0100 Subject: [PATCH] Fix #657: `onClassName` throwing an error when a node is removed --- HISTORY.md | 1 + src/js/Node.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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(); }