Join GitHub today
SourceURL support for scripts loaded by domManip using XHRs. #1733
Originally reported by vsevik@… at: http://bugs.jquery.com/ticket/11484
This ticket is inspired by discussion in Chrome Developer Tools mailing group: https://groups.google.com/group/google-chrome-developer-tools/browse_thread/thread/e22f4cb5b0685dbd
SourceURL is a way to give a name to the script executed by eval() for debugging purposes. See http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
Adding sourceURL to scripts loaded by domManip would make debugging easier. example: $('head').append('<script src="test.js'></script>');
Similar (but different) request http://bugs.jquery.com/ticket/8292 was closed as wontfix earlier, so some comments on the reasons mentioned there:
Yes, but is very valuable for developers and it comes with virtually zero cost for users.
sourceURL is supported by Firefox and WebKit (Chrome, Safari) which makes together more than 60% of browser market share.
In the example mentioned above the url could and should be taken from the src attribute of the script tag. This is the same url the script was loaded from.
Vsevolod Vlasov, webkit reviewer
Issue reported for jQuery 1.7.1
Comment author: dmethvin
Comment author: paul.irish
This one just came up again: https://code.google.com/p/chromium/issues/detail?id=365645
I believe that with wither globalEval or a script tag the script will not have a real name that's debuggable in browser devtools. @sourceURL has strong x-browser support and would allow you to inject a filename for all injected scripts which would allow them to participate like real files.