Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions that modify elements should check if nodes exist #27

Open
itsrachelfish opened this issue Aug 24, 2015 · 1 comment
Open

Functions that modify elements should check if nodes exist #27

itsrachelfish opened this issue Aug 24, 2015 · 1 comment

Comments

@itsrachelfish
Copy link
Member

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

@itsrachelfish
Copy link
Member Author

👍 this just tripped me up again in a new project, it's pretty annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant