From 075d1a60987855bcfb9c43df8f24edc14e7b6c58 Mon Sep 17 00:00:00 2001 From: abe33 Date: Thu, 2 Apr 2015 16:16:27 +0200 Subject: [PATCH] :bug: Fix DOM polling requesting an update on every call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We’ll require a forced update only when the element become visible. --- lib/minimap-element.coffee | 2 +- spec/minimap-element-spec.coffee | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/minimap-element.coffee b/lib/minimap-element.coffee index a5dc2f25..d10727fa 100644 --- a/lib/minimap-element.coffee +++ b/lib/minimap-element.coffee @@ -370,7 +370,7 @@ class MinimapElement extends HTMLElement # Internal: Polling callback used to detect visibility and size changes. pollDOM: -> if @isVisible() - @requestForcedUpdate() unless !@wasVisible + @requestForcedUpdate() unless @wasVisible @measureHeightAndWidth(false) diff --git a/spec/minimap-element-spec.coffee b/spec/minimap-element-spec.coffee index 19286ae2..497270d6 100644 --- a/spec/minimap-element-spec.coffee +++ b/spec/minimap-element-spec.coffee @@ -267,6 +267,8 @@ describe 'MinimapElement', -> describe 'from hidden to visible', -> beforeEach -> + editorElement.style.display = 'none' + minimapElement.checkForVisibilityChange() spyOn(minimapElement, 'requestForcedUpdate') editorElement.style.display = '' minimapElement.pollDOM()