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

Address setter compatibility with frameworks #2

Open
rdmurphy opened this issue Mar 22, 2022 · 2 comments
Open

Address setter compatibility with frameworks #2

rdmurphy opened this issue Mar 22, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@rdmurphy
Copy link
Owner

I thought I did everything correctly with the custom element property setters but Svelte quickly informed me that I had in fact not.

I think the issue here is that Svelte has special handling for custom elements — if it sees that an attribute has a matching property it will pass it in as a property instead of an attribute. This is confusing because it does not do this for native DOM elements. ¯\(ツ)

But anyway, this is probably a real bug with how I implemented the setter for offset. It should be possible to "unset" it by doing scene.offset = null but that crashes and burns right now.

@rdmurphy rdmurphy added the bug Something isn't working label Mar 22, 2022
@rdmurphy
Copy link
Owner Author

rdmurphy commented Mar 22, 2022

I think the easiest answer here may be to just not reflect the offset property to the attribute. There's precedent for that in native elements. Could just store a reference to it locally at this._offset and use that if someone passes it in (and default to 0.5 if it's null-ish). Just let the attribute path be a helpful way to define your defaults in the markup.

@rdmurphy
Copy link
Owner Author

Going to remove the bug tag from this because I don't think it's really a "bug" in the typical sense — this is on Svelte for trying to do something a little weird.

@rdmurphy rdmurphy added enhancement New feature or request and removed bug Something isn't working labels Apr 13, 2022
@rdmurphy rdmurphy changed the title Fix setters for compat with frameworks Address setter compatibility with frameworks Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant