aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/hmr.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/hmr.ts')
-rw-r--r--src/runtime/hmr.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/runtime/hmr.ts b/src/runtime/hmr.ts
index 4a8ccca43..77873a34c 100644
--- a/src/runtime/hmr.ts
+++ b/src/runtime/hmr.ts
@@ -189,9 +189,11 @@ if (typeof window !== "undefined") {
let count = 0;
let match: CSSHMRInsertionPoint = null;
+ const adoptedStyles = document.adoptedStyleSheets;
+
if (this.updateMethod === CSSUpdateMethod.cssObjectModel) {
- if (document.adoptedStyleSheets.length > 0) {
- count = document.adoptedStyleSheets.length;
+ if (adoptedStyles.length > 0) {
+ count = adoptedStyles.length;
for (let i = 0; i < count && match === null; i++) {
let cssRules: CSSRuleList;
@@ -200,7 +202,7 @@ if (typeof window !== "undefined") {
// Non-same origin stylesheets will potentially throw "Security error"
// We will ignore those stylesheets and look at others.
try {
- sheet = document.adoptedStyleSheets[i];
+ sheet = adoptedStyles[i];
cssRules = sheet.rules;
ruleCount = sheet.rules.length;
} catch (exception) {