Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
Expose data-orig-src on data URI scripts as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Rudenko committed Mar 5, 2013
1 parent 73106a4 commit 4375635
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions api/combo.js
Expand Up @@ -288,7 +288,7 @@ var $ = Mobify.$
* `document.write`. Prefer loading contents from cache.
*/
exec: function(url, forceDataURI) {
var resource, safeSource;
var resource, safeSource, dataURI;

if (resource = httpCache.get(url, true)) {
if (resource.text && !forceDataURI) {
Expand Down Expand Up @@ -318,13 +318,14 @@ var $ = Mobify.$
safeSource = resource.body.replace(/(<\/scr)(ipt\s*>)/ig, '$1\\$2');
return document.write('<script data-orig-src="' + url + '">' + safeSource + '<\/scr'+'ipt>');
} else {
url = httpCache.utils.dataURI(resource);
dataURI = httpCache.utils.dataURI(resource);
return document.write('<script data-orig-src="' + url + '" src="' + dataURI + '"><\/scr' + 'ipt>');
}
} else {
// Firefox will choke on closing script tags passed through
// the ark.
document.write('<script src="' + url + '"><\/scr' + 'ipt>');
}

// Firefox will choke on closing script tags passed through
// the ark.
document.write('<script src="' + url + '"><\/scr' + 'ipt>');
}

/**
Expand Down

0 comments on commit 4375635

Please sign in to comment.