feat: Guard against missing window.CSSStyleSheet (#1088)
This commit is contained in:
@@ -538,6 +538,13 @@ function initStyleSheetObserver(
|
||||
{ styleSheetRuleCb, mirror, stylesheetManager }: observerParam,
|
||||
{ win }: { win: IWindow },
|
||||
): listenerHandler {
|
||||
if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) {
|
||||
// If, for whatever reason, CSSStyleSheet is not available, we skip the observation of stylesheets.
|
||||
return () => {
|
||||
// Do nothing
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const insertRule = win.CSSStyleSheet.prototype.insertRule;
|
||||
win.CSSStyleSheet.prototype.insertRule = function (
|
||||
|
||||
Reference in New Issue
Block a user