Explorar o código

fix overriding getElementById on document

Remixer Dec %!s(int64=2) %!d(string=hai) anos
pai
achega
22bfcf135f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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
 }