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

insertAdjacentHTML should return a NodeList #63

Open
alystair opened this issue Aug 2, 2020 · 0 comments
Open

insertAdjacentHTML should return a NodeList #63

alystair opened this issue Aug 2, 2020 · 0 comments

Comments

@alystair
Copy link

alystair commented Aug 2, 2020

I was referred here by annevk as WHATWG deals with insertAdjacentElement() spec, whilst w3c manages insertAdjacentHTML() spec - a bit confusing to a newcomer :)

At the moment of writing insertAdjacentElement() returns the resulting element, yet insertAdjacentHTML() doesn't have a return value. In my mind it should return a NodeList if successful. Has this been discussed in the past? Having a return (NodeList or otherwise) removes the need to do a querySelector/querySelectorAll/getElementByID after insertion - making it cleaner to use.

It makes more sense to me than the insertAdjacentElement() use case, where you already have a pre-existing reference to the attached element - however insertAdjacentHTML() starts from scratch, necessitating the lookup after insertion if you want to reference it later.

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

No branches or pull requests

1 participant