unicorn/prefer-dom-node-remove 学究
功能
更喜欢使用 child.remove() 而不是 parentNode.removeChild(child)。
为什么这么糟糕?
DOM 函数 Node#remove() 比使用 Node#removeChild() 间接移除对象更常用。
示例
此规则中错误代码的示例
javascript
parentNode.removeChild(childNode);此规则中正确代码的示例
javascript
childNode.remove();