@@ -94,55 +94,6 @@ var hyperHTML = (function (document) {
9494
9595 var WeakSet$1 = self$1 . WeakSet ;
9696
97- /*! (c) Andrea Giammarchi - ISC */
98- var self$2 = null ||
99- /* istanbul ignore next */
100- { } ;
101-
102- try {
103- self$2 . Map = Map ;
104- } catch ( Map ) {
105- self$2 . Map = function Map ( ) {
106- var i = 0 ;
107- var k = [ ] ;
108- var v = [ ] ;
109- return {
110- "delete" : function _delete ( key ) {
111- var had = contains ( key ) ;
112-
113- if ( had ) {
114- k . splice ( i , 1 ) ;
115- v . splice ( i , 1 ) ;
116- }
117-
118- return had ;
119- } ,
120- forEach : function forEach ( callback , context ) {
121- k . forEach ( function ( key , i ) {
122- callback . call ( context , v [ i ] , key , this ) ;
123- } , this ) ;
124- } ,
125- get : function get ( key ) {
126- return contains ( key ) ? v [ i ] : void 0 ;
127- } ,
128- has : function has ( key ) {
129- return contains ( key ) ;
130- } ,
131- set : function set ( key , value ) {
132- v [ contains ( key ) ? i : k . push ( key ) - 1 ] = value ;
133- return this ;
134- }
135- } ;
136-
137- function contains ( v ) {
138- i = k . indexOf ( v ) ;
139- return - 1 < i ;
140- }
141- } ;
142- }
143-
144- var Map$1 = self$2 . Map ;
145-
14697 var iOF = [ ] . indexOf ;
14798 var append = function append ( get , parent , children , start , end , before ) {
14899 var isSelect = 'selectedIndex' in parent ;
@@ -224,23 +175,20 @@ var hyperHTML = (function (document) {
224175 tresh [ i ] = currentEnd ;
225176 }
226177
227- var keymap = new Map$1 ( ) ;
228-
229- for ( var _i = currentStart ; _i < currentEnd ; _i ++ ) {
230- keymap . set ( currentNodes [ _i ] , _i ) ;
231- }
178+ var nodes = currentNodes . slice ( currentStart , currentEnd ) ;
232179
233- for ( var _i2 = futureStart ; _i2 < futureEnd ; _i2 ++ ) {
234- var idxInOld = keymap . get ( futureNodes [ _i2 ] ) ;
180+ for ( var _i = futureStart ; _i < futureEnd ; _i ++ ) {
181+ var index = nodes . indexOf ( futureNodes [ _i ] ) ;
235182
236- if ( idxInOld != null ) {
183+ if ( - 1 < index ) {
184+ var idxInOld = index + currentStart ;
237185 k = findK ( tresh , minLen , idxInOld ) ;
238186 /* istanbul ignore else */
239187
240188 if ( - 1 < k ) {
241189 tresh [ k ] = idxInOld ;
242190 link [ k ] = {
243- newi : _i2 ,
191+ newi : _i ,
244192 oldi : idxInOld ,
245193 prev : link [ k - 1 ]
246194 } ;
@@ -365,7 +313,7 @@ var hyperHTML = (function (document) {
365313 } ;
366314
367315 var applyDiff = function applyDiff ( diff , get , parentNode , futureNodes , futureStart , currentNodes , currentStart , currentLength , before ) {
368- var live = new Map$1 ( ) ;
316+ var live = [ ] ;
369317 var length = diff . length ;
370318 var currentIndex = currentStart ;
371319 var i = 0 ;
@@ -379,7 +327,7 @@ var hyperHTML = (function (document) {
379327
380328 case INSERTION :
381329 // TODO: bulk appends for sequential nodes
382- live . set ( futureNodes [ futureStart ] , 1 ) ;
330+ live . push ( futureNodes [ futureStart ] ) ;
383331 append ( get , parentNode , futureNodes , futureStart ++ , futureStart , currentIndex < currentLength ? get ( currentNodes [ currentIndex ] , 0 ) : before ) ;
384332 break ;
385333
@@ -399,7 +347,7 @@ var hyperHTML = (function (document) {
399347
400348 case DELETION :
401349 // TODO: bulk removes for sequential nodes
402- if ( live . has ( currentNodes [ currentStart ] ) ) currentStart ++ ; else remove ( get , currentNodes , currentStart ++ , currentStart ) ;
350+ if ( - 1 < live . indexOf ( currentNodes [ currentStart ] ) ) currentStart ++ ; else remove ( get , currentNodes , currentStart ++ , currentStart ) ;
403351 break ;
404352 }
405353 }
@@ -533,10 +481,10 @@ var hyperHTML = (function (document) {
533481
534482
535483 /*! (c) Andrea Giammarchi - ISC */
536- var self$3 = null ||
484+ var self$2 = null ||
537485 /* istanbul ignore next */
538486 { } ;
539- self$3 . CustomEvent = typeof CustomEvent === 'function' ? CustomEvent : function ( __p__ ) {
487+ self$2 . CustomEvent = typeof CustomEvent === 'function' ? CustomEvent : function ( __p__ ) {
540488 CustomEvent [ __p__ ] = new CustomEvent ( '' ) . constructor [ __p__ ] ;
541489 return CustomEvent ;
542490
@@ -547,7 +495,56 @@ var hyperHTML = (function (document) {
547495 return e ;
548496 }
549497 } ( 'prototype' ) ;
550- var CustomEvent$1 = self$3 . CustomEvent ;
498+ var CustomEvent$1 = self$2 . CustomEvent ;
499+
500+ /*! (c) Andrea Giammarchi - ISC */
501+ var self$3 = null ||
502+ /* istanbul ignore next */
503+ { } ;
504+
505+ try {
506+ self$3 . Map = Map ;
507+ } catch ( Map ) {
508+ self$3 . Map = function Map ( ) {
509+ var i = 0 ;
510+ var k = [ ] ;
511+ var v = [ ] ;
512+ return {
513+ "delete" : function _delete ( key ) {
514+ var had = contains ( key ) ;
515+
516+ if ( had ) {
517+ k . splice ( i , 1 ) ;
518+ v . splice ( i , 1 ) ;
519+ }
520+
521+ return had ;
522+ } ,
523+ forEach : function forEach ( callback , context ) {
524+ k . forEach ( function ( key , i ) {
525+ callback . call ( context , v [ i ] , key , this ) ;
526+ } , this ) ;
527+ } ,
528+ get : function get ( key ) {
529+ return contains ( key ) ? v [ i ] : void 0 ;
530+ } ,
531+ has : function has ( key ) {
532+ return contains ( key ) ;
533+ } ,
534+ set : function set ( key , value ) {
535+ v [ contains ( key ) ? i : k . push ( key ) - 1 ] = value ;
536+ return this ;
537+ }
538+ } ;
539+
540+ function contains ( v ) {
541+ i = k . indexOf ( v ) ;
542+ return - 1 < i ;
543+ }
544+ } ;
545+ }
546+
547+ var Map$1 = self$3 . Map ;
551548
552549 // able to create Custom Elements like components
553550 // including the ability to listen to connect/disconnect
0 commit comments