Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 576 Bytes

prefer-node-append.md

File metadata and controls

20 lines (13 loc) · 576 Bytes

Prefer append over appendChild

Enforces the use of, for example, document.body.append(div); over document.body.appendChild(div); for DOM nodes. There are some advantages of using .append(), like the ability to append multiple nodes and to append both DOMString and DOM node objects.

This rule is fixable.

Fail

foo.appendChild(bar);

Pass

foo.append(bar);
foo.append('bar');
foo.append(bar, 'baz');