diff --git a/src/trix/models/html_parser.coffee b/src/trix/models/html_parser.coffee index 57b45db1d..15dd15380 100644 --- a/src/trix/models/html_parser.coffee +++ b/src/trix/models/html_parser.coffee @@ -130,10 +130,10 @@ class Trix.HTMLParser extends Trix.BasicObject @appendAttachmentWithAttributes(attributes, @getTextAttributes(element)) @processedElements.push(element) when "tr" - unless element.parentNode.firstChild is element + unless element.parentNode.firstElementChild is element @appendStringWithAttributes("\n") when "td" - unless element.parentNode.firstChild is element + unless element.parentNode.firstElementChild is element @appendStringWithAttributes(" | ") # Document construction diff --git a/test/src/unit/html_parser_test.coffee b/test/src/unit/html_parser_test.coffee index c0b3501d0..6bc21bb1c 100644 --- a/test/src/unit/html_parser_test.coffee +++ b/test/src/unit/html_parser_test.coffee @@ -147,7 +147,7 @@ testGroup "Trix.HTMLParser", -> assert.documentHTMLEqual Trix.HTMLParser.parse(html).getDocument(), expectedHTML test "translates tables into plain text", -> - html = """
a | b |
1 | 2 |
a | b |
1 | 2 |