DOMElement.onShow should not update display property to block when its node.isShown() is false
panarch opened this issue · comments
Taehoon Moon commented
Here's an example to test.
- Add parent node and two child nodes(child1, child2)
- Run child1.hide()
- Run parent node.hide()
- Run parent node.show()
In this case, child1(red) should not be displayed, but it does.
There might be two possible ways to fix this,
- Modify DOMElement.onShow not to change property when its Node.isShown() is false
- Modify Dispatch.show to ignore nodes which Node.isShown() is false
I think although Node.isShown() is false, Node would be better to get onShow events from Dispatch.
So I chose the first one to fix this.
How do you think?
'use strict';
// Famous dependencies
var DOMElement = require('famous/dom-renderables/DOMElement');
var FamousEngine = require('famous/core/FamousEngine');
FamousEngine.init();
var node = FamousEngine.createScene().addChild();
var child1 = node.addChild();
var child2 = node.addChild();
child1.el = new DOMElement(child1, {
tagName: 'div',
properties: {
'background-color': 'red'
}
});
child2.el = new DOMElement(child2, {
tagName: 'div',
properties: {
'background-color': 'blue'
}
});
child1
.setSizeMode('absolute', 'absolute')
.setAbsoluteSize(100, 100)
.setAlign(0.5, 0.5)
.setMountPoint(0.5, 0.5)
.setPosition(-50, 0);
child2
.setSizeMode('absolute', 'absolute')
.setAbsoluteSize(100, 100)
.setAlign(0.5, 0.5)
.setMountPoint(0.5, 0.5)
.setPosition(50, 0);
child1.hide();
node.hide();
node.show();
/*
* child1(red) should not be shown
*/