Skip to content

Commit

Permalink
Inject util: Stop processing disconnected elements (#1518)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon authored Jul 13, 2024
1 parent d03d7fe commit 76411a6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main_world/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ document.documentElement.addEventListener('xkitinjectionrequest', async event =>
moduleCache[path] ??= await import(path);
const func = moduleCache[path].default;

if (target.isConnected === false) return;

const result = await func.apply(target, args);
target.dispatchEvent(
new CustomEvent('xkitinjectionresponse', { detail: JSON.stringify({ id, result }) })
Expand Down

0 comments on commit 76411a6

Please sign in to comment.