mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-18 22:20:36 +03:00
fix domobserver bug
This commit is contained in:
@@ -222,8 +222,13 @@ export const createDOMObserver = <ContentObserver extends boolean>(
|
|||||||
contentChanged = contentChanged || contentFinalChanged;
|
contentChanged = contentChanged || contentFinalChanged;
|
||||||
childListChanged = childListChanged || isChildListType;
|
childListChanged = childListChanged || isChildListType;
|
||||||
}
|
}
|
||||||
// else if is target observer and target attr changed
|
// if is target observer and target attr changed
|
||||||
else if (attributeChanged && !ignoreTargetChange(mutationTarget, attributeName!, oldValue, attributeValue as string | null)) {
|
if (
|
||||||
|
!isContentObserver &&
|
||||||
|
targetIsMutationTarget &&
|
||||||
|
attributeChanged &&
|
||||||
|
!ignoreTargetChange(mutationTarget, attributeName!, oldValue, attributeValue as string | null)
|
||||||
|
) {
|
||||||
push(targetChangedAttrs, attributeName!);
|
push(targetChangedAttrs, attributeName!);
|
||||||
targetStyleChanged = targetStyleChanged || styleChangingAttrChanged;
|
targetStyleChanged = targetStyleChanged || styleChangingAttrChanged;
|
||||||
}
|
}
|
||||||
@@ -239,8 +244,8 @@ export const createDOMObserver = <ContentObserver extends boolean>(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isContentObserver && contentChanged) {
|
if (isContentObserver) {
|
||||||
(callback as DOMContentObserverCallback)(contentChanged);
|
contentChanged && (callback as DOMContentObserverCallback)(contentChanged);
|
||||||
} else if (!isEmptyArray(targetChangedAttrs) || targetStyleChanged) {
|
} else if (!isEmptyArray(targetChangedAttrs) || targetStyleChanged) {
|
||||||
(callback as DOMTargetObserverCallback)(targetChangedAttrs, targetStyleChanged);
|
(callback as DOMTargetObserverCallback)(targetChangedAttrs, targetStyleChanged);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -438,6 +438,8 @@ const addRemoveImgElmsFn = async () => {
|
|||||||
['img', 'something2'],
|
['img', 'something2'],
|
||||||
['img', null],
|
['img', null],
|
||||||
['img', undefined],
|
['img', undefined],
|
||||||
|
[null, null],
|
||||||
|
[undefined, undefined],
|
||||||
['img', () => 'hi'],
|
['img', () => 'hi'],
|
||||||
['img', () => null],
|
['img', () => null],
|
||||||
['img', () => undefined],
|
['img', () => undefined],
|
||||||
|
|||||||
Reference in New Issue
Block a user