From 45f5eb9e8d5512ef9e4ab16f1ae2fb0966ff5613 Mon Sep 17 00:00:00 2001 From: dteviot Date: Fri, 30 Sep 2016 09:19:45 +1300 Subject: [PATCH] util.removeEmptyDivElements() removes nested
--- plugin/js/Util.js | 2 +- unitTest/UtestUtil.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin/js/Util.js b/plugin/js/Util.js index e971d0ca..f2ee61c8 100644 --- a/plugin/js/Util.js +++ b/plugin/js/Util.js @@ -128,7 +128,7 @@ var util = (function () { // discard empty divs created when moving elements var removeEmptyDivElements = function(element) { - util.removeElements(util.getElements(element, "div", e => util.isStringWhiteSpace(e.innerHTML))); + util.removeElements(util.getElements(element, "div", e => util.isElementWhiteSpace(e))); } var removeTrailingWhiteSpace = function(element) { diff --git a/unitTest/UtestUtil.js b/unitTest/UtestUtil.js index 766644a7..e90c03f1 100644 --- a/unitTest/UtestUtil.js +++ b/unitTest/UtestUtil.js @@ -11,13 +11,14 @@ test("removeEmptyDivElements", function (assert) { "

H1

" + "
" + "
\n\n\n
" + + "
" + "" + "", "text/html"); - let content = dom.body.cloneNode(true); + let content = dom.body; util.removeEmptyDivElements(content); - assert.equal(content.innerHTML, "

H1

"); + assert.equal(content.innerHTML, "

H1

"); }); test("removeScriptableElements", function (assert) {