diff --git a/library/HTMLPurifier/ChildDef/Table.php b/library/HTMLPurifier/ChildDef/Table.php
index 2608497a..34f0227d 100644
--- a/library/HTMLPurifier/ChildDef/Table.php
+++ b/library/HTMLPurifier/ChildDef/Table.php
@@ -110,7 +110,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
                         $collection[] = $token;
                         continue;
                     default:
-                        if ($token instanceof HTMLPurifier_Token_Text && $token->is_whitespace) {
+                        if (!empty($token->is_whitespace)) {
                             $collection[] = $token;
                             $tag_index++;
                         }
diff --git a/library/HTMLPurifier/Token/Comment.php b/library/HTMLPurifier/Token/Comment.php
index 963e0a90..dc6bdcab 100644
--- a/library/HTMLPurifier/Token/Comment.php
+++ b/library/HTMLPurifier/Token/Comment.php
@@ -6,6 +6,7 @@
 class HTMLPurifier_Token_Comment extends HTMLPurifier_Token
 {
     public $data; /**< Character data within comment. */
+    public $is_whitespace = true;
     /**
      * Transparent constructor.
      *
diff --git a/tests/HTMLPurifier/HTMLT/trusted-comments-required.htmlt b/tests/HTMLPurifier/HTMLT/trusted-comments-required.htmlt
new file mode 100644
index 00000000..2ce367bf
--- /dev/null
+++ b/tests/HTMLPurifier/HTMLT/trusted-comments-required.htmlt
@@ -0,0 +1,5 @@
+--INI--
+HTML.Trusted = true
+--HTML--
+<ul><!-- Foo --></ul>
+--EXPECT--
diff --git a/tests/HTMLPurifier/HTMLT/trusted-comments-table.htmlt b/tests/HTMLPurifier/HTMLT/trusted-comments-table.htmlt
new file mode 100644
index 00000000..085a0d02
--- /dev/null
+++ b/tests/HTMLPurifier/HTMLT/trusted-comments-table.htmlt
@@ -0,0 +1,4 @@
+--INI--
+HTML.Trusted = true
+--HTML--
+<table><!-- foo --><tr><td>Foo</td></tr></table>
diff --git a/tests/HTMLPurifier/HTMLT/trusted-comments.htmlt b/tests/HTMLPurifier/HTMLT/trusted-comments.htmlt
new file mode 100644
index 00000000..8b565774
--- /dev/null
+++ b/tests/HTMLPurifier/HTMLT/trusted-comments.htmlt
@@ -0,0 +1,4 @@
+--INI--
+HTML.Trusted = true
+--HTML--
+<!-- Foobar -->