w3c / w3c/DOM-Parsing

insertAdjacentHTML should return a NodeList

Open
#63 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
HTML
Stars
28
Forks
14
Avg merge
3h 10m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the insertAdjacentHTML and insertAdjacentElement specifications referenced in the issue, then review the DOM Parsing repository's current specification entry points. Done means the standards discussion reaches a documented decision about whether insertAdjacentHTML should return a value and what that value should be.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.