Skip to content

Commit

Permalink
invoke formatter always with instance's context
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbbottam committed Oct 5, 2015
1 parent e7089c2 commit afddebb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/auto-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function formatter(targetNode, separator, separatorIndex, separatorPattern, maxL
}
}

if (this && this.hasMaxLength) {
if (this.hasMaxLength) {
targetNode.value = expectedValueArray.slice(0, maxLength).join('');
} else {
targetNode.value = expectedValueArray.join('');
Expand Down Expand Up @@ -148,7 +148,7 @@ AutoFormatter.prototype.enableFormatting = function(e) {
this.formatter = formatter.bind(this, targetNode, separator, separatorIndex, separatorPattern, format.length);
targetNode.addEventListener('keyup', this.formatter);
if(value !== '') {
formatter(targetNode, separator, separatorIndex, separatorPattern, format.length, e || {});
formatter.bind(this)(targetNode, separator, separatorIndex, separatorPattern, format.length, e || {});
}
}
};
Expand Down

0 comments on commit afddebb

Please sign in to comment.