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

paint-order not applied to <use> #83

Closed
stanio opened this issue Jun 23, 2024 · 7 comments
Closed

paint-order not applied to <use> #83

stanio opened this issue Jun 23, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@stanio
Copy link

stanio commented Jun 23, 2024

use-paint-order.svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
  <defs>
    <g id="a-circle">
      <circle r="80" />
    </g>
  </defs>

  <circle cx="90" cy="90" r="80" fill="green"
      stroke="blue" stroke-width="10" paint-order="stroke fill" />

  <use href="#a-circle" x="150" y="150" fill="orange"
      stroke="blue" stroke-width="10" paint-order="stroke fill" />

</svg>
Actual Expected
actual expected
@weisJ
Copy link
Owner

weisJ commented Jun 23, 2024

I'm not sure behaviour of other implementations actually is correct here. Per the spec https://svgwg.org/svg2-draft/painting.html#PaintOrder the paint-order property is only allowed on the following elements

  • shapes:
    • circle
    • ellipse
    • line
    • path
    • polygon
    • poly line
    • rect
  • text content elements
    • text
    • textPath
    • span

It is inherited though that should only apply to text content elements as out of the above elements only text actually is a container type (in the sense that is can have visible children).

@stanio
Copy link
Author

stanio commented Jun 23, 2024

Looks similar to the fill attribute. It is said it applies to just shapes and text content elements but then it is inherited and one could specify fill="..." on the root <svg> or <g> element – that one is handled by JSVG.

@stanio
Copy link
Author

stanio commented Jun 24, 2024

I think "applies to" and which element could specify the attribute are two different parts. The <use> element is specified to have presentation attributes that include paint-order. "Style Scoping and Inheritance" further specify how these apply to referenced elements.

weisJ added a commit that referenced this issue Jun 24, 2024
weisJ added a commit that referenced this issue Jun 24, 2024
@weisJ weisJ added the bug Something isn't working label Jun 24, 2024
@weisJ
Copy link
Owner

weisJ commented Jun 24, 2024

Ah it has been to long since I worked on inherited properties. This makes a lot of sense.

@weisJ
Copy link
Owner

weisJ commented Jun 25, 2024

Should be fixed in current snapshot

@stanio
Copy link
Author

stanio commented Jun 25, 2024

Tested with current 1.5.1-SNAPSHOT – works as expected now.

@weisJ
Copy link
Owner

weisJ commented Jul 16, 2024

Now available in 1.6.0

@weisJ weisJ closed this as completed Jul 16, 2024
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