From 2b33b6b298c0e964d6ee954b0773040eaf81fac7 Mon Sep 17 00:00:00 2001 From: Taehoon Moon Date: Sun, 16 Aug 2015 19:44:14 +0000 Subject: [PATCH] fix: Fix DOMElement#onShow, Node#show, hide (#470) DOMElement.onShow should not update display property to block when its node.isShown() is false --- core/Node.js | 4 ++-- dom-renderables/DOMElement.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/Node.js b/core/Node.js index ec995513..a3411ba2 100644 --- a/core/Node.js +++ b/core/Node.js @@ -922,8 +922,8 @@ Node.prototype._vecOptionalSet = function _vecOptionalSet (vec, index, val) { * @return {Node} this */ Node.prototype.show = function show () { - Dispatch.show(this.getLocation()); this._shown = true; + Dispatch.show(this.getLocation()); return this; }; @@ -937,8 +937,8 @@ Node.prototype.show = function show () { * @return {Node} this */ Node.prototype.hide = function hide () { - Dispatch.hide(this.getLocation()); this._shown = false; + Dispatch.hide(this.getLocation()); return this; }; diff --git a/dom-renderables/DOMElement.js b/dom-renderables/DOMElement.js index 09ba6624..ab58dc5a 100644 --- a/dom-renderables/DOMElement.js +++ b/dom-renderables/DOMElement.js @@ -204,7 +204,7 @@ DOMElement.prototype.onDismount = function onDismount() { * @return {undefined} undefined */ DOMElement.prototype.onShow = function onShow() { - this.setProperty('display', 'block'); + if (this._node.isShown()) this.setProperty('display', 'block'); }; /**