From 8afe54e69ece5cde3e73ce20423cfe46d5868436 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 14 Dec 2023 20:05:53 +0300 Subject: [PATCH] minor refactoring... Signed-off-by: Alex A. Naanou --- experiments/outline-editor/editor.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index 482362f..39b848b 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -1808,17 +1808,11 @@ var Outline = { && (res[attr] = true) } return res }, {})), ...(deep ? - //{children: this.json(elem)} - {children: [...elem.lastChild.children] - .map(function(elem){ - return that.data(elem) })} + {children: this.data([...elem.lastChild.children])} : {}), } }, - // XXX do we need both this and data??? - // ...the only differences are: - // - the default behavior node vs all - // - .json() always returns an array - // XXX should this always return a list??? + // Same as .data(..) but by default returns the root nodes. + // NOTE: this always returns an array json: function(node='all'){ return [this.data(...( arguments.length == 0 ?