Embed js height fix (#22141)
* only begin iframe reheight once document state is complete * format * lint fixes * Update public/embed.js to use readystatechange event listener Co-authored-by: Claire <claire.github-309c@sitedethib.com> * Call loaded() if ready, otherwise add listenter * lint fix Co-authored-by: Claire <claire.github-309c@sitedethib.com>shrike
parent
04c611daa1
commit
4114a7088a
|
@ -7,10 +7,14 @@
|
||||||
* @param {() => void} loaded
|
* @param {() => void} loaded
|
||||||
*/
|
*/
|
||||||
var ready = function (loaded) {
|
var ready = function (loaded) {
|
||||||
if (['interactive', 'complete'].indexOf(document.readyState) !== -1) {
|
if (document.readyState === 'complete') {
|
||||||
loaded();
|
loaded();
|
||||||
} else {
|
} else {
|
||||||
document.addEventListener('DOMContentLoaded', loaded);
|
document.addEventListener('readystatechange', function () {
|
||||||
|
if (document.readyState === 'complete') {
|
||||||
|
loaded();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue