Skip to content
This repository has been archived by the owner on May 17, 2018. It is now read-only.

Commit

Permalink
Fix #108 set comparator to null explicitly to prevent inadventent ref…
Browse files Browse the repository at this point in the history
…erence to the comparators defined on the prototype
  • Loading branch information
wyuenho committed Nov 2, 2013
1 parent b844a60 commit 8c43178
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/backbone-pageable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,8 @@
this.comparator = comparator;
}

if (delComp) delete this.comparator;
if (delFullComp && fullCollection) delete fullCollection.comparator;
if (delComp) this.comparator = null;
if (delFullComp && fullCollection) fullCollection.comparator = null;

return this;
}
Expand Down
4 changes: 2 additions & 2 deletions test/client-pageable.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ $(document).ready(function () {
});

strictEqual(col.state.totalRecords, 3);
ok(!_.isUndefined(col.fullCollection.comparator));
ok(_.isUndefined(col.comparator));
ok(col.fullCollection.comparator);
ok(!col.comparator);

strictEqual(col.size(), 2);
strictEqual(col.at(0).get("name"), "a");
Expand Down

0 comments on commit 8c43178

Please sign in to comment.