some tweaking and bugfixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-08-30 22:53:41 +03:00
parent bfbe66ed99
commit 1f746c2a41

View File

@ -11,7 +11,6 @@ var toggler = require('../toggler')
var keyboard = require('../keyboard') var keyboard = require('../keyboard')
var object = require('../object') var object = require('../object')
var widget = require('./widget') var widget = require('./widget')
var walk = require('lib/walk').walk
@ -1540,13 +1539,13 @@ var BaseBrowserPrototype = {
// //
// visible only... // visible only...
get length(){ get length(){
return this.map().length }, return this.toArray().length },
// include collapsed elements... // include collapsed elements...
get lengthTree(){ get lengthTree(){
return this.map({iterateCollapsed: true}).length }, return this.map({iterateCollapsed: true, rawResults: true}).length },
// include non-iterable elements... // include non-iterable elements...
get lengthAll(){ get lengthAll(){
return this.map({iterateAll: true}).length }, return this.map({iterateAll: true, rawResults: true}).length },
// Configuration / Extension... // Configuration / Extension...
@ -2064,7 +2063,7 @@ var BaseBrowserPrototype = {
res = r res = r
throw StopException } throw StopException }
.run(function(){ .run(function(){
StopException = new Error('walk(..): StopException.') }) StopException = new Error('StopException.') })
// options... // options...
options = Object.assign( options = Object.assign(
@ -2117,15 +2116,17 @@ var BaseBrowserPrototype = {
return (item = return (item =
item !== undefined ? item !== undefined ?
item item
: !skipItem && func ? : !skipItem ?
[ func.call(that, elem, [ func ?
inlined ? func.call(that, elem,
// NOTE: we do not increment index for inlined ?
// inlined block containers as they // NOTE: we do not increment index for
// do not occupy and space... // inlined block containers as they
context.index // do not occupy and space...
: context.index++, context.index
p, next, stop) ].flat() : context.index++,
p, next, stop)
: elem ].flat()
: []) } : []) }
// children... // children...
@ -2246,9 +2247,6 @@ var BaseBrowserPrototype = {
// - support for options // - support for options
// //
// //
// XXX should we move the defaults to .config???
// XXX Q: should we have an option to treat groups as elements???
// XXX WALK2: update docs for .map(..)
// NOTE: we do not inherit options from this.options here as it // NOTE: we do not inherit options from this.options here as it
// will be done in .walk(..) // will be done in .walk(..)
map: function(func, options){ map: function(func, options){
@ -2743,11 +2741,6 @@ var BaseBrowserPrototype = {
stop([func(elem, i, path)]) }, stop([func(elem, i, path)]) },
options) ].flat()[0] }, options) ].flat()[0] },
// Sublist map functions...
// XXX this does not include inlined sections, should it???
sublists: function(func, options){
return this.search({children: true}, func, options) },
// //
// Get parent of .focused // Get parent of .focused
// .parentOf() // .parentOf()