fix(select): account for MutationObserver when performing SSR (#21068)

fixes #21063
This commit is contained in:
Liam DeBeasi
2020-04-27 11:29:44 -04:00
committed by GitHub
parent 4bd9134473
commit 66e8e6404d

View File

@ -1,4 +1,7 @@
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 => {
onChange(getSelectedOption<T>(mutationList, tagName));
});