3 ms·
Document fragments are like transactions for the DOM. Alternatively you could just learn which Dom operations force a layout shift and batch those.
by thomasikzelf 4y ago
Document fragments are like transactions for the DOM. Alternatively you could just learn which Dom operations force a layout shift and batch those.
- overgard 4y agoYou are correct, but if you think about it, you're talking about parsing and tokenizing before the operation can even occur. That's really heavy. I think it could be better than reading .innerHTML
- masklinn 4y ago> Document fragments are like transactions for the DOM. About the same way innerHTML is which is completely unhelpful: during reconciliation you need to copy, update, and reset the subtree which contains all the update points, which is almost certainly a lot more than you need. You also likely need to reconcile document state (e.g. focus) by hand.