kkoyung · GitHub

The **built-in non-replaceable elements list** can be treated as static
read-only data. We can wrap it in static `LazyCell` to initialize it
lazily on first use, and reuse the same instance on subsequent accesses,
instead of creating a new instance on every access.
The elements contain `DOMString`, which is not thread-safe, so the
static `LazyCell` needs to be wrapped in a `thread_local!` block.
Testing: Refactoring. Covered by existing WPT tests in `sanitizer-api`.
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>

@kkoyung

TimvdLippe

@TimvdLippe

@kkoyung

kkoyung deleted the sanitizer-static-non-replaceable branch

May 31, 2026 09:24

Read the original on github.com ↗