Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If SVG width & height attributes contains px #12

Open
YNWA opened this issue Apr 22, 2015 · 2 comments
Open

If SVG width & height attributes contains px #12

YNWA opened this issue Apr 22, 2015 · 2 comments

Comments

@YNWA
Copy link

YNWA commented Apr 22, 2015

Hello, there is just a small issue with image demensions. If width and height attributes of <svg> contains px, like so:

width="27px" height="27px"

This breaks the following lines L15 lib/iconify.js

dimensions.width = Math.round(doc.documentElement.getAttribute('width'));
dimensions.height = Math.round(doc.documentElement.getAttribute('height'));

So I guess attribute values should have a wrap with parseInt or smth.

@gavro
Copy link
Owner

gavro commented Apr 23, 2015

Well, the Math.round is probably not even needed, added it there just as a precaution. Method was taken and adapted from grunticon (https://github.com/filamentgroup/grunticon/blob/master/lib/img-stats.js). They are not using any Math/parseInt calls there. The "px" part is also removed @ L80/81.

I think I'll just remove this. Thnx for spotting this!

@peterjwest
Copy link

Bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants