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

maskWith quotation approach #1277

Closed
HarryFaulkner opened this issue Aug 9, 2022 · 2 comments
Closed

maskWith quotation approach #1277

HarryFaulkner opened this issue Aug 9, 2022 · 2 comments

Comments

@HarryFaulkner
Copy link
Contributor

Not sure if this is a bug or something to do with the SVG versioning... but for anyone experiencing issues importing masked SVG's into the applications I mention below, this is likely your issue.

When using the .maskWith() command, the mask is double quoted:

<g> mask="url("#SvgjsMask1002")" </g>

This approach works fine in the browser and most places. But when downloading the SVG and importing to something like Adobe illustrator or Inkscape it fails to render the mask.

The following line, wraps the mask in single quotations, and a supplemental double quotation for the internal #id.

return this.attr('mask', 'url("#' + masker.id() + '")')

I've adjusted my local version to the following (which fixes the issue for me):
return this.attr('mask', 'url(#' + masker.id() + ')');

I don't know a great deal about the SVG versioning (changes to syntax that may have happened over time), this may be correct for a given version. The current documentation seems to suggest double quotes are not required:
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/mask

If this is intended behaviour then of course feel free to close this.

@Fuzzyma
Copy link
Member

Fuzzyma commented Aug 9, 2022

To me this sounds like a bug in the parser of Adobe or Inkscape - or its not allowed from the standard and the browser still works.

Nevertheless, yes, we should use single quotes if they get around that issue

@HarryFaulkner
Copy link
Contributor Author

HarryFaulkner commented Aug 9, 2022

To me this sounds like a bug in the parser of Adobe or Inkscape - or its not allowed from the standard and the browser still works.

Nevertheless, yes, we should use single quotes if they get around that issue

Agreed, dam illustrator, they should be able to at least handle what a measly browser can 😄

PR: #1278

@Fuzzyma Fuzzyma closed this as completed Sep 3, 2023
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

2 participants