Browse Source

fix overriding getElementById on document

Remixer Dec 2 years ago
parent
commit
22bfcf135f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      script.js

+ 1 - 1
script.js

@@ -2,7 +2,7 @@ function gradioApp() {
     const elems = document.getElementsByTagName('gradio-app')
     const elem = elems.length == 0 ? document : elems[0]
 
-    elem.getElementById = function(id){ return document.getElementById(id) }
+    if (elem !== document) elem.getElementById = function(id){ return document.getElementById(id) }
     return elem.shadowRoot ? elem.shadowRoot : elem
 }