mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
fix(select): account for MutationObserver when performing SSR (#21068)
fixes #21063
This commit is contained in:
@ -1,4 +1,7 @@
|
|||||||
export const watchForOptions = <T extends HTMLElement>(containerEl: HTMLElement, tagName: string, onChange: (el: T | undefined) => void) => {
|
export const watchForOptions = <T extends HTMLElement>(containerEl: HTMLElement, tagName: string, onChange: (el: T | undefined) => void) => {
|
||||||
|
/* tslint:disable-next-line */
|
||||||
|
if (typeof MutationObserver === 'undefined') { return; }
|
||||||
|
|
||||||
const mutation = new MutationObserver(mutationList => {
|
const mutation = new MutationObserver(mutationList => {
|
||||||
onChange(getSelectedOption<T>(mutationList, tagName));
|
onChange(getSelectedOption<T>(mutationList, tagName));
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user