Skip to content

Functions that modify elements should check if nodes exist #27

@itsrachelfish

Description

@itsrachelfish

If a function modifies the DOM using a user provided element, the function should check if the element exists before cloning it. For example, append and prepend currently always clone an element before putting it on the page. This is convenient when adding an element to the page multiple times, but it can be annoying when trying to bind events.

This applies to .append(), .prepend(), .html(), and .replace()

https://developer.mozilla.org/en-US/docs/Web/API/Node/contains

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions