@dnd-kit/dom 0.1.5 → 0.1.6-beta-20250501000355
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +21 -7
- package/index.cjs.map +1 -1
- package/index.js +21 -7
- package/index.js.map +1 -1
- package/package.json +5 -5
package/index.cjs
CHANGED
|
@@ -581,12 +581,21 @@ render_fn = function() {
|
|
|
581
581
|
let documentMutationObserver;
|
|
582
582
|
if (placeholder) {
|
|
583
583
|
resizeObserver.observe(placeholder);
|
|
584
|
-
elementMutationObserver = new MutationObserver(() => {
|
|
585
|
-
|
|
586
|
-
|
|
584
|
+
elementMutationObserver = new MutationObserver((mutations) => {
|
|
585
|
+
let hasChildrenMutations = false;
|
|
586
|
+
for (const mutation of mutations) {
|
|
587
|
+
if (mutation.target !== element) {
|
|
588
|
+
hasChildrenMutations = true;
|
|
587
589
|
continue;
|
|
588
590
|
}
|
|
589
|
-
if (
|
|
591
|
+
if (mutation.type !== "attributes") {
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
const attributeName = mutation.attributeName;
|
|
595
|
+
if (attributeName.startsWith("aria-") || IGNORED_ATTRIBUTES.includes(attributeName)) {
|
|
596
|
+
continue;
|
|
597
|
+
}
|
|
598
|
+
if (attributeName === "style") {
|
|
590
599
|
if (utilities.supportsStyle(element) && utilities.supportsStyle(placeholder)) {
|
|
591
600
|
for (const key of Object.values(element.style)) {
|
|
592
601
|
if (key.startsWith(CSS_PREFIX) || IGNORED_STYLES.includes(key)) {
|
|
@@ -598,11 +607,16 @@ render_fn = function() {
|
|
|
598
607
|
);
|
|
599
608
|
}
|
|
600
609
|
}
|
|
601
|
-
|
|
610
|
+
} else {
|
|
611
|
+
const attributeValue = element.getAttribute(attributeName);
|
|
612
|
+
if (attributeValue !== null) {
|
|
613
|
+
placeholder.setAttribute(attributeName, attributeValue);
|
|
614
|
+
} else {
|
|
615
|
+
placeholder.removeAttribute(attributeName);
|
|
616
|
+
}
|
|
602
617
|
}
|
|
603
|
-
placeholder.setAttribute(attribute.name, attribute.value);
|
|
604
618
|
}
|
|
605
|
-
if (clone) {
|
|
619
|
+
if (hasChildrenMutations && clone) {
|
|
606
620
|
placeholder.innerHTML = element.innerHTML;
|
|
607
621
|
}
|
|
608
622
|
});
|