summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/avoid-removeChild.rst
blob: 15ece94d0d366e92a8b4d412473a2f464c89b108 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
avoid-removeChild
=================

Rejects using ``element.parentNode.removeChild(element)`` when ``element.remove()``
can be used instead.

Examples of incorrect code for this rule:
-----------------------------------------

.. code-block:: js

    elt.parentNode.removeChild(elt);

Examples of correct code for this rule:
---------------------------------------

.. code-block:: js

		elt.remove();
		elt.parentNode.removeChild(elt2);