Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion vendor/browser-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
var runScripts;
var loadScripts;
var headEl;
var dummyAnchor;

var buffer = require('buffer');
var transform = require('jstransform').transform;
Expand Down Expand Up @@ -124,13 +125,20 @@ var transformCode = function(code, source, options) {
if (inlineScriptCount > 1) {
source += ' (' + inlineScriptCount + ')';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check if these inline scripts work fine?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup :)

}
} else if (dummyAnchor) {
// Firefox has problems when the sourcemap source is a proper URL with a
// protocol and hostname, so use the pathname. We could use just the
// filename, but hopefully using the full path will prevent potential
// issues where the same filename exists in multiple directories.
dummyAnchor.href = source;
source = dummyAnchor.pathname.substr(1);
}
map.sources = [source];
map.sourcesContent = [code];

return (
transformed.code +
'//# sourceMappingURL=data:application/json;base64,' +
'\n//# sourceMappingURL=data:application/json;base64,' +
buffer.Buffer(JSON.stringify(map)).toString('base64')
);
} else {
Expand Down Expand Up @@ -226,6 +234,7 @@ runScripts = function() {

if (typeof window !== "undefined" && window !== null) {
headEl = document.getElementsByTagName('head')[0];
dummyAnchor = document.createElement('a');

if (window.addEventListener) {
window.addEventListener('DOMContentLoaded', runScripts, false);
Expand Down