From 0e727ae890d80dc127f2808648c776484b60059b Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sat, 12 May 2018 07:39:29 -0600 Subject: [PATCH] Hide attribution control if there are no attributions --- src/ol/control/Attribution.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ol/control/Attribution.js b/src/ol/control/Attribution.js index e4aac2b217..7d00eea388 100644 --- a/src/ol/control/Attribution.js +++ b/src/ol/control/Attribution.js @@ -231,6 +231,13 @@ Attribution.prototype.updateElement_ = function(frameState) { } const attributions = this.getSourceAttributions_(frameState); + + const visible = attributions.length > 0; + if (this.renderedVisible_ != visible) { + this.element.style.display = visible ? '' : 'none'; + this.renderedVisible_ = visible; + } + if (equals(attributions, this.renderedAttributions_)) { return; } @@ -244,13 +251,6 @@ Attribution.prototype.updateElement_ = function(frameState) { this.ulElement_.appendChild(element); } - - const visible = attributions.length > 0; - if (this.renderedVisible_ != visible) { - this.element.style.display = visible ? '' : 'none'; - this.renderedVisible_ = visible; - } - this.renderedAttributions_ = attributions; };