From 2a9b4e9a75ccc8ac9339bc90d1a5da9821dc8575 Mon Sep 17 00:00:00 2001
From: webchick <drupal@webchick.net>
Date: Wed, 25 Feb 2015 20:31:48 -0800
Subject: [PATCH] Issue #2426595 by mortendk, brahmjeet789, LewisNyman,
 DickJohnson: rename indentation class to js-indentation

---
 core/includes/theme.inc                       |  2 +-
 core/misc/tabledrag.js                        | 40 +++++++++----------
 core/modules/system/css/system.module.css     |  4 +-
 .../src/Tests/TaxonomyTermIndentationTest.php |  4 +-
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 6627118af9a2..29cf0e37a680 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -1137,7 +1137,7 @@ function template_preprocess_feed_icon(&$variables) {
 function theme_indentation($variables) {
   $output = '';
   for ($n = 0; $n < $variables['size']; $n++) {
-    $output .= '<div class="indentation">&nbsp;</div>';
+    $output .= '<div class="js-indentation">&nbsp;</div>';
   }
   return $output;
 }
diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js
index 0795e3046af6..9717354277ac 100644
--- a/core/misc/tabledrag.js
+++ b/core/misc/tabledrag.js
@@ -95,7 +95,7 @@
       var indent = Drupal.theme('tableDragIndentation');
       var testRow = $('<tr/>').addClass('draggable').appendTo(table);
       var testCell = $('<td/>').appendTo(testRow).prepend(indent).prepend(indent);
-      var $indentation = testCell.find('.indentation');
+      var $indentation = testCell.find('.js-indentation');
       this.indentAmount = $indentation.get(1).offsetLeft - $indentation.get(0).offsetLeft;
       testRow.remove();
     }
@@ -315,11 +315,11 @@
     // Create the handle.
     var handle = $('<a href="#" class="tabledrag-handle"><div class="handle">&nbsp;</div></a>').attr('title', Drupal.t('Drag to re-order'));
     // Insert the handle after indentations (if any).
