Skip to content

Commit

Permalink
fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
e111077 authored and calebdwilliams committed Dec 21, 2023
1 parent 3434410 commit 41441a4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/mutation-observers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,18 @@ export function fragmentObserverCallback(mutationList: MutationRecord[]): void {
* @param fragment {DocumentFragment}
*/
export const deferUpgrade = (fragment: DocumentFragment) => {
const observer = new MutationObserver(fragmentObserverCallback);
// is this using shady DOM and is not actually a DocumentFragment?
if (
window?.ShadyDOM?.inUse &&
(fragment as unknown as { mode: string }).mode &&
(fragment as unknown as { host: HTMLElement | null }).host
) {
// using shady DOM polyfill. Best to just observe the host.
fragment = (fragment as ShadowRoot).host as unknown as DocumentFragment;
}
observer.observe?.(fragment, { childList: true });
documentFragmentMap.set(fragment, observer);
const observer = new MutationObserver(fragmentObserverCallback);
// is this using shady DOM and is not actually a DocumentFragment?
if (
window?.ShadyDOM?.inUse &&
(fragment as unknown as { mode: string }).mode &&
(fragment as unknown as { host: HTMLElement | null }).host
) {
// using shady DOM polyfill. Best to just observe the host.
fragment = (fragment as ShadowRoot).host as unknown as DocumentFragment;
}
observer.observe?.(fragment, { childList: true });
documentFragmentMap.set(fragment, observer);
};

export const observer = mutationObserverExists() ? new MutationObserver(observerCallback) : {} as MutationObserver;
Expand Down

0 comments on commit 41441a4

Please sign in to comment.