document.currentScript is useful for scripts which need to be aware of where their script tag is in relation to the rest of the DOM, such as when a script needs to operate only on its sibling elements.
Moderator votes: +16
Issue added by danhunsaker on 2014-06-03
To vote this issue up or down, simply include +1 or -1 in your comment.
+1
+1
+1
+1
+1 :+1:
See https://html.spec.whatwg.org/multipage/dom.html#dom-document-currentscript for documentation.
+1
+1
+1 - PDF.js crashes on document.currentScript in IE11. So: http://caniuse.com/#search=currentScript
Alas ...
+1
+1
+1
+1
+1
+1
+1
MDC lists the browsers supporting document.currentScript.
See: https://developer.mozilla.org/en-US/docs/Web/API/Document/currentScript
As of this writing, IE doesn't support this feature. Support is unknown for IE Mobile and Opera Mobile.
+1
+1
+1
+1
+1 note this is implemented in Microsoft Edge at least as of Windows Insider build 14295 (haven't tested release builds). Would be nice to list this sort of thing. :)
+1
+1
+1
+1
Now available at http://caniuse.com/#feat=document-currentscript
Most helpful comment
Now available at http://caniuse.com/#feat=document-currentscript