Skip to content

HTML insertion positional methods#12528

Open
noamr wants to merge 10 commits into
whatwg:mainfrom
noamr:positional
Open

HTML insertion positional methods#12528
noamr wants to merge 10 commits into
whatwg:mainfrom
noamr:positional

Conversation

@noamr

@noamr noamr commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Add appendHTML, prependHTML, beforeHTML, afterHTML, and replaceWithHTML, alongside their *Unsafe variants.

Use 3 helper algorithms for HTML insertion (pre-insert/replace/set), and call those from the appropriate web-exposed method.

ChildNode methods fail silently when the child has no parent, like their equivalent DOM methods,
and fails with a HierarchyRequestError for an invalid parent.

Closes #10122

  • At least two implementers are interested (and none opposed):
    • Chrome
    • ?
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: Implemented
  • Corresponding HTML AAM & ARIA in HTML issues & PRs: N/A
  • MDN issue is filed: Will be done as part of Blink shipping
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


/dynamic-markup-insertion.html ( diff )

@noamr noamr changed the title Positional HTML insertion positional methods Jun 8, 2026
@noamr noamr marked this pull request as ready for review June 8, 2026 19:55
@noamr noamr marked this pull request as draft June 9, 2026 06:46
@noamr noamr marked this pull request as ready for review June 9, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Improve API of insertAdjacent*() methods

1 participant