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

<pattern> tag attribute "patternUnits" should be supported #1535

Closed
nhunzaker opened this issue May 15, 2014 · 1 comment
Closed

<pattern> tag attribute "patternUnits" should be supported #1535

nhunzaker opened this issue May 15, 2014 · 1 comment

Comments

@nhunzaker
Copy link
Contributor

patternUnits is really useful for SVG patterns, but it doesn't appear to be transferred to the DOM when I render a component that uses it. Given the following sample SVG,

<svg version="1.1" height="200" width="200">
  <defs>
    <pattern id="scanlines" width="5" height="5" patternUnits="userSpaceOnUse">
      <svg width="5" height="5">
        <rect width="5" height="5" fill="#000"></rect>
        <path d="M0 5L5 0ZM6 4L4 6ZM-1 1L1 -1Z" stroke="#fff" strokeWidth="2"></path>
      </svg>
    </pattern>
  </defs>
  <circle r="100" cx="100" cy="100" fill="url(#scanlines)" />
</svg>

The result should display a scan line pattern, as demonstrated here (in raw SVG):

http://codepen.io/nhunzaker/pen/idzCq?editors=100

However this doesn't happen because the patternUnits attribute is never transferred. Note the missing patternUnits attribute within pattern#scanlines. This is the result of executing React.renderComponentToString on this svg markup:

<svg version="1.1" height="200" width="200" data-reactid=".0" data-react-checksum="750163038">
    <defs data-reactid=".0.0">
        <pattern id="scanlines" width="5" height="5" data-reactid=".0.0.0">
            <svg width="5" height="5" data-reactid=".0.0.0.0">
                <rect width="5" height="5" fill="#000" data-reactid=".0.0.0.0.0"></rect>
                <path d="M0 5L5 0ZM6 4L4 6ZM-1 1L1 -1Z" stroke="#fff" stroke-width="2" data-reactid=".0.0.0.0.1"></path>
            </svg>
        </pattern>
    </defs>
    <circle r="100" cx="100" cy="100" fill="url(#scanlines)" data-reactid=".0.1"></circle
</svg>
@sophiebits
Copy link
Collaborator

Closing in favor of #1657.

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

Successfully merging a pull request may close this issue.

2 participants