From 0ba19b4eed220c58bfa0a6094beda9d84d9eb681 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Mon, 24 Jun 2019 17:04:20 -0700 Subject: [PATCH] Add a dirty check to showHideChildren --- lib/elements/dom-if.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/elements/dom-if.js b/lib/elements/dom-if.js index dd54017c4a..48fdc988c6 100644 --- a/lib/elements/dom-if.js +++ b/lib/elements/dom-if.js @@ -297,11 +297,12 @@ class DomIfFast extends DomIfBase { */ _showHideChildren() { const hidden = this.__hideTemplateChildren__ || !this.if; - if (this.__instance) { + if (this.__instance && Boolean(this.__instance.__hidden) !== hidden) { + this.__instance.__hidden = hidden; showHideChildren(hidden, this.__instance.templateInfo.childNodes); - } - if (!hidden) { - this.__syncHostProperties(); + if (!hidden) { + this.__syncHostProperties(); + } } } } @@ -397,7 +398,8 @@ class DomIfLegacy extends DomIfBase { */ _showHideChildren() { const hidden = this.__hideTemplateChildren__ || !this.if; - if (this.__instance) { + if (this.__instance && Boolean(this.__instance.__hidden) !== hidden) { + this.__instance.__hidden = hidden; this.__instance._showHideChildren(hidden); if (!hidden) { this.__syncHostProperties();