Forráskód Böngészése

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).
Estevão Soares dos Santos 10 éve
szülő
commit
6176977558

+ 3 - 3
dist/showdown.js

@@ -1,4 +1,4 @@
-;/*! showdown 13-07-2015 */
+;/*! showdown 14-07-2015 */
 (function(){
 /**
  * Created by Tivie on 13-07-2015.
@@ -2140,7 +2140,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 + '"';
@@ -2150,7 +2150,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 + '"';

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
dist/showdown.js.map


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
dist/showdown.min.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
dist/showdown.min.js.map


+ 2 - 2
src/subParsers/tables.js

@@ -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 + '"';

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott