From c890f9b6186f634ae36c609b02b220be07b68ce7 Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Tue, 24 Jul 2018 16:40:57 -0400 Subject: [PATCH 1/2] add doctype node type --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 36f4fef..b7afc86 100644 --- a/lib/index.js +++ b/lib/index.js @@ -13,7 +13,7 @@ module.exports = function ReshapeParser (input, options = {}) { if (sid) { tag += ` "${sid}"` } tag += '>' - const node = { type: 'text', content: tag } + const node = { type: 'doctype', content: tag } addLocation(node, location, options) result.push(node) From 549508a84166905f905cf867cb6732c5868ed9fa Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Tue, 24 Jul 2018 16:46:16 -0400 Subject: [PATCH 2/2] correct test --- test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.js b/test/index.js index eaf7b19..375447e 100644 --- a/test/index.js +++ b/test/index.js @@ -19,7 +19,7 @@ test('head/body', t => { const str = '

hi!

' const out = parser(str) - t.truthy(out[0].type === 'text') + t.truthy(out[0].type === 'doctype') t.truthy(out[0].content.match(/!DOCTYPE/)) t.truthy(out[1].name === 'html') t.truthy(out[1].content[0].name === 'head')