param selector returns { Promise } export function elementReady ( selector ) { return new Promise ( ( resolve , reject ) => { let el = document . querySelector ( selector ) ; if ( el ) { resolve ( el ) ; } new MutationObserver ( ( mutationRecords , observer ) => { Array . from ( document . querySelectorAll ( selector ) ) . forEach ( ( element ) => { resolve ( element ) ; observer . disconnect ( ) ; } ) ; } ) . observe ( document . documentElement , { childList : true , subtree : true } ) ; } ) ; }