From b8aa60cdabca1dfef241e7f389f421cb7eddd291 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Mon, 1 Feb 2016 21:22:55 +0000 Subject: [PATCH] Text-slicer: Fix bug with nodes without a classname --- plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js | 2 +- plugins/tiddlywiki/text-slicer/modules/slicers/definition.js | 2 +- plugins/tiddlywiki/text-slicer/modules/slicers/heading.js | 2 +- plugins/tiddlywiki/text-slicer/modules/slicers/item.js | 2 +- plugins/tiddlywiki/text-slicer/modules/slicers/list.js | 2 +- plugins/tiddlywiki/text-slicer/modules/slicers/paragraph.js | 2 +- plugins/tiddlywiki/text-slicer/modules/slicers/term.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js b/plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js index bfcdce28e..2f471b78e 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js @@ -17,7 +17,7 @@ exports.processDefListNode = function(domNode,tagName) { var title = this.makeUniqueTitle("def-list-" + tagName), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/definition.js b/plugins/tiddlywiki/text-slicer/modules/slicers/definition.js index dc4d064c6..a5bcc695f 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/definition.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/definition.js @@ -19,7 +19,7 @@ exports.processDefinitionNode = function(domNode,tagName) { var title = this.makeUniqueTitle("definition",text), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/heading.js b/plugins/tiddlywiki/text-slicer/modules/slicers/heading.js index cdc9ff1c5..c263c1074 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/heading.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/heading.js @@ -18,7 +18,7 @@ exports.processHeadingNode = function(domNode,tagName) { var title = this.makeUniqueTitle("heading",text), parentTitle = this.popParentStackUntil(tagName), tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/item.js b/plugins/tiddlywiki/text-slicer/modules/slicers/item.js index e8c772310..b4a3dd201 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/item.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/item.js @@ -19,7 +19,7 @@ exports.processListItemNode = function(domNode,tagName) { var title = this.makeUniqueTitle("list-item",text), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/list.js b/plugins/tiddlywiki/text-slicer/modules/slicers/list.js index 1e203b772..53b1c62f9 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/list.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/list.js @@ -17,7 +17,7 @@ exports.processListNode = function(domNode,tagName) { var title = this.makeUniqueTitle("list-" + tagName), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/paragraph.js b/plugins/tiddlywiki/text-slicer/modules/slicers/paragraph.js index db28ad902..e5a2b088e 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/paragraph.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/paragraph.js @@ -19,7 +19,7 @@ exports.processParagraphNode = function(domNode,tagName) { var parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = [], title = this.makeUniqueTitle("paragraph",text); - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,this.addTiddler({ diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/term.js b/plugins/tiddlywiki/text-slicer/modules/slicers/term.js index d72875e18..6ee16dde3 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/term.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/term.js @@ -19,7 +19,7 @@ exports.processTermNode = function(domNode,tagName) { var title = this.makeUniqueTitle("term",text), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title);