[BUGFIX] Resolve recursing DOM manipulation 72/56772/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 21 Apr 2018 07:58:49 +0000 (09:58 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 21 Apr 2018 08:22:14 +0000 (10:22 +0200)
To fix the recursive DOM manipulation, the selector class name used to
find the "blueprint" is removed from the actual clone.

Resolves: #84832
Related: #84772
Releases: master
Change-Id: Id1a26ca9d20d95c8395998c6783715e677f16780
Reviewed-on: https://review.typo3.org/56772
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Philipp Hamid <ph@supertrumpf.at>
Tested-by: Philipp Hamid <ph@supertrumpf.at>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/install/Resources/Public/JavaScript/Modules/DatabaseAnalyzer.js

index cb84065..c9480c6 100644 (file)
@@ -84,6 +84,7 @@ define([
             if (Array.isArray(data.suggestions)) {
               data.suggestions.forEach(function(element) {
                 var aBlock = modalContent.find(self.selectorSuggestionBlock).clone();
+                aBlock.removeClass(self.selectorSuggestionBlock.substr(1));
                 var key = element.key;
                 aBlock.find('.t3js-databaseAnalyzer-suggestion-block-legend').text(element.label);
                 aBlock.find('.t3js-databaseAnalyzer-suggestion-block-checkbox').attr('id', 't3-install-' + key + '-checkbox');
@@ -93,19 +94,20 @@ define([
                 aBlock.find('.t3js-databaseAnalyzer-suggestion-block-label').attr('for', 't3-install-' + key + '-checkbox');
                 element.children.forEach(function(line) {
                   var aLine = modalContent.find(self.selectorSuggestionLine).clone();
+                  aLine.removeClass(self.selectorSuggestionLine.substr(1));
                   var hash = line.hash;
-                  aLine.find('.t3js-databaseAnalyzer-suggestion-line-checkbox').attr('id', 't3-install-db-' + hash);
-                  aLine.find('.t3js-databaseAnalyzer-suggestion-line-checkbox').attr('data-hash', hash);
+                  var $checkbox = aLine.find('.t3js-databaseAnalyzer-suggestion-line-checkbox');
+                  $checkbox.attr('id', 't3-install-db-' + hash).attr('data-hash', hash);
                   if (element.enabled) {
-                    aLine.find('.t3js-databaseAnalyzer-suggestion-line-checkbox').attr('checked', 'checked');
+                    $checkbox.attr('checked', 'checked');
                   }
                   aLine.find('.t3js-databaseAnalyzer-suggestion-line-label').attr('for', 't3-install-db-' + hash);
                   aLine.find('.t3js-databaseAnalyzer-suggestion-line-statement').text(line.statement);
-                  if (line.current !== undefined) {
+                  if (typeof line.current !== 'undefined') {
                     aLine.find('.t3js-databaseAnalyzer-suggestion-line-current-value').text(line.current);
                     aLine.find('.t3js-databaseAnalyzer-suggestion-line-current').show();
                   }
-                  if (line.rowCount !== undefined) {
+                  if (typeof line.rowCount !== 'undefined') {
                     aLine.find('.t3js-databaseAnalyzer-suggestion-line-count-value').text(line.rowCount);
                     aLine.find('.t3js-databaseAnalyzer-suggestion-line-count').show();
                   }