minor refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-12-14 20:05:53 +03:00
parent 934cae33f3
commit 8afe54e69e

View File

@ -1808,17 +1808,11 @@ var Outline = {
&& (res[attr] = true) } && (res[attr] = true) }
return res }, {})), return res }, {})),
...(deep ? ...(deep ?
//{children: this.json(elem)} {children: this.data([...elem.lastChild.children])}
{children: [...elem.lastChild.children]
.map(function(elem){
return that.data(elem) })}
: {}), : {}),
} }, } },
// XXX do we need both this and data??? // Same as .data(..) but by default returns the root nodes.
// ...the only differences are: // NOTE: this always returns an array
// - the default behavior node vs all
// - .json() always returns an array
// XXX should this always return a list???
json: function(node='all'){ json: function(node='all'){
return [this.data(...( return [this.data(...(
arguments.length == 0 ? arguments.length == 0 ?