Skip to content

Commit

Permalink
[BUGFIX] Access and update attribute data-action explicitly in Core…
Browse files Browse the repository at this point in the history
… Updater

This patch updates the data attribute `action` via overriding the HTML
attribute. Previously, jQuery's `.data()` was used which broke the
functionality as the DOM gets re-rendered and jQuery lost the overriden
value in its data object.

Resolves: #87847
Releases: master, 9.5
Change-Id: Iddece8ccd498373b0490ea99b6808b76e6c5c2cf
Reviewed-on: https://review.typo3.org/c/59877
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
andreaskienast authored and bmack committed Mar 6, 2019
1 parent 66544cd commit ebe37c9
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -87,7 +87,9 @@ define([

currentModal.on('click', '.t3js-coreUpdate-init', function(e) {
e.preventDefault();
var action = $(e.target).data('action');
// Don't use jQuery's data() function, as the DOM is re-rendered and any set data attribute gets lost.
// See showActionButton()
var action = $(e.target).attr('data-action');
currentModal.find(self.selectorOutput).empty();
self[action]();
});
Expand Down Expand Up @@ -250,7 +252,7 @@ define([
}
var domButton = this.buttonTemplate;
if (action) {
domButton.data('action', action);
domButton.attr('data-action', action);
}
if (title) {
domButton.text(title);
Expand Down

0 comments on commit ebe37c9

Please sign in to comment.