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

Support for SVG Filters? #229

Closed
rbuchmann opened this issue Apr 9, 2016 · 7 comments
Closed

Support for SVG Filters? #229

rbuchmann opened this issue Apr 9, 2016 · 7 comments

Comments

@rbuchmann
Copy link

I'm trying to add an SVG Filter to a component, along these lines:

[:filter {:id "shadow" :x 0 :y 0 :width "200%" :height "200%"}
   [:fe-offset {:result "offOut"
                :in "SourceGraphic"
                :dx 20
                :dy 20}]]

However, the node mappings are not as expected

:fe-offset ; => fe-offset
:feOffset; => feoffset

and the filter doesn't get recognized as a consequence. Is there any way around this, or do I have to resort to component-did-mount etc.?

@danielcompton
Copy link
Contributor

Github issues for Reagent are for bug reports and feature requests. Support requests and usage questions should go to the Clojure Slack channel, the ClojureScript mailing list, or the Reagent mailing list.

@rbuchmann
Copy link
Author

I actually do believe this is a bug. The mapping should be

:fe-offset ; => feOffset

exactly as it is for react properties. Is there any reason to forcefully lower-case tag names?

@rbuchmann
Copy link
Author

And if there is a good reason, which I find hard to imagine, then this becomes a feature request. I want to be able to use all react elements without jumping through component-did-mount hoops.

@mike-thompson-day8
Copy link
Member

React 15 has complete SVG support, but previous versions did not support various bits:
facebook/react#1657 (comment)

As I understand it, the work (hack) around has been to use dangerouslySetInnerHTML
See: https://groups.google.com/d/msg/reagent-project/PMZPUy5yBCc/FfuMy6blCQAJ

But as previously indicated, this is not the place for support.

@ghost
Copy link

ghost commented Apr 12, 2016

However, the node mappings are not as expected
:feOffset; => feoffset

Is there any reason to forcefully lower-case tag names?

reagent isn't doing this directly. It's the behavior of svg-in-html, which is case-insensitive. To verify:

console.log(document.createElement("feOffset"));
<feoffset></feoffset>

If you're not getting the visually expected results, it could be a mistake in the markup.

The mapping should be
:fe-offset ; => feOffset

Adding this behavior is problematic for SVG tags which contain dashes in the name.

@rbuchmann
Copy link
Author

@mike-thompson-day8 : As I understood it, this hack is unnecessary now. As you can see in #121 , the current reagent should be capable of using all react svg features.

@thwg Thanks for the very helpful explanation. I didn't expect it to be case insensitive. I'll investigate my markup and ask any further questions in the places mentioned above.

Adding this behavior is problematic for SVG tags which contain dashes in the name.

Additionally, it's unnecessary given the information above 😄

@rbuchmann
Copy link
Author

@mike-thompson-day8 Apologies, you were right, this is still missing from react < 15. I tracked down the issue to certain properties like :in simply being ignored. Too bad!

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

4 participants