Skip to content

Commit

Permalink
Merge pull request #9 from Veve2/patch-1
Browse files Browse the repository at this point in the history
Fix the "node.getAttribute is not a function" error
  • Loading branch information
stuartlangridge committed Mar 2, 2016
2 parents 6097933 + fe50261 commit be901a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sorttable.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ sorttable = {
for (var i=0; i<table.tBodies[0].rows.length; i++) {
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
if (text != '') {
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
return sorttable.sort_numeric;
}
// check for a date: dd/mm/yyyy or dd/mm/yy
Expand Down Expand Up @@ -208,7 +208,7 @@ sorttable = {
hasInputs = (typeof node.getElementsByTagName == 'function') &&
node.getElementsByTagName('input').length;

if (node.getAttribute("sorttable_customkey") != null) {
if (node.nodeType == 1 && node.getAttribute("sorttable_customkey") != null) {
return node.getAttribute("sorttable_customkey");
}
else if (typeof node.textContent != 'undefined' && !hasInputs) {
Expand Down

0 comments on commit be901a4

Please sign in to comment.