diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index e47512a56..134d29337 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -657,9 +657,11 @@ html {{ {font} }} self.evalWithCallback( f""" -const style = document.createElement('style'); -style.innerHTML = `{css}`; -document.head.appendChild(style); +(function(){{ + const style = document.createElement('style'); + style.innerHTML = `{css}`; + document.head.appendChild(style); +}})(); """, after_style, )