aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/hmr.ts
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-10-15 19:44:53 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-10-15 19:44:53 -0700
commit10696680ff9012f7ca07ae2c1de5ed710647b4f9 (patch)
tree1732ddd3dd2a7605da8ff5f181156e9e734aaa99 /src/runtime/hmr.ts
parent7e159cb5cdfc288c1aab7b0f810f5b54438b9f19 (diff)
downloadbun-10696680ff9012f7ca07ae2c1de5ed710647b4f9.tar.gz
bun-10696680ff9012f7ca07ae2c1de5ed710647b4f9.tar.zst
bun-10696680ff9012f7ca07ae2c1de5ed710647b4f9.zip
Polish
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) {