You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although a.href = null; is shorter than setAttribute(a, "href", null), it’s incorrect, because setting HTMLAnchorElement.prototype.href stringifies its argument, including null, and so you end up with <a href="null>.
It’s not the most common situation to craft an <a> which may or may not have an href, but I just hit this now.
The text was updated successfully, but these errors were encountered:
This is a duplicate of the (admittedly slightly meandering) #1434. This has been an issue since the very beginning of Svelte. Rich doesn't remember why he decided to use properties instead of attributes where possible (i.e., whether it was a performance thing or a code size thing). My comment on that issue from January 10 has a workaround. But this is still a known bug, just one not on the front burning right now amid v3 stuff.
Trivial reproduction case:
In the compiled JavaScript:
Although
a.href = null;
is shorter thansetAttribute(a, "href", null)
, it’s incorrect, because settingHTMLAnchorElement.prototype.href
stringifies its argument, includingnull
, and so you end up with<a href="null>
.It’s not the most common situation to craft an
<a>
which may or may not have anhref
, but I just hit this now.The text was updated successfully, but these errors were encountered: