← Back to release summary

DOM Parts

Category
Miscellaneous
Type
New or changed feature
Status
In development (Chrome In development)
Intent stage
None

Summary

In many applications and frameworks, JavaScript code needs to locate and mutate a set of "nodes of interest." The current methodology for finding "nodes of interest" is either a full DOM tree walk or DOM queries, and for updating either that walk is repeated or the "nodes of interest" are then retained in JavaScript data structures or as properties on the DOM objects. There are two major drawbacks to these solutions: 1. DOM mutating methods like clone() are not aware of in-memory references to cloned nodes or special JavaScript properties. They can only clone the HTML content itself. 2. The DOM walks for locating nodes often occur immediately after the browser has already performed that same DOM walk, for example during HTML rendering of the document or <template> nodes. The DOM Parts API is intended to assist in locating, storing, and updating these nodes with new primitives that identify nodes and ranges of nodes at parse time and an imperative API to retrieve, walk, and update these nodes.

Motivation

See the overall description of the feature for the general motivation. The perceived benefits of such an API are enhanced speed and reduced JS code size for framework code.

Standards & signals

Ecosystem

Explainers: https://github.com/tbondwilkinson/dom-parts#readme

View on chromestatus.com