From a84a89fb5b9e503c41529a3b4d4bedd0c3869720 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 3 Nov 2026 17:44:45 +0600 Subject: [PATCH] rename MutationObserverInit -> MutationObserverOptions to avoid naming collisions --- CHANGELOG.md | 2 +- .../dev/inmo/micro_utils/common/HTMLElementDomChanged.kt | 2 +- .../kotlin/dev/inmo/micro_utils/common/MutationObserver.kt | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77187084e45..3676579410d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ * `SQLite`: `3.53.4.0` -> `3.54.1.0` * `Ktor`: `3.6.0` -> `3.6.1` * `Common`: - * Add JS `MutationObserverInit` factory that omits unspecified options and preserves browser defaults. + * Add JS `MutationObserverOptions` factory that omits unspecified options and preserves browser defaults. * Use safe `MutationObserver` options in `onRemoved` and cover DOM observation and outside-click cleanup with browser tests. ## 0.32.1 diff --git a/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/HTMLElementDomChanged.kt b/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/HTMLElementDomChanged.kt index eb33eb79b21..00e68211c70 100644 --- a/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/HTMLElementDomChanged.kt +++ b/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/HTMLElementDomChanged.kt @@ -19,7 +19,7 @@ fun Node.onRemoved(block: () -> Unit): MutationObserver { } } - observer.observe(document, MutationObserverInit(childList = true, subtree = true)) + observer.observe(document, MutationObserverOptions(childList = true, subtree = true)) return observer } diff --git a/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/MutationObserver.kt b/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/MutationObserver.kt index f2493a9217a..3acd8e6c0ed 100644 --- a/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/MutationObserver.kt +++ b/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/MutationObserver.kt @@ -1,7 +1,5 @@ package dev.inmo.micro_utils.common -import org.w3c.dom.MutationObserverInit as NativeMutationObserverInit - /** * Creates options for [org.w3c.dom.MutationObserver] without adding unspecified properties. * @@ -12,7 +10,7 @@ import org.w3c.dom.MutationObserverInit as NativeMutationObserverInit * Null arguments are omitted. Explicit false values and empty arrays are preserved. The browser remains responsible * for validating the options passed to [org.w3c.dom.MutationObserver.observe]. */ -fun MutationObserverInit( +fun MutationObserverOptions( childList: Boolean? = null, attributes: Boolean? = null, characterData: Boolean? = null,