diff --git a/core/modules/filter/filter.filter_html.admin.js b/core/modules/filter/filter.filter_html.admin.js
index 7ddca90bba..5221fafe06 100644
--- a/core/modules/filter/filter.filter_html.admin.js
+++ b/core/modules/filter/filter.filter_html.admin.js
@@ -236,12 +236,31 @@
       var attributes;
       var attribute;
       var allowedTags = setting.match(/(<[^>]+>)/g);
+      var currentTag;
       var sandbox = document.createElement('div');
       var rules = {};
       for (var t = 0; t < allowedTags.length; t++) {
         // Let the browser do the parsing work for us.
-        sandbox.innerHTML = allowedTags[t];
-        node = sandbox.firstChild;
+        currentTag = allowedTags[t];
+        // Table tags need to be wrapped in a <table>.
+        if (['<caption>', '<tbody>', '<thead>', '<tfoot>', '<th>', '<td>', '<tr>'].indexOf(currentTag) === -1) {
+          sandbox.innerHTML = currentTag;
+          node = sandbox.firstChild;
+        }
+        else {
+          sandbox.innerHTML = '<table>' + currentTag;
+          switch (currentTag) {
+            case '<th>':
+            case '<td>':
+              node = sandbox.firstChild.firstChild.firstChild.firstChild;
+              break;
+            case '<tr>':
+              node = sandbox.firstChild.firstChild.firstChild;
+              break;
+            default:
+              node = sandbox.firstChild.firstChild;
+          }
+        }
         tag = node.tagName.toLowerCase();
 
         // Build the Drupal.FilterHtmlRule object.
