[BUGFIX] Access and update attribute `data-action` explicitly in Core Updater 75/59875/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 5 Mar 2019 20:08:09 +0000 (21:08 +0100)
committerBenni Mack <benni@typo3.org>
Wed, 6 Mar 2019 09:05:32 +0000 (10:05 +0100)
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/59875
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/install/Resources/Public/JavaScript/Modules/CoreUpdate.js

index 65c7f70..c3ffd47 100644 (file)
@@ -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]();
       });
@@ -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);