From db5b797778922d50919364399c90411dfdfb712a Mon Sep 17 00:00:00 2001 From: Jason Skomorowski Date: Thu, 3 Mar 2011 07:52:22 +0100 Subject: [PATCH] mkdru.removeLimits() no longer leaves dangling limit_subject --- mkdru.client.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mkdru.client.js b/mkdru.client.js index f6188ea..5c2d0d0 100644 --- a/mkdru.client.js +++ b/mkdru.client.js @@ -272,7 +272,8 @@ mkdru.addLimit = function (facet, limit) { mkdru.removeLimit = function (facet, limit) { var newHash = $.deparam.fragment(); delete newHash['page']; - if (!newHash['limit_' + facet].indexOf(';') || !mkdru.facets[facet].multiLimit) { + if (!newHash['limit_' + facet].indexOf(';') + || !mkdru.facets[facet].multiLimit) { delete newHash['limit_' + facet]; } else { @@ -280,7 +281,10 @@ mkdru.removeLimit = function (facet, limit) { for (var i = 0; i < limits.length; i++) { if (limits[i] == limit) { limits.splice(i, 1); - newHash['limit_' + facet] = limits.join(';'); + if (limits.length < 1) + delete newHash['limit_' + facet]; + else + newHash['limit_' + facet] = limits.join(';'); break; } } -- 1.7.10.4