How to move an element into another element?

前端 未结 15 2548
無奈伤痛
無奈伤痛 2020-11-22 03:35

I would like to move one DIV element inside another. For example, I want to move this (including all children):

...
15条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 04:27

    I noticed huge memory leak & performance difference between insertAfter & after or insertBefore & before .. If you have tons of DOM elements, or you need to use after() or before() inside a MouseMove event, the browser memory will probably increase and next operations will run really slow.

    The solution I've just experienced is to use inserBefore instead before() and insertAfter instead after().

提交回复
热议问题