Skip to content

Instantly share code, notes, and snippets.

@foolip
Last active January 19, 2026 09:47
Show Gist options
  • Select an option

  • Save foolip/c42120202c57c3e5f710951246190273 to your computer and use it in GitHub Desktop.

Select an option

Save foolip/c42120202c57c3e5f710951246190273 to your computer and use it in GitHub Desktop.

Given this HTML:

<div sink=container>
  before
  <!start>
  between
  <!end>
  after
</div>

The parsed result would have 3 child text nodes. The API would behave like:

  • div.beforeSinkStart is the "before" text node
  • div.afterSinkEnd is the "end" text node
  • div.getSinkRange() (if it exists) would return a range spanning just the "between" text node

Serializing would have to add <!start> and <!end> between the appropriate text nodes.

If there's anything that automaticaly merges text nodes (like div.normalize()) we might also need to prevent that.

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