diff options
author | Wilson Page <wilsonpage@me.com> | 2015-03-17 11:07:25 +0000 |
---|---|---|
committer | Wilson Page <wilsonpage@me.com> | 2015-03-17 11:07:25 +0000 |
commit | 66566b5a35dc2947c2f5d628c4b15d115de5628a (patch) | |
tree | 182368f0a65c134ba62ae527567eff97e19bfca5 | |
parent | 4c2680d86330d2f8691ee09919d219672c671e76 (diff) | |
parent | 758ac8f6f0d3e87f5b03f0f8d52b29f09852272c (diff) | |
download | fastdom-66566b5a35dc2947c2f5d628c4b15d115de5628a.zip fastdom-66566b5a35dc2947c2f5d628c4b15d115de5628a.tar.gz fastdom-66566b5a35dc2947c2f5d628c4b15d115de5628a.tar.bz2 |
Merge pull request #55 from wilsonpage/issue54
Should be allowed to pass and id as a string or a number to .clear()
-rw-r--r-- | index.js | 5 | ||||
-rw-r--r-- | test/test.clear.js | 14 |
2 files changed, 18 insertions, 1 deletions
@@ -143,7 +143,7 @@ * Clears a scheduled 'read', * 'write' or 'defer' job. * - * @param {Number} id + * @param {Number|String} id * @public */ FastDom.prototype.clear = function(id) { @@ -153,6 +153,9 @@ return this.clearFrame(id); } + // Allow ids to be passed as strings + id = Number(id); + var job = this.batch.hash[id]; if (!job) return; diff --git a/test/test.clear.js b/test/test.clear.js index f0f60b1..1230b16 100644 --- a/test/test.clear.js +++ b/test/test.clear.js @@ -93,4 +93,18 @@ suite('clear', function(){ }); }); }); + + test('Should accept String ids', function(done) { + var fastdom = new FastDom(); + var read = sinon.spy(); + + var id = fastdom.read(read); + + fastdom.clear(id.toString()); + + raf(function() { + assert(!read.called); + done(); + }); + }); });
\ No newline at end of file |