Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Expose data-orig-src on data URI scripts as well

  • Loading branch information...
commit 4375635d4ef554ed26644cd314ff9c690a3ade27 1 parent 73106a4
Roman Rudenko authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 api/combo.js
View
13 api/combo.js
@@ -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) {
@@ -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>');
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.