Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Add style attribute to url resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Apr 14, 2014
1 parent a6e541c commit 28891b8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/url.js
Expand Up @@ -58,16 +58,21 @@ var urlResolver = {
var attr = node.attributes[v];
if (attr && attr.value &&
(attr.value.search(URL_TEMPLATE_SEARCH) < 0)) {
var urlPath = resolveRelativeUrl(url, attr.value);
attr.value = urlPath;
var replacement;
if (v === 'style') {
replacement = replaceUrlsInCssText(attr.value, url, CSS_URL_REGEXP);
} else {
replacement = resolveRelativeUrl(url, attr.value);
}
attr.value = replacement;
}
});
}
};

var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
var URL_ATTRS = ['href', 'src', 'action'];
var URL_ATTRS = ['href', 'src', 'action', 'style'];
var URL_ATTRS_SELECTOR = '[' + URL_ATTRS.join('],[') + ']';
var URL_TEMPLATE_SEARCH = '{{.*}}';

Expand Down

0 comments on commit 28891b8

Please sign in to comment.