ampproject / ampproject/worker-dom

[FEATURE REQUEST] Implement `ChildNode.before()` and `ChildNode.after()`

Open
#910 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.3k
Forks
154
PR merge metrics
No merged PRs in 30d

Description

In accordance with https://github.com/ampproject/worker-dom/blob/main/web_compat_table.md, I'd like to request the DOM APIs `ChildNode.before()` and `ChildNode.after()`.

# Use case

I intend to use this to lazy-load sections of a single-page website. Once a section finishes loading, it's neighboring sections (top and bottom) will be fetched, then to add them to the DOM, I intend to use `before()` or `after()` on the previous section.

Contributor guide

Open the contributing guide

Research direction

Start with web_compat_table.md and compare the requested ChildNode.before() and ChildNode.after() APIs with the project's existing DOM compatibility work. Trace the relevant TypeScript DOM implementation entry points, then verify that both methods support inserting neighboring sections as described in the use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.