2 回答

TA貢獻(xiàn)1998條經(jīng)驗 獲得超6個贊
第一張圖里面使用 事件委托的方式,剛才執(zhí)行了一遍,也沒報錯,
看代碼也沒任何問題。應(yīng)該是其它地方出問題了。

TA貢獻(xiàn)1895條經(jīng)驗 獲得超3個贊
MDN上有針對removeChild上可能造成的異常有解釋:
The method throws an exception in 2 different ways:
If the child was in fact a child of element and so existing on the
DOM, but was removed the method throws the following exception:
Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
If the child doesn't exist on the DOM of the page, the method throws
the following exception:
Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.
If child was in fact a child of element at the time of the call, but was removed by an event handler invoked in the course of trying to remove the element (eg, blur.)
添加回答
舉報