Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 957 Bytes

File metadata and controls

20 lines (13 loc) · 957 Bytes

Prefer Node#append() over Node#appendChild()

💼 This rule is enabled in the following configs: ✅ recommended, ☑️ unopinionated.

🔧 This rule is automatically fixable by the --fix CLI option.

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

Examples

// ❌
foo.appendChild(bar);

// ✅
foo.append(bar);