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

Allow functions to be passed to custom element setters #23042

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

josepharhar
Copy link
Contributor

Summary

This is part of the new custom element features that were implemented
here: 24dd07b
This PR will only make a difference when the
enableCustomElementPropertySupport flag is enabled.

When a custom element has a setter for a property and passes the in
heuristic, the value passed to the react property should be assigned
directly to the custom element's property, regardless of the type of the
value. However, it was discovered that this isn't working with
functions. This patch makes it work with functions.

Fixes #23041

How did you test this change?

I added a test in DOMPropertyOperations-test.js

This is part of the new custom element features that were implemented
here:
facebook@24dd07b

When a custom element has a setter for a property and passes the `in`
heuristic, the value passed to the react property should be assigned
directly to the custom element's property, regardless of the type of the
value. However, it was discovered that this isn't working with
functions. This patch makes it work with functions.

Fixes facebook#23041
@sizebot
Copy link

sizebot commented Dec 28, 2021

Comparing: f2a59df...d2fe50b

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 129.54 kB 129.54 kB = 41.51 kB 41.51 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 134.68 kB 134.68 kB = 43.02 kB 43.02 kB
facebook-www/ReactDOM-prod.classic.js = 427.78 kB 427.78 kB = 78.55 kB 78.55 kB
facebook-www/ReactDOM-prod.modern.js = 417.47 kB 417.50 kB = 77.07 kB 77.07 kB
facebook-www/ReactDOMForked-prod.classic.js = 427.78 kB 427.78 kB = 78.55 kB 78.55 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against d2fe50b

@gaearon gaearon merged commit a87adef into facebook:main Jan 12, 2022
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
This is part of the new custom element features that were implemented
here:
facebook@24dd07b

When a custom element has a setter for a property and passes the `in`
heuristic, the value passed to the react property should be assigned
directly to the custom element's property, regardless of the type of the
value. However, it was discovered that this isn't working with
functions. This patch makes it work with functions.

Fixes facebook#23041
nevilm-lt pushed a commit to nevilm-lt/react that referenced this pull request Apr 22, 2022
This is part of the new custom element features that were implemented
here:
facebook@24dd07b

When a custom element has a setter for a property and passes the `in`
heuristic, the value passed to the react property should be assigned
directly to the custom element's property, regardless of the type of the
value. However, it was discovered that this isn't working with
functions. This patch makes it work with functions.

Fixes facebook#23041
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: custom element properties can't accept functions
4 participants