diff --git a/myuw-profile.html b/myuw-profile.html
index f3c4a27f3b1e0c2e1a7463b85eaf946eb8888b81..bff2d37a48ec16e7ec9f2a7261a154d3f753362b 100644
--- a/myuw-profile.html
+++ b/myuw-profile.html
@@ -142,21 +142,20 @@
 
 </template>
 <script>
-
-// Get the script document
-const myuwProfileDoc = (document._currentScript || document.currentScript).ownerDocument;
-
 class MyUWProfile extends HTMLElement {
     constructor() {
         super();
 
+        // Get the script document
+        MyUWProfile.document = (document._currentScript || document.currentScript).ownerDocument;
+
         this['open-right'] = false;
 
         // Create a shadowroot for this element
         this.attachShadow({mode: 'open'});
 
         // Get the template and extract the HTML content
-        const template = myuwProfileDoc.getElementById('myuw-profile-template');
+        const template = MyUWProfile.document.getElementById('myuw-profile-template');
 
         // Append the custom HTML to the shadowroot
         this.shadowRoot.appendChild(template.content.cloneNode(true));