bugfix + refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-05-09 02:28:06 +03:00
parent db078e072a
commit d1ca404feb

View File

@ -352,27 +352,11 @@ var BaseBrowserPrototype = {
// //
// visible only... // visible only...
get length(){ get length(){
return this.map({skipNested: true}).length return this.map().length },
// XXX this is wrong as it will not account for nested nested elements...
+ this.nested()
.reduce(function(res, e){
return e.collapsed ?
res + 1
: res + e.children.length }, 0) },
// tree -- ignores .collapsed...
get lengthTree(){ get lengthTree(){
return this.map({skipNested: true}).length return this.map({iterateCollapsed: true}).length },
// XXX this is wrong as it will not account for nested nested elements...
+ this.nested()
.reduce(function(res, e){
return res + e.children.length }, 0) },
// full -- ignores .collapsed and .noniterable...
get lengthAll(){ get lengthAll(){
return this.map({skipNested: true, iterateNonIterable: true}).length return this.map({iterateAll: true}).length },
// XXX this is wrong as it will not account for nested nested elements...
+ this.nested()
.reduce(function(res, e){
return res + (e.children.lengthAll || e.children.length) }, 0) },
// Item list constructor... // Item list constructor...
@ -925,10 +909,12 @@ var BaseBrowserPrototype = {
return nested } return nested }
// normalize... // normalize...
list = (list === true || list == null) ? list = list === true ?
children children
: (!iterateCollapsed && node.collapsed) ? : (!iterateCollapsed && node.collapsed) ?
[] []
: list == null ?
children
: list : list
// call .walk2(..) recursively... // call .walk2(..) recursively...