javascript - Is there a way to avoid browser repainting when using js function document.appendchild? -


i read document.appendchild() way move dom's elements because keep them in memory, checking browser, noticed moved elements repainting. there way avoid this? maybe not using appendchild function allow move elements without repainting them?

the best solution i've found using transform: translate, not i'm looking for, move element around on screen, not change position in dom.

in general, best approach repainting not away it, handle grace.

the ultimate goal limit changes dom as possible, seems goal.

in terms of moving element, depends upon element, want ensure few things how add element.

  1. establish destination element won't require page reflow. if can before move element, in better shape.
  2. ensure actual changes dom contained, , animations done in bulk via css whenever possible. sounds handling through translate, lower-impact since doesn't change dom.
  3. to accomplish goal of moving element new place in dom, after translate element new location, should able append copy of new location , remove old translated element without requiring pixel of page changed.

ultimately, not away page repaint, should able largely eliminate page reflows, , in process reduce repainting.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -