File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
build/media_source/system/js/fields Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 9696
9797 // Check active, with extra check for nested joomla-field-subform
9898 if ( btnAdd && btnAdd . closest ( 'joomla-field-subform' ) === that ) {
99- let row = btnAdd . closest ( 'joomla-field-subform' ) ;
100- row = row . closest ( that . repeatableElement ) === that ? row : null ;
99+ let row = btnAdd . closest ( that . repeatableElement ) ;
100+ row = row && row . closest ( 'joomla-field-subform' ) === that ? row : null ;
101101 that . addRow ( row ) ;
102102 event . preventDefault ( ) ;
103103 } else if ( btnRem && btnRem . closest ( 'joomla-field-subform' ) === that ) {
113113 const isRem = that . buttonRemove && event . target . matches ( that . buttonRemove ) ;
114114
115115 if ( ( isAdd || isRem ) && event . target . closest ( 'joomla-field-subform' ) === that ) {
116- let row = event . target . closest ( 'joomla-field-subform' ) ;
117- row = row . closest ( that . repeatableElement ) === that ? row : null ;
116+ let row = event . target . closest ( that . repeatableElement ) ;
117+ row = row && row . closest ( 'joomla-field-subform' ) === that ? row : null ;
118+
118119 if ( isRem && row ) {
119120 that . removeRow ( row ) ;
120121 } else if ( isAdd ) {
You can’t perform that action at this time.
0 commit comments