MCPcopy Create free account
hub / github.com/Vectorized/Aris / fixCSSRelUrls

Function fixCSSRelUrls

aris.js:522–537  ·  view source on GitHub ↗
(url, css)

Source from the content-addressed store, hash-verified

520 var loadedFiles = {};
521
522 var fixCSSRelUrls = function (url, css) {
523 url = trim(url);
524 if (url[0] != '/') {
525 url = window.location.pathname.replace(locationPathPopRe, '') + '/' + url;
526 }
527 url = url.replace(locationPathPopRe, '');
528 return css.replace(cssUrlRe, function (x, g) {
529 if (g.match(cssAbsUrlRe)) return x;
530 var urlComps = url.split('/'), cssURLComps = g.split('/'), i;
531 for (i = 0; i < cssURLComps.length; ++i) {
532 if (cssURLComps[i] == '..') urlComps.pop();
533 else urlComps.push(cssURLComps[i]);
534 }
535 return 'url(\'' + urlComps.join('/') + '\')';
536 });
537 }
538
539 var fileReadyChecker = function (xhr, i, urlMatch, ctl) {
540 return function() {

Callers 1

loadFilesFunction · 0.85

Calls 1

trimFunction · 0.85

Tested by

no test coverage detected