File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 1
- // IPREVIEW
1
+ // CPREVIEW v0.2.2
2
2
// A JS library to display data from input type=file
3
3
const cPreview = {
4
4
/**
@@ -198,14 +198,14 @@ const cPreview = {
198
198
// console.log('no valid file template, using default');
199
199
}
200
200
// Mark each file item with a specific class
201
- el_target_container . childNodes . forEach ( function ( el_target_item , item_index ) {
201
+ Object . keys ( el_target_container . children ) . forEach ( function ( index ) {
202
202
// Avoid first child which is always the remove all files button
203
- if ( item_index == 0 ) {
204
- el_target_item . classList . add ( 'cpreview-remove' ) ;
203
+ if ( index == '0' ) {
204
+ el_target_container . children [ index ] . classList . add ( 'cpreview-remove' ) ;
205
205
} else {
206
- el_target_item . classList . add ( 'cpreview-item' ) ;
206
+ el_target_container . children [ index ] . classList . add ( 'cpreview-item' ) ;
207
207
}
208
- } ) ;
208
+ } )
209
209
}
210
210
// Convert to base64 string
211
211
reader . readAsDataURL ( el_file ) ;
@@ -218,4 +218,4 @@ const cPreview = {
218
218
} ) ;
219
219
}
220
220
}
221
- cPreview . update ( ) ;
221
+ cPreview . update ( ) ;
You can’t perform that action at this time.
0 commit comments