Famous / engine

MIT License
1.75k stars 250 forks source link

[bug?] Moving a Node to another parent Node causes DOMElement refresh (visible blink). #472

Open trusktr opened 9 years ago

trusktr commented 9 years ago

When we move a child Node to another parent Node, the child Node's DOMElement's HTMLElement will be destroyed and a new one will be generated.

This forces us to reappend elements of other frameworks (f.e. a React component container) to the new HTMLElement of the DOMElement once it's ready.

The process of re-attaching a React component's HTMLElement container causes a visual blink as in this video: <placeholder for video>

The blink is janky. It'd be nice if a DOMElement's HTMLElement was re-used.

cc @alexanderGugel @michaelobriena

michaelobriena commented 9 years ago

@trusktr Yes this is totally the case. I would go about extending the ElementCache's to give the ability to swap with another ElementCache. That means you would have to create some sort of registry.

We will not be working on this internally.

alexanderGugel commented 9 years ago

Could be tricky to implement.

trusktr commented 8 years ago

@alexanderGugel @michaelobriena I can see why perhaps the .famous-dom-element-content div might be remade, since it's rendering a new element based on the DOMElement's content, but perhaps the .famous-dom-element can be kept?

trusktr commented 8 years ago

What about using something like Matt Esch's virtual-dom on DOMElement content to avoid remaking DOM until necessary?

alexanderGugel commented 8 years ago

@alexanderGugel @michaelobriena I can see why perhaps the .famous-dom-element-content div might be remade, since it's rendering a new element based on the DOMElement's content, but perhaps the .famous-dom-element can be kept?

It is, but its content is being set using innerHTML. That's what's causing the "blink".

What about using something like Matt Esch's virtual-dom on DOMElement content to avoid remaking DOM until necessary?

This is a much bigger feature request. While I think this something that we'll be adding sooner or later, it is not an immediate priority.