mchoe / SwiftSVG

A simple, performant, and lightweight SVG parser
Other
1.92k stars 230 forks source link

Support style element #184

Open jncn opened 3 years ago

jncn commented 3 years ago

Description of the Issue Browsers support the SVG style element, see: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/style. Unfortunately SwiftSVG throws an error when trying to parse such files:

style is unsupported. For a complete list of supported elements, see the `allSupportedElements` variable in the `SVGParserSupportedElements` struct. Click through on the `elementName` variable name to see the SVG tag name.

Sample SVG

<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
  <style>
    circle {
      fill: gold;
      stroke: maroon;
      stroke-width: 2px;
    }
  </style>

  <circle cx="5" cy="5" r="4" />
</svg>