@@ -156,7 +156,6 @@ document.addEventListener('DOMContentLoaded', () => {
156156 const actionsSelect = document . querySelector ( '.actions select[name="action"]' ) ;
157157 const actionsSelectOptions = actionsSelect ?. querySelectorAll ( 'option' ) || [ ] ;
158158 const actionsGo = document . querySelector ( '.actions button[type="submit"]' ) ;
159- let html = '' ;
160159 const actionDelete = document . querySelector ( '.js-action-delete' ) ;
161160 const actionCopy = document . querySelector ( '.js-action-copy' ) ;
162161 const actionMove = document . querySelector ( '.js-action-move' ) ;
@@ -196,16 +195,23 @@ document.addEventListener('DOMContentLoaded', () => {
196195
197196 // mocking the action buttons to work in frontend UI
198197 actionsSelectOptions . forEach ( ( option , index ) => {
199- let className = '' ;
200198 if ( index !== 0 ) {
199+ const li = document . createElement ( 'li' ) ;
200+ const a = document . createElement ( 'a' ) ;
201+ a . href = '#' ;
202+ a . textContent = option . textContent ;
203+
201204 if ( option . value === valueDelete || option . value === valueCopy || option . value === valueMove ) {
202- className = 'class="hidden"' ;
205+ a . classList . add ( 'hidden' ) ;
206+ }
207+
208+ li . appendChild ( a ) ;
209+ if ( dropdown ) {
210+ dropdown . appendChild ( li ) ;
203211 }
204- html += `<li><a href="#"${ className } >${ option . textContent } </a></li>` ;
205212 }
206213 } ) ;
207214 if ( dropdown ) {
208- dropdown . insertAdjacentHTML ( 'beforeend' , html ) ;
209215
210216 dropdown . addEventListener ( 'click' , ( clickEvent ) => {
211217 if ( clickEvent . target . tagName === 'A' ) {
0 commit comments