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
22// A JS library to display data from input type=file
33const cPreview = {
44 /**
@@ -198,14 +198,14 @@ const cPreview = {
198198 // console.log('no valid file template, using default');
199199 }
200200 // 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 ) {
202202 // 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' ) ;
205205 } else {
206- el_target_item . classList . add ( 'cpreview-item' ) ;
206+ el_target_container . children [ index ] . classList . add ( 'cpreview-item' ) ;
207207 }
208- } ) ;
208+ } )
209209 }
210210 // Convert to base64 string
211211 reader . readAsDataURL ( el_file ) ;
@@ -218,4 +218,4 @@ const cPreview = {
218218 } ) ;
219219 }
220220}
221- cPreview . update ( ) ;
221+ cPreview . update ( ) ;
You can’t perform that action at this time.
0 commit comments