-    var $indentationLast = $item.find('td:first .indentation:last');
+    var $indentationLast = $item.find('td:first .js-indentation:last');
     if ($indentationLast.length) {
       $indentationLast.after(handle);
       // Update the total width of indentation in this entire table.
-      self.indentCount = Math.max($item.find('.indentation').length, self.indentCount);
+      self.indentCount = Math.max($item.find('.js-indentation').length, self.indentCount);
     }
     else {
       $item.find('td:first').prepend(handle);
@@ -388,7 +388,7 @@
             if ($(item).is('.tabledrag-root')) {
               // Swap with the previous top-level row.
               groupHeight = 0;
-              while (previousRow && $previousRow.find('.indentation').length) {
+              while (previousRow && $previousRow.find('.js-indentation').length) {
                 $previousRow = $(previousRow).prev('tr').eq(0);
                 previousRow = $previousRow.get(0);
                 groupHeight += $previousRow.is(':hidden') ? 0 : previousRow.offsetHeight;
@@ -770,7 +770,7 @@
       sourceRow = changedRow;
       if ($previousRow.is('.draggable') && $previousRow.find('.' + group).length) {
         if (this.indentEnabled) {
-          if ($previousRow.find('.indentations').length === $changedRow.find('.indentations').length) {
+          if ($previousRow.find('.js-indentations').length === $changedRow.find('.js-indentations').length) {
             sourceRow = previousRow;
           }
         }
@@ -780,7 +780,7 @@
       }
       else if ($nextRow.is('.draggable') && $nextRow.find('.' + group).length) {
         if (this.indentEnabled) {
-          if ($nextRow.find('.indentations').length === $changedRow.find('.indentations').length) {
+          if ($nextRow.find('.js-indentations').length === $changedRow.find('.js-indentations').length) {
             sourceRow = nextRow;
           }
         }
@@ -794,7 +794,7 @@
     else if (rowSettings.relationship === 'parent') {
       $previousRow = $changedRow.prev('tr');
       previousRow = $previousRow;
-      while ($previousRow.length && $previousRow.find('.indentation').length >= this.rowObject.indents) {
+      while ($previousRow.length && $previousRow.find('.js-indentation').length >= this.rowObject.indents) {
         $previousRow = $previousRow.prev('tr');
         previousRow = $previousRow;
       }
@@ -838,7 +838,7 @@
       switch (rowSettings.action) {
         case 'depth':
           // Get the depth of the target row.
-          targetElement.value = $(sourceElement).closest('tr').find('.indentation').length;
+          targetElement.value = $(sourceElement).closest('tr').find('.js-indentation').length;
           break;
         case 'match':
           // Update the value.
@@ -976,7 +976,7 @@
     this.element = tableRow;
     this.method = method;
     this.group = [tableRow];
-    this.groupDepth = $tableRow.find('.indentation').length;
+    this.groupDepth = $tableRow.find('.js-indentation').length;
     this.changed = false;
     this.table = $tableRow.closest('table')[0];
     this.indentEnabled = indentEnabled;
@@ -984,12 +984,12 @@
     this.direction = ''; // Direction the row is being moved.
 
     if (this.indentEnabled) {
-      this.indents = $tableRow.find('.indentation').length;
+      this.indents = $tableRow.find('.js-indentation').length;
       this.children = this.findChildren(addClasses);
       this.group = $.merge(this.group, this.children);
       // Find the depth of this entire group.
       for (var n = 0; n < this.group.length; n++) {
-        this.groupDepth = Math.max($(this.group[n]).find('.indentation').length, this.groupDepth);
+        this.groupDepth = Math.max($(this.group[n]).find('.js-indentation').length, this.groupDepth);
       }
     }
   };
@@ -1021,11 +1021,11 @@
 
     while (currentRow.length) {
       // A greater indentation indicates this is a child.
-      if (currentRow.find('.indentation').length > parentIndentation) {
+      if (currentRow.find('.js-indentation').length > parentIndentation) {
         child++;
         rows.push(currentRow[0]);
         if (addClasses) {
-          currentRow.find('.indentation').each(rowIndentation);
+          currentRow.find('.js-indentation').each(rowIndentation);
         }
       }
       else {
@@ -1034,7 +1034,7 @@
       currentRow = currentRow.next('tr.draggable');
     }
     if (addClasses && rows.length) {
-      $(rows[rows.length - 1]).find('.indentation:nth-child(' + (parentIndentation + 1) + ')').addClass('tree-child-last');
+      $(rows[rows.length - 1]).find('.js-indentation:nth-child(' + (parentIndentation + 1) + ')').addClass('tree-child-last');
     }
     return rows;
   };
@@ -1112,7 +1112,7 @@
 
     // Minimum indentation:
     // Do not orphan the next row.
-    minIndent = nextRow ? $(nextRow).find('.indentation').length : 0;
+    minIndent = nextRow ? $(nextRow).find('.js-indentation').length : 0;
 
     // Maximum indentation:
     if (!prevRow || $prevRow.is(':not(.draggable)') || $(this.element).is('.tabledrag-root')) {
@@ -1124,7 +1124,7 @@
     }
     else {
       // Do not go deeper than as a child of the previous row.
-      maxIndent = $prevRow.find('.indentation').length + ($prevRow.is('.tabledrag-leaf') ? 0 : 1);
+      maxIndent = $prevRow.find('.js-indentation').length + ($prevRow.is('.tabledrag-leaf') ? 0 : 1);
       // Limit by the maximum allowed depth for the table.
       if (this.maxDepth) {
         maxIndent = Math.min(maxIndent, this.maxDepth - (this.groupDepth - this.indents));
@@ -1160,7 +1160,7 @@
     for (var n = 1; n <= Math.abs(indentDiff); n++) {
       // Add or remove indentations.
       if (indentDiff < 0) {
-        $group.find('.indentation:first').remove();
+        $group.find('.js-indentation:first').remove();
         this.indents--;
       }
       else {
@@ -1198,7 +1198,7 @@
           // Either add immediately if this is a flat table, or check to ensure
           // that this row has the same level of indentation.
           if (this.indentEnabled) {
-            checkRowIndentation = checkRow.find('.indentation').length;
+            checkRowIndentation = checkRow.find('.js-indentation').length;
           }
 
           if (!(this.indentEnabled) || (checkRowIndentation === rowIndentation)) {
@@ -1230,7 +1230,7 @@
   Drupal.tableDrag.prototype.row.prototype.removeIndentClasses = function () {
     for (var n in this.children) {
       if (this.children.hasOwnProperty(n)) {
-        $(this.children[n]).find('.indentation')
+        $(this.children[n]).find('.js-indentation')
           .removeClass('tree-child')
           .removeClass('tree-child-first')
           .removeClass('tree-child-last')
@@ -1269,7 +1269,7 @@
       return '<abbr class="warning tabledrag-changed" title="' + Drupal.t('Changed') + '">*</abbr>';
     },
     tableDragIndentation: function () {
-      return '<div class="indentation">&nbsp;</div>';
+      return '<div class="js-indentation">&nbsp;</div>';
     },
     tableDragChangedWarning: function () {
       return '<div class="tabledrag-changed-warning messages messages--warning" role="alert">' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t('You have unsaved changes.') + '</div>';
diff --git a/core/modules/system/css/system.module.css b/core/modules/system/css/system.module.css
index 9eb87dc3dfbc..0359e4b5eab2 100644
--- a/core/modules/system/css/system.module.css
+++ b/core/modules/system/css/system.module.css
@@ -134,14 +134,14 @@ a.tabledrag-handle:focus .handle {
 .touch .draggable.drag a.tabledrag-handle .handle {
   background-position: 50% -32px;
 }
-div.indentation {
+div.js-indentation {
   float: left; /* LTR */
   height: 1.7em;
   margin: -0.4em 0.2em -0.4em -0.4em; /* LTR */
   padding: 0.42em 0 0.42em 0.6em; /* LTR */
   width: 20px;
 }
-[dir="rtl"] div.indentation {
+[dir="rtl"] div.js-indentation {
   float: right;
   margin: -0.4em -0.4em -0.4em 0.2em;
   padding: 0.42em 0.6em 0.42em 0;
diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php b/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php
index 43d53f46ebd1..0e40c1e99e1f 100644
--- a/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php
+++ b/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php
@@ -53,7 +53,7 @@ function testTermIndentation() {
 
     // Submit the edited form and check for HTML indentation element presence.
     $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->get('vid') . '/overview', $edit, t('Save'));
-    $this->assertPattern('|<div class="indentation">&nbsp;</div>|');
+    $this->assertPattern('|<div class="js-indentation">&nbsp;</div>|');
 
     // Check explicitly that term 2's parent is term 1.
     $parents = taxonomy_term_load_parents($term2->id());
@@ -69,7 +69,7 @@ function testTermIndentation() {
 
     $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->get('vid' ) . '/overview', $edit, t('Save'));
     // All terms back at the root level, no identation should be present.
-    $this->assertNoPattern('|<div class="indentation">&nbsp;</div>|');
+    $this->assertNoPattern('|<div class="js-indentation">&nbsp;</div>|');
 
     // Check explicitly that term 2 has no parents.
     \Drupal::entityManager()->getStorage('taxonomy_term')->resetCache();
-- 
GitLab