From 33e3489070fe020566757fb6279abe188b0b1e19 Mon Sep 17 00:00:00 2001 From: Chitoku Date: Wed, 18 Jan 2023 19:25:11 +0900 Subject: [PATCH] Fix to not strip whitespace in `th`, `td` Related-to GH-32. Closes GH-45. Reviewed-by: Titus Wormer --- lib/index.js | 2 -- test.js | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/index.js b/lib/index.js index a654c09..1162f8d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -36,8 +36,6 @@ const tableElements = new Set([ 'tbody', 'tfoot', 'tr', - 'th', - 'td' ]) /** diff --git a/test.js b/test.js index 545ad14..9ee7ea6 100644 --- a/test.js +++ b/test.js @@ -171,13 +171,16 @@ test('React ' + React.version, (t) => { t.deepEqual( processor.stringify( u('root', [ - h('table', {}, ['\n ', h('tbody', {}, ['\n ', h('tr', {})])]) + h('table', {}, ['\n ', h('tbody', {}, ['\n ', h('tr', {}, ['\n ', h('th', {}, ['\n ']), h('td', {}, ['\n '])])])]) ]) ), React.createElement('div', {}, [ React.createElement('table', {key: 'h-1'}, [ React.createElement('tbody', {key: 'h-2'}, [ - React.createElement('tr', {key: 'h-3'}, undefined) + React.createElement('tr', {key: 'h-3'}, [ + React.createElement('th', {key: 'h-4'}, ['\n ']), + React.createElement('td', {key: 'h-5'}, ['\n ']), + ]) ]) ]) ]),