Skip to content

Commit

Permalink
Fix the "node.getAttribute is not a function" error
Browse files Browse the repository at this point in the history
Fix #6
  • Loading branch information
Veve2 committed Mar 2, 2016
1 parent 6097933 commit fe50261
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 fe50261

Please sign in to comment.