-
-
Notifications
You must be signed in to change notification settings - Fork 924
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
Loose comparison when early-outing from setting attributes #1595
Conversation
IIRC a similar workaround had to be done in 0.2. |
Indeed, there was (top and bottom of the selected range). There are |
@pygy That rule is currently disabled, so you don't have to disable it. |
I'm convinced. When I have some time I'll add some tests and merge this. |
@isiahmeadows We could enable it now, ESLint stopped "auto-correcting" loose equality when they released v2 (Mithril v0.2 is on ESLintv1.7, Mithril v1 is on ESLint v2). |
ESLint's latest is v3.16...I think we should upgrade at some point. |
ESLint is at latest now |
For the record, this breaks |
@boblehest Could you provide a jsbin that demonstrates the issue? |
@pygy Sure thing: http://jsbin.com/gekipedipa/edit?js,output The HTML output looks like this:
The fix is of course just to stringify your values, which makes sense to do since the value is stored as a string anyway. I'm just mentioning it because this change broke my old code, and because I think using loose comparison is wrong 99% of the time. |
Wow, thanks. Loose comparison looked like the correct solution here, but it was assuming a slightly stricter |
So, new PR? It's odd that we have browser inconsistency here, though. |
I'm working on it... What's inconsistent? I see the same result in Firefox, Chrome, Safari, Edge14 and IE11. |
@pygy I was referring to the original apparent browser bug being fixed by this PR. |
Ok, yes, Firefox preserves the cursor position in that case, WebKit derivatives don't... I'm currently adding tests for this PR before I start fixing the issue raised by @boblehest. The mocks had to be improved (more faithful |
@pygy Idea: maybe cast the value to a string before comparing? That might help alleviate this problem while still avoiding a sloppy check. |
@isiahmeadows that was the idea, yes... There's a corner case with symbols too (using a symbol as attribute causes a |
@pygy You can coerce Symbols as well via |
@isiahmeadows yes, I know about |
Actually, the bin provided by @boblehest works fine since #1828 (on first render, I thought I was going crazy since I couldn't repro the issue in the test suite). Updating the tree would still break when switching between |
Sorry if it wasn't clear enough, but I tried to imply a weak "no", more like a -0.5. |
#1862 should fix this |
This is a rough attempt at a fix for #1593, with zero consideration given to potential side-effects. Just something to get started discussing more than anything.