1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-12 10:20:26 +00:00

Text-slicer: Fix bug with nodes without a classname

This commit is contained in:
Jermolene 2016-02-01 21:22:55 +00:00
parent 3a10bfe0de
commit b8aa60cdab
7 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@ exports.processDefListNode = function(domNode,tagName) {
var title = this.makeUniqueTitle("def-list-" + tagName), var title = this.makeUniqueTitle("def-list-" + tagName),
parentTitle = this.parentStack[this.parentStack.length - 1].title, parentTitle = this.parentStack[this.parentStack.length - 1].title,
tags = []; tags = [];
if(domNode.className.trim() !== "") { if(domNode.className && domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,title); this.addToList(parentTitle,title);

View File

@ -19,7 +19,7 @@ exports.processDefinitionNode = function(domNode,tagName) {
var title = this.makeUniqueTitle("definition",text), var title = this.makeUniqueTitle("definition",text),
parentTitle = this.parentStack[this.parentStack.length - 1].title, parentTitle = this.parentStack[this.parentStack.length - 1].title,
tags = []; tags = [];
if(domNode.className.trim() !== "") { if(domNode.className && domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,title); this.addToList(parentTitle,title);

View File

@ -18,7 +18,7 @@ exports.processHeadingNode = function(domNode,tagName) {
var title = this.makeUniqueTitle("heading",text), var title = this.makeUniqueTitle("heading",text),
parentTitle = this.popParentStackUntil(tagName), parentTitle = this.popParentStackUntil(tagName),
tags = []; tags = [];
if(domNode.className.trim() !== "") { if(domNode.className && domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,title); this.addToList(parentTitle,title);

View File

@ -19,7 +19,7 @@ exports.processListItemNode = function(domNode,tagName) {
var title = this.makeUniqueTitle("list-item",text), var title = this.makeUniqueTitle("list-item",text),
parentTitle = this.parentStack[this.parentStack.length - 1].title, parentTitle = this.parentStack[this.parentStack.length - 1].title,
tags = []; tags = [];
if(domNode.className.trim() !== "") { if(domNode.className && domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,title); this.addToList(parentTitle,title);

View File

@ -17,7 +17,7 @@ exports.processListNode = function(domNode,tagName) {
var title = this.makeUniqueTitle("list-" + tagName), var title = this.makeUniqueTitle("list-" + tagName),
parentTitle = this.parentStack[this.parentStack.length - 1].title, parentTitle = this.parentStack[this.parentStack.length - 1].title,
tags = []; tags = [];
if(domNode.className.trim() !== "") { if(domNode.className && domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,title); this.addToList(parentTitle,title);

View File

@ -19,7 +19,7 @@ exports.processParagraphNode = function(domNode,tagName) {
var parentTitle = this.parentStack[this.parentStack.length - 1].title, var parentTitle = this.parentStack[this.parentStack.length - 1].title,
tags = [], tags = [],
title = this.makeUniqueTitle("paragraph",text); title = this.makeUniqueTitle("paragraph",text);
if(domNode.className.trim() !== "") { if(domNode.className && domNode.className && domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,this.addTiddler({ this.addToList(parentTitle,this.addTiddler({

View File

@ -19,7 +19,7 @@ exports.processTermNode = function(domNode,tagName) {
var title = this.makeUniqueTitle("term",text), var title = this.makeUniqueTitle("term",text),
parentTitle = this.parentStack[this.parentStack.length - 1].title, parentTitle = this.parentStack[this.parentStack.length - 1].title,
tags = []; tags = [];
if(domNode.className.trim() !== "") { if(domNode.className && domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,title); this.addToList(parentTitle,title);