Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
gnat authored Sep 23, 2023
1 parent fc87339 commit 05f1a06
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 🌘 CSS Scope Inline (https://github.com/gnat/css-scope-inline)
window.cssScopeCount ??= 1 // Let extra copies share the scope count.
new MutationObserver(mutations => {
document.body.querySelectorAll('style').forEach(node => { // Faster than walking MutationObserver results when recieving subtree (DOM swap, htmx, ajax, jquery).
document?.body?.querySelectorAll('style').forEach(node => { // Faster than walking MutationObserver results when recieving subtree (DOM swap, htmx, ajax, jquery).
if (node.cssScopeInlineDone) return // Skip if node was processed.
if (!node.parentNode) return // Skip if no parent.
var scope = 'self__'+(window.cssScopeCount++) // Ready. Make unique scope, example: .self__1234
Expand Down

0 comments on commit 05f1a06

Please sign in to comment.