Every line of 'document.currentscript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
156 function removeCurrentScript(doc) { 157 var scripts = doc.getElementsByTagName("script"); 158 var lastScript = scripts[scripts.length-1]; 159 lastScript.parentNode.removeChild(lastScript); 160 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
80 export function getCurrentScript() { 81 const scripts = document.getElementsByTagName('script'); 82 return scripts[scripts.length - 1] || null; 83 }
1 export function currentScript() { 2 return document.currentScript || document._currentScript || getCurrentScriptTheHardWay(); 3 }