diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 9ea8f05..5d645e2 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -741,7 +741,8 @@ function template_preprocess_image(&$variables) {
  *   - header: An array containing the table headers. Each element of the array
  *     can be either a localized string or an associative array with the
  *     following keys:
- *     - data: The localized title of the table column.
+ *     - data: The localized title of the table column, as a string or render
+ *       array.
  *     - field: The database field represented in the table column (required
  *       if user is to be able to sort on this column).
  *     - sort: A default sort order for this column ("asc" or "desc"). Only
@@ -765,7 +766,7 @@ function template_preprocess_image(&$variables) {
  *       'even / odd' styling. Defaults to FALSE.
  *     Each cell can be either a string or an associative array with the
  *     following keys:
- *     - data: The string to display in the table cell.
+ *     - data: The string or render array to display in the table cell.
  *     - header: Indicates this cell is a header.
  *     - Any HTML attributes, such as "colspan", to apply to the table cell.
  *     Here's an example for $rows:
@@ -901,10 +902,6 @@ function template_preprocess_table(&$variables) {
           }
         }
 
-        if (is_array($cell_content)) {
-          $cell_content = drupal_render($cell_content);
-        }
-
         tablesort_header($cell_content, $cell, $variables['header'], $ts);
 
         // tablesort_header() removes the 'sort' and 'field' keys.
@@ -965,10 +962,6 @@ function template_preprocess_table(&$variables) {
               unset($cell['header']);
 
               $cell_attributes = $cell;
-
-              if (is_array($cell_content)) {
-                $cell_content = drupal_render($cell_content);
-              }
             }
             // Active table sort information.
             if (isset($variables['header'][$col_key]['data']) && $variables['header'][$col_key]['data'] == $ts['name'] && !empty($variables['header'][$col_key]['field'])) {
diff --git a/core/modules/system/src/Tests/Theme/TableTest.php b/core/modules/system/src/Tests/Theme/TableTest.php
index 1440c92..e65037c 100644
--- a/core/modules/system/src/Tests/Theme/TableTest.php
+++ b/core/modules/system/src/Tests/Theme/TableTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\Theme\TableTest.
+ * Contains \Drupal\system\Tests\Theme\TableTest.
  */
 
 namespace Drupal\system\Tests\Theme;
@@ -237,4 +237,75 @@ public function testThemeTableResponsivePriority() {
     $this->assertRaw('<td>6</td>', 'Cell 3: no priority classes were applied.');
   }
 
+  /**
+   * Tests header elements with a mix of string and render array values.
+   */
+  public function testThemeTableHeaderRenderArray() {
+    $header = array(
+      array (
+        'data' => array(
+          '#markup' => 'one',
+        ),
+      ),
+      'two',
+      array (
+        'data' => array(
+          '#type' => 'html_tag',
+          '#tag' => 'b',
+          '#value' => 'three',
+        ),
+      ),
+    );
+    $rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
+    $table = array(
+      '#type' => 'table',
+      '#header' => $header,
+      '#rows' => $rows,
+      '#responsive' => FALSE,
+    );
+    $this->render($table);
+    $this->removeWhiteSpace();
+    $this->assertRaw('<thead><tr><th>one</th><th>two</th><th><b>three</b></th></tr>', 'Table header found.');
+  }
+
+  /**
+   * Tests row elements with a mix of string and render array values.
+   */
+  public function testThemeTableRowRenderArray() {
+    $header = array('one', 'two', 'three');
+    $rows = array(
+      array(
+        '1-one',
+        array(
+          'data' => '1-two'
+        ),
+        '1-three',
+      ),
+      array(
+        array (
+          'data' => array(
+            '#markup' => '2-one',
+          ),
+        ),
+        '2-two',
+        array (
+          'data' => array(
+            '#type' => 'html_tag',
+            '#tag' => 'b',
+            '#value' => '2-three',
+          ),
+        ),
+      ),
+    );
+    $table = array(
+      '#type' => 'table',
+      '#header' => $header,
+      '#rows' => $rows,
+      '#responsive' => FALSE,
+    );
+    $this->render($table);
+    $this->removeWhiteSpace();
+    $this->assertRaw('<tbody><tr><td>1-one</td><td>1-two</td><td>1-three</td></tr>', 'Table row 1 found.');
+    $this->assertRaw('<tr><td>2-one</td><td>2-two</td><td><b>2-three</b></td></tr></tbody>', 'Table row 2 found.');
+  }
 }
