@@ -180,7 +180,7 @@ class Store extends EventEmitter {
180180 } ) ;
181181 } else {
182182 this . searchRoots = this . _nodes . entrySeq ( )
183- . filter ( ( [ key , val ] ) => nodeMatchesText ( val , needle ) )
183+ . filter ( ( [ key , val ] ) => nodeMatchesText ( val , needle , key , this ) )
184184 . map ( ( [ key , val ] ) => key )
185185 . toList ( ) ;
186186 }
@@ -347,13 +347,17 @@ class Store extends EventEmitter {
347347 if ( nodeType !== 'Wrapper' && nodeType !== 'Native' ) {
348348 return id ;
349349 }
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' ) ) {
351351 return id ;
352352 }
353353 if ( up ) {
354354 return this . _parents . get ( id ) ;
355355 }
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 ] ;
357361 }
358362
359363 off ( evt : string , fn : ListenerFunction ) : void {
@@ -427,7 +431,7 @@ class Store extends EventEmitter {
427431 var curNodes = this . _nodesByName . get ( data . name ) || new Set ( ) ;
428432 this . _nodesByName = this . _nodesByName . set ( data . name , curNodes . add ( data . id ) ) ;
429433 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 ) ) {
431435 this . searchRoots = this . searchRoots . push ( data . id ) ;
432436 this . emit ( 'searchRoots' ) ;
433437 }
0 commit comments