-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Use try/catch for properties instead of an allow list, remove xlink:
#2939
Conversation
📊 Tachometer Benchmark ResultsSummaryduration
usedJSHeapSize
Results02_replace1kduration
usedJSHeapSize
run-warmup-0
run-warmup-1
run-warmup-2
run-warmup-3
run-warmup-4
run-final
03_update10th1k_x16duration
usedJSHeapSize
07_create10kduration
usedJSHeapSize
filter_listduration
usedJSHeapSize
hydrate1kduration
usedJSHeapSize
many_updatesduration
usedJSHeapSize
text_updateduration
usedJSHeapSize
|
Size Change: -221 B (0%) Total Size: 42.1 kB
ℹ️ View Unchanged
|
xlink:
xlink:
xlink:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!! 🙌🎉
Co-authored-by: Andre Wiggins <459878+andrewiggins@users.noreply.github.com>
Co-authored-by: Andre Wiggins <459878+andrewiggins@users.noreply.github.com>
I will kick CI again in an hour haha |
) { | ||
try { | ||
dom[name] = value == null ? '' : value; | ||
// labelled break is 1b smaller here than a return statement (sorry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that worth it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine, given that the comment explains what's happening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic stuff 🙌
This PR includes two fundamental changes to the way we do prop diffing:
Instead of safeguarding against setting read-only reflected DOM properties, it attempts to set the property in a
try/catch
and falls back to setting an attributeThe codepath for detecting
xlink:href
/xlinkHref
props and applying them viasetAttributeNS()
is simply removed. This was only ever used for thexlink:href
attribute, which was removed from SVG 2. The non-namespacedhref
attribute works exactly the same way. As a bridging solution, since there are lots of folks using<use xlinkHref="..">
, I've retained the code that strips anyxlink
namespace prefix off of the prop name.Fixes #2926.