Opened 13 years ago

Closed 12 years ago

#945 closed enhancement (wontfix)

dojo.dom.moveChildren might benefit from ...

Reported by: ken.papa@… Owned by: anonymous
Priority: lowest Milestone: 0.9
Component: Core Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

dojo.dom.moveChildren might benefit from appending all childnodes to a new document fragment and then appending that fragment to destNode in one operation instead of calling destNode.appendChild for each node to be moved

Change History (5)

comment:1 Changed 13 years ago by bill

Why? Is performance better that way?

comment:2 Changed 13 years ago by ken.papa

Version: 0.20.3

Yes, this is a performance tip that I picked up in Professional Javascript for Web Developers by WROX, page 177.

"As soon as you add nodes to document.body (or one of its ancestors), the page is updated to reflect the changes. This is fine for a small number of changes ...

However, when a large amount of data has to be added to the document, it can be a very slow process if it adds changes one-by-one.

To correct this situation, you can create a document fragment to which you attach all new nodes, and then add the contents of the document fragment to the document.

comment:3 Changed 13 years ago by dylan

Milestone: 0.5

comment:4 Changed 12 years ago by alex

so even if it does perform better, it's not clear that we can append the children of one node to another without the same iteration. Removing the node(s) from the rendering tree prior to addition might help (remove the new parent, plop elements into it, and then re-populate the tree w/ the new parent at the right position), but we'll have to judge this against the potential for "flicker".

comment:5 Changed 12 years ago by Adam Peller

Resolution: wontfix
Status: newclosed

moveChildren wasn't ported anyway. closing.

Note: See TracTickets for help on using tickets.