tablesorter default 'simple' extractor
current simple textExtraction looks as follows:
if(node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
t = node.childNodes[0].innerHTML;
} else {
t = node.innerHTML;
}
From my experience on FF most of the time first child is something like:
<TextNode textContent="\n ">
As such simple text extractor most of the time falls through else clause.
Wouldn't it make more sense to filter out whitespace text nodes?
var nonWhitespaceChild = findNonWhitespaceChild(node);
var nonWhitespaceChild2 = nonWhitespaceChild && findNonWhitespaceChild(nonWhitespaceChild);
if (nonWhitespaceChild2) {
t = nonWhitespaceChild2.innerHTML || nonWhitespaceChild2.wholeText;
} else if (nonWhitespaceChild) {
t = nonWhitespaceChild.innerHTML || nonWhitespaceChild.wholeText;
}
if (!t) {
t = node.innerHTML;
}
I understand it can be handled with custom parser, but thought I'll throw it out there.