diff --git a/src/components/html.js b/src/components/html.js index 6e8a7127..d2ef86d5 100644 --- a/src/components/html.js +++ b/src/components/html.js @@ -48,7 +48,7 @@ export default function (Glide, Components, Events) { r = document.querySelector(r) } - if (r !== null) { + if (exist(r)) { Html._r = r } else { warn('Root element must be a existing Html node') diff --git a/src/utils/dom.js b/src/utils/dom.js index 91289ccf..a0001516 100644 --- a/src/utils/dom.js +++ b/src/utils/dom.js @@ -28,7 +28,8 @@ export function siblings (node) { * @return {Boolean} */ export function exist (node) { - if (node && node instanceof window.HTMLElement) { + // We are usine duck-typing here because we can't use `instanceof` since if we're in an iframe the class instance will be different. + if (node && node.appendChild && node.isConnected) { return true }