From fa8b9c143a828f3c60cbbe3eaf03bc97c1aecbb7 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 10 Jan 2018 20:54:02 +1300 Subject: [PATCH 1/2] Update page history javascript so that it does not continously call element.compareDocumentPosition --- javascript/CMSPageHistoryController.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/javascript/CMSPageHistoryController.js b/javascript/CMSPageHistoryController.js index 20ee1699..cb59b128 100644 --- a/javascript/CMSPageHistoryController.js +++ b/javascript/CMSPageHistoryController.js @@ -156,10 +156,16 @@ * Function: _unselect() * * Unselects the row from the form selection. + * + * Using regular js to update the class rather than this.removeClass('active') + * because the latter causes the browser to continuously call + * element.compareDocumentPosition, causing the browser to hang for long + * periods of time, especially on pages with lots of versions (e.g. 100+) */ _unselect: function() { - this.removeClass('active'); - this.find(":input[type=checkbox]").attr("checked", false); + var tr = this.get(0); + tr.className = $.trim(tr.className.replace('active', '')); + this.find(":input[type=checkbox][checked]").attr("checked", false); }, /** From 12ee49ccbd9a1df721666a05b771cb9b3c48681f Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 11 Jan 2018 09:42:27 +1300 Subject: [PATCH 2/2] Use regex with word boundaries to replace 'active' --- javascript/CMSPageHistoryController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/CMSPageHistoryController.js b/javascript/CMSPageHistoryController.js index cb59b128..e5051250 100644 --- a/javascript/CMSPageHistoryController.js +++ b/javascript/CMSPageHistoryController.js @@ -164,7 +164,7 @@ */ _unselect: function() { var tr = this.get(0); - tr.className = $.trim(tr.className.replace('active', '')); + tr.className = $.trim(tr.className.replace(/\bactive\b/, '')); this.find(":input[type=checkbox][checked]").attr("checked", false); },