-
Notifications
You must be signed in to change notification settings - Fork 80
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
Using xlink:href in SVG can cause pointless style recalculations #62
Comments
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it! Here is what to expect next, and if anyone wants to comment, keep these things in mind. |
I believe the reason for this issue is that for all namespaced attributes the value is an object, virtual-dom/src/Elm/Kernel/VirtualDom.js Lines 263 to 270 in 5a5bcf4
which we then try to compare by reference. virtual-dom/src/Elm/Kernel/VirtualDom.js Lines 911 to 913 in 5a5bcf4
This is bound to fail and force a patch every time we do a comparison on namespaced attributes. It seems like Firefox is kinder when you use |
Adding a condition like this if (xValue === yValue && xKey !== 'value' && xKey !== 'checked'
|| category === 'a__1_EVENT' && _VirtualDom_equalEvents(xValue, yValue)
|| category === 'a__1_ATTR_NS' && xValue.__namespace === yValue.__namespace && xValue.__value === yValue.__value) to the if-clause in |
To those who run into this: The easiest way to solve the problem with -Svg.Attributes.xlinkHref "my-url"
+Html.Attributes.attribute "href" "my-url" Note: Don’t use However, all It appears that all |
Edited by @evancz
The runtime behavior of
justCirc
andsymAndUse
is very different in the following code.symAndUse
the browser is recalculating styles on every animation frame.justCirc
it does not do this.You can observe this by profiling the example with the Chrome timeline
The text was updated successfully, but these errors were encountered: