<!-- GENERATED by scripts/build-llms.mjs from llms/utility.md — do not edit this file. -->

# `lr-mutation-observer`

- **Import** `import '@aceshooting/lyra-ui/components/lr-mutation-observer.js';` (stable tag alias; registers the tag)
- **Class** `LyraMutationObserver`, also available unregistered from `@aceshooting/lyra-ui/components/utility/mutation-observer/mutation-observer.class.js`
- **Family** `components/utility/` — see `llms/index.md` for its siblings
- **Status** `stable` since `4.0.0` — see the maturity and deprecation policy in `llms/shared.md`
- **Release history** [CHANGELOG.md](../../CHANGELOG.md); family-wide breaking-change summaries: [llms-full.txt](../../llms-full.txt)
- **Deprecations** none
- **Optional peers** none
- **Themeable via** 1 part, 0 custom properties — see this component's own `@csspart`/`@cssprop` list below
- **Library-wide behavior** (events, form association, `locale`/`strings`, tokens, TS types): `llms/shared.md`

---

## `lr-mutation-observer`

Lifecycle-managed wrapper around the native `MutationObserver`. All element children in the default
slot are observed and their mutation records are emitted as a composed event; the wrapper itself
adds no layout.

**Properties:** `disabled: boolean = false` (reflected), `childList: boolean = false` (attribute
`child-list`; **changed in 8.0.0** from Lyra's former `true` default, so opt in explicitly when
needed; reflected), `attr: string | null = null` (reflected; `*` observes every attribute; otherwise a
space-separated filter), `attrOldValue: boolean = false` (`attr-old-value`), `charData: boolean =
false` (`char-data`), and `charDataOldValue: boolean = false` (`char-data-old-value`); all four
mapped attributes reflect. Lyra's
existing aliases remain and also reflect: `observeAttributes` (`attributes`; unfiltered boolean
form of `attr`, equivalent to `attr: '*'`) and `characterData` (`character-data`, equivalent to
`charData`). Plus `subtree: boolean = true`, and programmatic `attributeFilter: string[] = []`
(neither reflects).

The browser capability is optional. A missing or throwing owner-window lookup, or an unavailable or
throwing constructor, leaves that rebuild inert rather than leaking an exception. Individual
`observe` and `disconnect` failures are contained, so later valid targets and later rebuilds can still observe.
Callbacks from a retired document are ignored after disconnect or adoption. `attributeFilter` is
likewise a bounded own-data snapshot (examining at most its first 10,000 direct data entries);
malformed or accessor-backed entries are skipped, a valid prefix remains active, and an entirely
unusable value falls back to an empty filter.

**Events:** `lr-mutation`; its detail and bounded readonly record sequence are frozen.
`detail.records` and mapped `detail.mutationList` reference the same sequence, while each native
`MutationRecord` retains identity.

**Slots:** default observed elements. **CSS parts:** `base`.

---
