Why can I not remove a child element I've just found? NOT_FOUND_ERR

后端 未结 4 1604
滥情空心
滥情空心 2021-01-07 20:20

I\'m building a script which has to patch XML files, including replacing one list of elements with another. The following function applies a patch (involving a possibly empt

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-07 20:50

    This is because when you are doing parent.removeChild(node), parent is not necessarily the parent of the node because getElementsByTagName() is doing a recursive search.

提交回复
热议问题