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

Empty width attribute causes undesired SVG width #4

Open
mikemartin opened this issue May 23, 2019 · 2 comments
Open

Empty width attribute causes undesired SVG width #4

mikemartin opened this issue May 23, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mikemartin
Copy link

mikemartin commented May 23, 2019

Screenshot:
Screenshot 2019-05-23 13 27 54

I'm thinking it might be better to not apply empty attributes to the SVG. Would it be possible to only return attributes if they have values?

 public function getSvgConfig()
  {
    // Get the config from the params
    $class = $this->getParam('class');
    $height = $this->getParam('height');
    $width = $this->getParam('width');

    // Add the config to an array and return it.
    return [
      'class' => ((false) ? null : $class),
      'height' => ((false) ? null : $height),
      'width' => ((false) ? null : $width)
    ];
  }
@mikemartin
Copy link
Author

@benfurfie Looks like this is also causing console errors.

Screenshot 2019-05-23 17 39 43

@benfurfie
Copy link
Owner

Good suggestion. I'll look at adding it, unless you want to do a PR?

@benfurfie benfurfie self-assigned this May 23, 2019
@benfurfie benfurfie added the bug Something isn't working label May 23, 2019
potentweb added a commit to potentweb/statamic-svg that referenced this issue Jun 21, 2019
Attempt at fixing this issue: benfurfie#4
This was referenced Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants