Created
May 13, 2013 09:03
-
-
Save zmmbreeze/5567068 to your computer and use it in GitHub Desktop.
返回当前正在执行脚本的<script>元素
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reliably grab my script tag | |
function getScript() { | |
var script; | |
if (!(script = document.currentScript)) { | |
script = document.getElementsByTagName("script"); | |
script = script[script.length - 1]; | |
} | |
return script; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment