-
Notifications
You must be signed in to change notification settings - Fork 250
Description
-
Repurposing a DOMElement leaves existing/previous classes/attributes/properties intact, e.g:
or as a pseudo-test (can I submit PRs just for tests? :))
var FamousEngine = require('famous/core/FamousEngine'); var DOMElement = require('famous/dom-renderables/DOMElement'); var scene = FamousEngine.createScene('body'); var clock = FamousEngine.getClock(); FamousEngine.init(); var node1 = scene.addChild(); var domElement1 = new DOMElement(node1); domElement1.addClass('myClass'); clock.setTimeout(function() { // node1.removeComponent(domElement1); scene.removeChild(node1); var node2 = scene.addChild(); var domElement2 = new DOMElement(node2); clock.setTimeout(function () { // fail/false in 0.5.2 -> 0.7, pass with PR#266 console.log('test pass:', !document.querySelector('[data-fa-path="body/0"]') .className.match(/\bmyClass\b/)); }, 17); }, 17);
Note: unnoticeable without the setTimeout.
-
Fixed in 0.6.
InDOMElement.onDismount
, we recycle the element by (amongst other things), settingdisplay: none
and leaving it attached to the DOM. But the plane is still visible on WebGL animations:at least in Chrome stable 43 and beta 44. cc: @trusktr. Confirming that.display: none
is set (you can see the contents and background color all disappear) -
Should
node.removeComponent(domElement)
do any of the stuff thatDOMElement.onDismount
does? i.e. recycle the domElement.What is the expected behaviour if we call removeComponent with and/or without removing the node too?