HighlightRegistry: size property

Baseline 2025
Newly available

Since June 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

The size property returns the number of Highlight objects in the HighlightRegistry.

Value

A read-only integer indicating how many Highlight objects the registry contains.

Examples

Using size

js
const highlight1 = new Highlight();
const highlight2 = new Highlight();

CSS.highlights.set("highlight-1", highlight1);
CSS.highlights.set("highlight-2", highlight2);

console.log(CSS.highlights.size); // 2

Specifications

Specification
ECMAScript® 2026 Language Specification
# sec-get-map.prototype.size

Browser compatibility

See also