mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(subParser/tables): fix undefined error in malformed tables
Cannot read property 'trim' of undefined happens when the parser is fed a malformed table. This happens in live previews (for instance, when using Angularjs).
This commit is contained in:
parent
c013e7577c
commit
6176977558
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -15,7 +15,7 @@ showdown.subParser('tables', function (text, options, globals) {
|
|||
if (options.tableHeaderId) {
|
||||
id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
|
||||
}
|
||||
if (style.trim() === '') {
|
||||
if (!style || style.trim() === '') {
|
||||
style = '';
|
||||
} else {
|
||||
style = ' style="' + style + '"';
|
||||
|
@ -25,7 +25,7 @@ showdown.subParser('tables', function (text, options, globals) {
|
|||
|
||||
tables.td = function (cell, style) {
|
||||
var subText = showdown.subParser('spanGamut')(cell.trim(), options, globals);
|
||||
if (style.trim() === '') {
|
||||
if (!style || style.trim() === '') {
|
||||
style = '';
|
||||
} else {
|
||||
style = ' style="' + style + '"';
|
||||
|
|
Loading…
Reference in New Issue
Block a user