diff --git a/lib/addStyles.js b/lib/addStyles.js index 91f9d32d..752c8753 100644 --- a/lib/addStyles.js +++ b/lib/addStyles.js @@ -30,7 +30,7 @@ var getElement = (function (fn) { if (typeof memo[selector] === "undefined") { var styleTarget = fn.call(this, selector); // Special case to return head of iframe instead of iframe itself - if (styleTarget instanceof window.HTMLIFrameElement) { + if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { try { // This will throw an exception if access to iframe is blocked // due to cross-origin restrictions