Recently I watched a video by Nicholas Zakas about high-performance scenarios. This is a question about re-melting and repainting. he says that it’s bad to constantly re-melt, which moves and changes the layout, changes the size, etc.
I answered the question about switching from one div to another - what I did to “spill” overflowing content to another div:
- measure the height of the inner and outer container (I am currently using jQuery.height ())
- check that the internal value is greater than the external
- if less (no spill), end script
- if larger (spill), enter the last character in the inner container and add the following div
- return the text to the inner container (calling for payment - recalculating the height)
- return to step 1
The problem is that I delete and add characters and measure the height of the spilled container for the “symbol popped out” of the container. this is re-rendering and iteration, which makes it very slow at times.
Is there a way to use the JS copy of the DOM for control, height checking, etc.? what I'm looking for is like cloning a page. I heard about DOM fragments, but this is just a container for nodes before putting them in the DOM.
Joseph
source share