MithrilJS / mithril.js

A JavaScript Framework for Building Brilliant Applications
https://mithril.js.org
MIT License
14.02k stars 925 forks source link

Bug in DOM rendering #150

Closed iOliverNguyen closed 10 years ago

iOliverNguyen commented 10 years ago

I created this fiddle: http://jsfiddle.net/3933g/ When we click the button on the right the second time to close the menu, the button disappears.

This bug appears in version 0.1.16, 0.1.17 and 0.1.18. Version 0.1.15 is ok.

sdemjanenko commented 10 years ago

That is a little odd. I tracked it down to demo.menu returning m(...) vs []. I made a working version: http://jsfiddle.net/3933g/1/

iOliverNguyen commented 10 years ago

Thank you, sdemjanenko. But we expect that the framework should handle it, not the user.

My code worked with 0.1.15. Then we switch to 0.1.18 and things suddenly blow up :( I can fix my code to make it work again but the bug is still there.

lhorie commented 10 years ago

Thanks for reporting. I'll look into it.

lhorie commented 10 years ago

This is fixed in origin/next and scheduled to be released in v0.1.19

As a workaround until 0.1.19 is released, you can use null instead of an empty array when doing conditionals in templates. As a matter of fact, using nulls in conditionals is more efficient.

avilaj commented 10 years ago

Good to know about the use of null! Thanks.

2014-07-06 21:39 GMT-05:00 Leo Horie notifications@github.com:

This is fixed in origin/next and scheduled to be released in v0.1.19

As a workaround until 0.1.19 is released, you can use null instead of an empty array when doing conditionals in templates. As a matter of fact, using nulls in conditionals is more efficient.

— Reply to this email directly or view it on GitHub https://github.com/lhorie/mithril.js/issues/150#issuecomment-48136418.

Jorge E. Avila http://profile-javila.rhcloud.com/#/ Diseño y desarrollo. Cel: 3218873506