You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
convertToAbsoluteUrls makes the URL prefix prepended to SVG data URLs if they contain comments #214
Let me know if that's not enough to reproduce on your end.
What is the expected behavior?
Nothing should get prepended.
If this is a feature request, what is motivation or use case for changing the behavior?
N/A
Please mention other relevant information such as your webpack version, Node.js version and Operating System.
macOS 10.12.4 (16E195), Node.js 6.10.2, Webpack 2.3.3, style-loader 0.16.1
@mgol on the idea that this is where it works, not the best practice, for this purpose there are specifications, to support non-standard behavior is not a good idea, but I have an idea how it can still be fixed anyway.
Yes, I understand, I've already removed such usage from my code. My point is Web standards have recently tried to match reality as much as possible so if every single major browser behaves differently to the spec (and consistent with each other) then maybe the spec should get an update.
@michael-ciniawsky unfortunately, it will not test right now, because jsdom don't have implement createObjectURL and revokeObjectURL.
I close the issue, if someone have problem please update to latest version style-loader. Also feel free to comment here if you will get problem again. Thank everyone.
Activity
alexander-akait commentedon Apr 19, 2017
@mgol Example contradict specification, your should use
data:image/svg+xml;charset=utf-8,%3C!--%20Comment%20--%3E%3Csvg%3E%3C%2Fsvg%3Ehttps://drafts.csswg.org/css-values-3/#urls.I don't see in spec section allowing to use raw data without
dataalexander-akait commentedon Apr 19, 2017
@mgol can you provide use case and how
'%3C!--%20Comment%20--%3E%3Csvg%3E%3C%2Fsvg%3E'inurlwithoutdata, maybe create minimal reproduced test repomgol commentedon Apr 19, 2017
I'm sorry, when I was creating a minimal example I cut out too much. Please take another look, I edited the post.
Note that I can't specify the charset as that breaks IE 11 for some reason; UTF-8 is a default anyway, though.
alexander-akait commentedon Apr 19, 2017
@mgol weird, bootstrap v4 use
charset=utf8https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss#L467 and they supportIE10-11, also they tests are passed 🤔alexander-akait commentedon Apr 19, 2017
@mgol anyway your url is wrong,
data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3C!--%20Comment)%20--%3E%0A%3Csvg%3E%3C%2Fsvg%3E%0Ahave), see spec https://drafts.csswg.org/css-syntax-3/#url-token-diagram:not " ' ( ) \ ws or non-printable
Tests: add `inline SVG with HTML comment` test [webpack#214].
alexander-akait commentedon Apr 19, 2017
/cc @michael-ciniawsky I think that it is won't fix, because comments in svg can contain any characters and it is can break url in
css.Maybe we can remove comments in
url-loaderforsvgfiles?michael-ciniawsky commentedon Apr 20, 2017
@evilebottnawi Could you please open an issue in
url-loader, so we can keep track of/triage that ? :)alexander-akait commentedon Apr 20, 2017
@michael-ciniawsky sorry i don't right,
url-loaderalways use decode data because it isbase64, we can do this incss-loader, i do PRmgol commentedon Apr 20, 2017
@evilebottnawi
I see, good to know. No browser follows that restriction, though as this data URL worked everywhere for me.
alexander-akait commentedon Apr 20, 2017
@mgol on the idea that this is where it works, not the best practice, for this purpose there are specifications, to support non-standard behavior is not a good idea, but I have an idea how it can still be fixed anyway.
mgol commentedon Apr 20, 2017
Yes, I understand, I've already removed such usage from my code. My point is Web standards have recently tried to match reality as much as possible so if every single major browser behaves differently to the spec (and consistent with each other) then maybe the spec should get an update.
alexander-akait commentedon Apr 20, 2017
@mgol maybe, let's this will leave the creators of the browser and specifications, we have a lot of work here 😄
alexander-akait commentedon Jun 29, 2017
@mgol just confirm, try to update
style-loaderandcss-loaderto latest and check bug existsalexander-akait commentedon Dec 7, 2017
Seems bug already fixed https://github.com/webpack-contrib/style-loader/blob/master/lib/urls.js#L57 and https://github.com/webpack-contrib/style-loader/blob/master/lib/urls.js#L65, in
style-loaderwe have invalid regex to parseurl.@michael-ciniawsky unfortunately, it will not test right now, because jsdom don't have implement
createObjectURLandrevokeObjectURL.I close the issue, if someone have problem please update to latest version
style-loader. Also feel free to comment here if you will get problem again. Thank everyone.