mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
still working on exiting out of .walk(..) prematurely...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ec2101bf4a
commit
ce221b4b34
@ -937,7 +937,6 @@ var BaseBrowserPrototype = {
|
||||
// XXX BUG: this for some reason matches ['B', '*'] to ['nested', 'moo']
|
||||
: pattern instanceof Array ?
|
||||
function(elem, i, path){
|
||||
console.log('%%%', path, pattern)
|
||||
return path.length > 0
|
||||
&& pattern.length == path.length
|
||||
&& (pattern[path.length-1] == '*'
|
||||
@ -949,23 +948,42 @@ var BaseBrowserPrototype = {
|
||||
&& i == pattern } )
|
||||
|
||||
|
||||
/*
|
||||
var Stop = new Error('Target found.')
|
||||
var res
|
||||
try {
|
||||
//*/
|
||||
|
||||
return this.walk(
|
||||
function(i, path, elem, doNested){
|
||||
console.log('---', i, path)
|
||||
if(elem && func.call(this, elem, i, path)){
|
||||
res = elem
|
||||
//res = elem
|
||||
//throw Stop
|
||||
return [elem]
|
||||
}
|
||||
return []
|
||||
},
|
||||
function(_, i, path, sublist, options){
|
||||
// XXX skip paths...
|
||||
// XXX
|
||||
// XXX does not work yet...
|
||||
if(pattern instanceof Array
|
||||
&& pattern[path.length-1] != '*'
|
||||
&& pattern[path.length-1] != path[path.length-1]){
|
||||
return []
|
||||
}
|
||||
|
||||
return sublist.search(pattern, i, path, options)
|
||||
},
|
||||
...args,
|
||||
options)
|
||||
|
||||
/* XXX need to do this only in the root call...
|
||||
} catch(err){
|
||||
if(err === Stop){
|
||||
return res
|
||||
}
|
||||
throw err
|
||||
}
|
||||
//*/
|
||||
},
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user