File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ const CACHE = {};
1616const stringify = JSON . stringify ;
1717
1818export default function html ( statics ) {
19- const key = stringify ( statics ) ;
19+ let key = '.' ;
20+ for ( let i = 0 ; i < statics . length ; i ++ ) key += statics [ i ] . length + ',' + statics [ i ] ;
2021 const tpl = CACHE [ key ] || ( CACHE [ key ] = build ( statics ) ) ;
2122
2223 // eslint-disable-next-line prefer-rest-params
Original file line number Diff line number Diff line change @@ -164,5 +164,7 @@ describe('htm', () => {
164164 test ( 'cache key should be unique' , ( ) => {
165165 html `< a b ="${ 'foo' } " /> ` ;
166166 expect ( html `< a b ="\0" /> ` ) . toEqual ( h ( 'a' , { b : '\0' } ) ) ;
167+ expect ( html `< a > ${ '' } 9aaaaaaaaa${ '' } </ a > ` ) . not . toEqual ( html `< a > ${ '' } 0${ '' } aaaaaaaaa${ '' } </ a > ` ) ;
168+ expect ( html `< a > ${ '' } 0${ '' } aaaaaaaa${ '' } </ a > ` ) . not . toEqual ( html `< a > ${ '' } .8aaaaaaaa${ '' } </ a > ` ) ;
167169 } ) ;
168170} ) ;
You can’t perform that action at this time.
0 commit comments