@@ -94,55 +94,6 @@ var hyperHTML = (function (document) {
94
94
95
95
var WeakSet$1 = self$1 . WeakSet ;
96
96
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
-
146
97
var iOF = [ ] . indexOf ;
147
98
var append = function append ( get , parent , children , start , end , before ) {
148
99
var isSelect = 'selectedIndex' in parent ;
@@ -224,23 +175,20 @@ var hyperHTML = (function (document) {
224
175
tresh [ i ] = currentEnd ;
225
176
}
226
177
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 ) ;
232
179
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 ] ) ;
235
182
236
- if ( idxInOld != null ) {
183
+ if ( - 1 < index ) {
184
+ var idxInOld = index + currentStart ;
237
185
k = findK ( tresh , minLen , idxInOld ) ;
238
186
/* istanbul ignore else */
239
187
240
188
if ( - 1 < k ) {
241
189
tresh [ k ] = idxInOld ;
242
190
link [ k ] = {
243
- newi : _i2 ,
191
+ newi : _i ,
244
192
oldi : idxInOld ,
245
193
prev : link [ k - 1 ]
246
194
} ;
@@ -365,7 +313,7 @@ var hyperHTML = (function (document) {
365
313
} ;
366
314
367
315
var applyDiff = function applyDiff ( diff , get , parentNode , futureNodes , futureStart , currentNodes , currentStart , currentLength , before ) {
368
- var live = new Map$1 ( ) ;
316
+ var live = [ ] ;
369
317
var length = diff . length ;
370
318
var currentIndex = currentStart ;
371
319
var i = 0 ;
@@ -379,7 +327,7 @@ var hyperHTML = (function (document) {
379
327
380
328
case INSERTION :
381
329
// TODO: bulk appends for sequential nodes
382
- live . set ( futureNodes [ futureStart ] , 1 ) ;
330
+ live . push ( futureNodes [ futureStart ] ) ;
383
331
append ( get , parentNode , futureNodes , futureStart ++ , futureStart , currentIndex < currentLength ? get ( currentNodes [ currentIndex ] , 0 ) : before ) ;
384
332
break ;
385
333
@@ -399,7 +347,7 @@ var hyperHTML = (function (document) {
399
347
400
348
case DELETION :
401
349
// 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 ) ;
403
351
break ;
404
352
}
405
353
}
@@ -533,10 +481,10 @@ var hyperHTML = (function (document) {
533
481
534
482
535
483
/*! (c) Andrea Giammarchi - ISC */
536
- var self$3 = null ||
484
+ var self$2 = null ||
537
485
/* istanbul ignore next */
538
486
{ } ;
539
- self$3 . CustomEvent = typeof CustomEvent === 'function' ? CustomEvent : function ( __p__ ) {
487
+ self$2 . CustomEvent = typeof CustomEvent === 'function' ? CustomEvent : function ( __p__ ) {
540
488
CustomEvent [ __p__ ] = new CustomEvent ( '' ) . constructor [ __p__ ] ;
541
489
return CustomEvent ;
542
490
@@ -547,7 +495,56 @@ var hyperHTML = (function (document) {
547
495
return e ;
548
496
}
549
497
} ( '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 ;
551
548
552
549
// able to create Custom Elements like components
553
550
// including the ability to listen to connect/disconnect
0 commit comments