cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-12-14 19:06:39 +03:00
parent a308f32b14
commit 934cae33f3

View File

@ -1777,16 +1777,19 @@ var Outline = {
// serialization... // serialization...
data: function(elem, deep=true){ data: function(elem, deep=true){
var that = this var that = this
// all elements...
elem = elem =
// all elements...
(elem == 'all' || elem == 'root' || elem == '*') ? (elem == 'all' || elem == 'root' || elem == '*') ?
[...this.outline.children] [...this.outline.children]
: elem instanceof Array ?
elem
: this.get(elem) : this.get(elem)
// multiple nodes...
if(elem instanceof Array){ if(elem instanceof Array){
return elem return elem
.map(function(elem){ .map(function(elem){
return that.data(elem) }) } return that.data(elem) }) }
// single element... // single node...
// XXX move these to config... // XXX move these to config...
var attrs = this.__block_attrs__ var attrs = this.__block_attrs__
var cls_attrs = ['focused'] var cls_attrs = ['focused']
@ -1812,7 +1815,9 @@ var Outline = {
: {}), : {}),
} }, } },
// XXX do we need both this and data??? // XXX do we need both this and data???
// ...the only difference is the default behavior -- node vs all... // ...the only differences are:
// - the default behavior node vs all
// - .json() always returns an array
// XXX should this always return a list??? // XXX should this always return a list???
json: function(node='all'){ json: function(node='all'){
return [this.data(...( return [this.data(...(