Internet Explorer/Edge discards part of the decimal precision #142
Comments
@adgoncal Thanks for reporting — but that's a real bummer. :( svg-sprite used to use absolute positions (i.e. pixels), but there's no such option anymore. Of course one could use an alternative rendering template making use of the absolute values (they are still available as variables in the templates), but it's going to be a major PITA. If I understood the problem correctly, an alternative approach would be to create the sprite such that all positions are full percentage value, right? This would possibly increase the sprites overall dimension a little, but that wouldn't matter as long as it's only SVG (it would matter a little for node-iconizr, but support for IE / Edge is probably more important). In any case, really solving this issue will require some time — which I currently don't have, unfortunately. I'll keep this open and try to work on it as soon as I can. Thanks again for reporting. |
FWIW you can supply a custom template to use pixels rather than percentages. Here is my config:
And the custom template file (sprite.css.custom.tmpl) I created:
|
Thanks for sharing your custom template, @aarondail. This might help others quite a lot! However, please bear in mind that using pixels instead of percent will make your sprite shapes "non-responsive" — they will be tied to their original dimensions (respectively the generated ones) and you won't be able to style them via CSS to have different dimensions (e.g. I will try to cater for the precision problem in a later release. |
Ahh, good to know! I hadn't realized that. |
Hi Any news with this issue? |
@Chehow Sorry, no news yet. Due to massive overload I won't be able to work on svg-sprite at least until the end of the year. Thanks for your understanding. |
Hi @jkphl, any chance that this story would have a higher priority? |
@eugef I'm planning to do a major rewrite (including a fix for this bug) for a long time now, but unfortunately im swamped with tasks and completely overloaded these days which won't change at least until end of March. With a bit of luck I might work on svg-sprite then again. On another note, please feel free to send in a PR with a solution! |
@jkphl I'd like to, but don't feel confident to dig into. BTW, the workaround that we are using - is to add 1-2px padding around each icon in the sprite. Then effects of the issue are not so visible - the icons can be still shifted, but at least they are not truncated or part of next icon is not shown. |
TL;DR
IE/Edge seem to ignore anything after the second decimal place on a percentage background position. Is there an option in svg-sprite to use pixel units instead of percentage?
I just noticed that IE and Edge do not display the sprites correctly. I noticed it when I had a button that changed the sprite icon on hover.
Searching the web I found an issue on stackoverflow that explains the problem: http://stackoverflow.com/questions/6420255/ie-bug-percentages-with-background-position
So percentage background position does not work well in IE. Using percentage units is one of the best features in svg-sprite, but if IE/Edge need to be supported, it seems necessary to use pixel units instead. Is there an option in svg-sprite to use 'px' instead?
Note: I searched for similar issues, but did not find any so I created this one. If this is a duplicate of an existing issue, I apologize.
The text was updated successfully, but these errors were encountered: