diff --git a/lib/utils/resolve-url.js b/lib/utils/resolve-url.js
index 5dd89cbcf..f60e13915 100644
--- a/lib/utils/resolve-url.js
+++ b/lib/utils/resolve-url.js
@@ -77,6 +77,10 @@ export function resolveUrl(url, baseURI) {
*/
export function resolveCss(cssText, baseURI) {
return cssText.replace(CSS_URL_RX, function(m, pre, url, post) {
+ // No resolution for data: urls
+ if (url.match(/^["']?data:/)) {
+ return pre + url + post;
+ }
return pre + '\'' +
resolveUrl(url.replace(/["']/g, ''), baseURI) +
'\'' + post;
diff --git a/test/unit/resolveurl.html b/test/unit/resolveurl.html
index 2ce6c8b27..4857e340b 100644
--- a/test/unit/resolveurl.html
+++ b/test/unit/resolveurl.html
@@ -30,6 +30,9 @@
:host {
background: url('foo.png');
}
+ .inline-svg {
+ background: url("data:image/svg+xml;utf8,");
+ }
@@ -125,6 +128,7 @@
var matchImport = /defineImport\//i;
var style = el.shadowRoot.querySelector('style') || document.querySelector('style[scope=x-late]');
assert.match(style.textContent, matchImport);
+ assert.match(style.textContent, /url\("data:image\/svg\+xml;utf8,