From 8c431780e88e3ed46b9162424a9797681c7b6e57 Mon Sep 17 00:00:00 2001 From: Jimmy Yuen Ho Wong Date: Sat, 2 Nov 2013 22:20:36 +0800 Subject: [PATCH] Fix #108 set comparator to null explicitly to prevent inadventent reference to the comparators defined on the prototype --- lib/backbone-pageable.js | 4 ++-- test/client-pageable.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/backbone-pageable.js b/lib/backbone-pageable.js index ebfc829..d0ec618 100644 --- a/lib/backbone-pageable.js +++ b/lib/backbone-pageable.js @@ -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; } diff --git a/test/client-pageable.js b/test/client-pageable.js index 6f6d7ac..57c2ca8 100644 --- a/test/client-pageable.js +++ b/test/client-pageable.js @@ -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");