@@ -180,7 +180,7 @@ class Store extends EventEmitter {
180
180
} ) ;
181
181
} else {
182
182
this . searchRoots = this . _nodes . entrySeq ( )
183
- . filter ( ( [ key , val ] ) => nodeMatchesText ( val , needle ) )
183
+ . filter ( ( [ key , val ] ) => nodeMatchesText ( val , needle , key , this ) )
184
184
. map ( ( [ key , val ] ) => key )
185
185
. toList ( ) ;
186
186
}
@@ -347,13 +347,17 @@ class Store extends EventEmitter {
347
347
if ( nodeType !== 'Wrapper' && nodeType !== 'Native' ) {
348
348
return id ;
349
349
}
350
- if ( nodeType === 'Native' && this . get ( this . _parents . get ( id ) ) . get ( 'nodeType' ) !== 'NativeWrapper' ) {
350
+ if ( nodeType === 'Native' && ( ! up || this . get ( this . _parents . get ( id ) ) . get ( 'nodeType' ) !== 'NativeWrapper' ) ) {
351
351
return id ;
352
352
}
353
353
if ( up ) {
354
354
return this . _parents . get ( id ) ;
355
355
}
356
- return node . get ( 'children' ) [ 0 ] ;
356
+ var children = node . get ( 'children' ) ;
357
+ if ( 'string' === typeof children ) {
358
+ return children ;
359
+ }
360
+ return children [ 0 ] ;
357
361
}
358
362
359
363
off ( evt : string , fn : ListenerFunction ) : void {
@@ -427,7 +431,7 @@ class Store extends EventEmitter {
427
431
var curNodes = this . _nodesByName . get ( data . name ) || new Set ( ) ;
428
432
this . _nodesByName = this . _nodesByName . set ( data . name , curNodes . add ( data . id ) ) ;
429
433
this . emit ( data . id ) ;
430
- if ( this . searchRoots && nodeMatchesText ( map , this . searchText . toLowerCase ( ) ) ) {
434
+ if ( this . searchRoots && nodeMatchesText ( map , this . searchText . toLowerCase ( ) , data . id , this ) ) {
431
435
this . searchRoots = this . searchRoots . push ( data . id ) ;
432
436
this . emit ( 'searchRoots' ) ;
433
437
}
0 commit comments