- From: Noam Rosenthal <notifications@github.com>
- Date: Tue, 03 Nov 2026 03:40:05 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/1518@github.com>
Add active template mutation records
Add an `activeTemplateAttributeFilter` member to `MutationObserverInit`, and `activeTemplateStatus` and `activeTemplateAttributes` attributes to `MutationRecord`. This lets observers identify the mutations that the HTML parser makes on behalf of a `template` element with a `for` attribute, including records with no added or removed nodes that mark the start and end of an update.
The insert, remove, and queue a tree mutation record algorithms gain optional activeTemplate and activeTemplateStatus parameters for HTML to pass.
`childList` no longer defaults to false, so that it can be implied when `activeTemplateAttributeFilter` is given.
Tests: https://github.com/web-platform-tests/wpt/pull/64641.
Helps with https://github.com/whatwg/html/issues/13008.
---
The HTML side is whatwg/html#13181. The two PRs need to land together.
I drafted this PR, the HTML PR, and the tests with an AI coding agent (Gemini in Antigravity), based on the proposed design in whatwg/html#13008 and the [explainer](https://github.com/WICG/declarative-partial-updates/blob/main/template-mutation-observer-explainer.md). I made the judgement calls: explicit optional parameters on insert, remove, and queue a tree mutation record; implying `childList` when the filter is given and throwing a `TypeError` when `childList` is explicitly false; and caching the attributes object per observer and per active template, so all records for one `<template for>` share an object that can be used as a `WeakMap` key.
- [ ] At least two implementers are interested (and none opposed):
* …
* …
- [x] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
* https://github.com/web-platform-tests/wpt/pull/64641
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
* Chromium: …
* Gecko: …
* WebKit: …
- [ ] [MDN issue](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) is filed: …
- [x] The top of this comment includes a [clear commit message](https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use.
(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)
You can view, comment on, or merge this pull request online at:
https://github.com/whatwg/dom/pull/1518
-- Commit Summary --
* Add active template mutation records
-- File Changes --
M dom.bs (181)
-- Patch Links --
https://github.com/whatwg/dom/pull/1518.patch
https://github.com/whatwg/dom/pull/1518.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1518
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/pull/1518@github.com>
Received on Tuesday, 3 November 2026 11:40:09 UTC