Skip to content

Commit

Permalink
Cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiky30 committed Jul 8, 2022
1 parent 75e4351 commit 175abc6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion djangocms_versioning/static/djangocms_versioning/js/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,17 @@
let li_anchor = document.createElement('a');
li_anchor.setAttribute('class', 'cms-actions-dropdown-menu-item-anchor');
li_anchor.setAttribute('href', $(item).attr('href'));
li_anchor.setAttribute('id', $(item).attr('id'));

// Copy the id attribute if it is set
const itemId = $(item).attr('id');
if (itemId !== undefined) {
li_anchor.setAttribute('id', itemId);
}
// Copy the target attribute if it is set
const itemTarget = $(item).attr('target');
if (itemTarget !== undefined) {
li_anchor.setAttribute('target', itemTarget);
}

if ($(item).hasClass('cms-form-get-method')) {
li_anchor.classList.add('cms-form-get-method'); // Ensure the fake-form selector is propagated to the new anchor
Expand Down

0 comments on commit 175abc6

Please sign in to comment.