-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Handlers are not removed while set to undefined
on update
#1804
Comments
What browser is this happening in? It's not reproducing in Firefox. |
In latest Chrome, IE, and i reproduce it in FF. Steps to reproduce:
|
@uNmAnNeR Good catch! Removing the The check was present in the original rewrite code, paired with the |
@pygy It would affect cases like this: m("div", {onclick: undefined}, "contents") IMHO the current behavior is very buggy, because it fails to address a couple key things:
The proper fixes would be to:
|
@isiahmeadows actually, a strict What do you mean by "dispatch for all different attribute types"? Edit: Oooh, maybe you mean that this branch should be mirrored in the removal loop? There's probably a Edit2: yes, there's a |
@pygy Most (if not all) DOM-related properties and arguments with relevant Just thought I'd point that out. (That's also where the |
Yes, but that's only part of it - this case should be calling a helper mirroring |
Regarding That being said in both cases, the distinction looks like a wart, and I'd be surprised if anyone used the auto-conversion of |
@isiahmeadows so far, there's only one place where there's a difference between It makes it impossible to plainly conflate |
For those special cases (
I mean the difference between these two, not the (in)existence of a property:
(That distinction is what I was referring to throughout, in case that was missed.) |
Just realized this is a dupe of #1613...closing that in favor of this, since this one is more clearly detailed. |
Just ran into this while updating to v1.0.0 with boolean-type attributes, such as In v0.2.5, mithril removed attributes if they were Here's an example https://codepen.io/anon/pen/qPRRPZ?editors=1011 |
@fent To clarify, it should be fixed in |
Hello!
On "Log" step,
onclick
is set. But on "Dont log" step onclick is set toundefined
, but logging still works:https://jsfiddle.net/hn0sunah/
I guess, this is very common problem. For example, i have common
Button
component, in whichonclick
callback could be passed, oronclick
will be explicitely set toundefined
.So, may be
setAttr
should handlevalue === undefined
another way, then just ignore it:https://github.com/lhorie/mithril.js/blob/0ce5dcac3b7965174477236e02d4ac5c66f28c0e/render/render.js#L471
The text was updated successfully, but these errors were encountered: