From 165896d1605e78441ce230be738d043a8412b84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Fri, 6 Jan 2023 12:35:33 +0200 Subject: [PATCH] Iframe: compat styles: check for ownerNode === null --- .../src/components/iframe/use-compatibility-styles.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/block-editor/src/components/iframe/use-compatibility-styles.js b/packages/block-editor/src/components/iframe/use-compatibility-styles.js index 5a1d7de551865..92e755b318ec4 100644 --- a/packages/block-editor/src/components/iframe/use-compatibility-styles.js +++ b/packages/block-editor/src/components/iframe/use-compatibility-styles.js @@ -28,6 +28,12 @@ export function useCompatibilityStyles() { const { ownerNode, cssRules } = styleSheet; + // Stylesheet is added by another stylesheet. See + // https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/ownerNode#notes. + if ( ownerNode === null ) { + return accumulator; + } + if ( ! cssRules ) { return accumulator; }