Add check in splitCells to prevent calling trim on undefined (#2372)
This commit is contained in:
parent
83753142a1
commit
ed66bf8abd
@ -162,7 +162,7 @@ export function splitCells(tableRow, count) {
|
||||
|
||||
// First/last cell in a row cannot be empty if it has no leading/trailing pipe
|
||||
if (!cells[0].trim()) { cells.shift(); }
|
||||
if (!cells[cells.length - 1].trim()) { cells.pop(); }
|
||||
if (cells.length > 0 && !cells[cells.length - 1].trim()) { cells.pop(); }
|
||||
|
||||
if (cells.length > count) {
|
||||
cells.splice(count);
|
||||
|
22
test/specs/new/nbsp_following_tables.html
Normal file
22
test/specs/new/nbsp_following_tables.html
Normal file
@ -0,0 +1,22 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>abc</th>
|
||||
<th>def</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>bar</td>
|
||||
<td>foo</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>baz</td>
|
||||
<td>boo</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
5
test/specs/new/nbsp_following_tables.md
Normal file
5
test/specs/new/nbsp_following_tables.md
Normal file
@ -0,0 +1,5 @@
|
||||
| abc | def |
|
||||
| --- | --- |
|
||||
| bar | foo |
|
||||
| baz | boo |
|
||||
|
Loading…
x
Reference in New Issue
Block a user