[elm-discuss] Re: Html.Keyed

2016-10-12 Thread Max Froumentin
Thanks OvermindDL1, that's very helpful. I now understand it's down to the 
lack of two-way binding. Makes sense.
Wouldn't it be useful to use a change of id attribute as a change of key?


On Tuesday, October 11, 2016 at 6:11:15 PM UTC+1, OvermindDL1 wrote:
>
> The ticked checkbox is because the user ticked it, it is some of the 
> implicit DOM state.  When the view changed to remove a checkbox but it 
> still had another one after, since they were not keyed it just did a 'diff' 
> between states.  The vdom has no information on any implicit state in the 
> actual DOM, in fact it does not access the actual DOM at all except to 
> apply patches, thus when it saw from its point of view that the checkbox 
> label had its name changed but nothing else different about it then it sent 
> a patch to change the text and that is all.  By changing the 'key' of it 
> then it knows that it is an entire tree change and will not even attempt a 
> patch but will instead rather re-generate the entire tree.
>
> Basically if a tree were to be regenerated just because some text changed 
> than that would make a virtual-dom extremely slow, its whole point is only 
> to generate a set of differences between two virtual-doms and apply those 
> differences to the real dom without ever reading anything from the real dom 
> (as that is very slow).
>
> It would indeed be preferable for checked-state to be controlled 
> exclusively via the model and view, however only an event is sent for those 
> changes and there is no way for the vdom to update its internal information 
> otherwise, and registering an event everywhere, even bubbled events, would 
> again make the vdom very slow and force the user to have to handle a lot of 
> extra cases (imagine checked state, text values, even focus and all being 
> controlled like this).
>
>
> On Tuesday, October 11, 2016 at 11:01:57 AM UTC-6, Max Froumentin wrote:
>>
>> Hi there,
>>
>> Today I raised https://github.com/elm-lang/virtual-dom/issues/37
>> Given there's no consensus on whether it's a bug, I'm bringing the 
>> discussion here.
>>
>> The reason why I think it's a bug is that the second time the view 
>> function runs it generates a ticked checkbox, although nowhere in the view 
>> function is there any indication that a ticked checkbox should be generated.
>>
>> The alternative view is that the checkbox that's been clicked on has only 
>> been mutated with new data. That's why it remains ticked. You need to use 
>> Html.Keyed to tell elm that it is an entirely new checkbox.
>>
>> I must say I'm not convinced why the view function should generate Html 
>> that depends on the previous state of the model.
>>
>> Thanks for any insight.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Html.Keyed

2016-10-11 Thread Max Froumentin
Hi there,

Today I raised https://github.com/elm-lang/virtual-dom/issues/37
Given there's no consensus on whether it's a bug, I'm bringing the 
discussion here.

The reason why I think it's a bug is that the second time the view function 
runs it generates a ticked checkbox, although nowhere in the view function 
is there any indication that a ticked checkbox should be generated.

The alternative view is that the checkbox that's been clicked on has only 
been mutated with new data. That's why it remains ticked. You need to use 
Html.Keyed to tell elm that it is an entirely new checkbox.

I must say I'm not convinced why the view function should generate Html 
that depends on the previous state of the model.

Thanks for any insight.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Old browsers

2016-08-24 Thread Max Froumentin
It's really about finding what browsers elm code won't run on.
On the project I'm working on, IE8 is in scope because we still have a 
significant number of users using it. If I want to introduce elm, it's 
easier to say it runs without a problem than to say some features won't 
work, or we need to polyfill. Same goes for any old browser with still some 
market share.


On Wednesday, August 24, 2016 at 7:37:33 PM UTC+1, OvermindDL1 wrote:
>
> It works fine at least in IE11 and Edge, of which my app is tested in and 
> works without issue.  Do you not mean just old versions like IE8 and older 
> (which need to die)?  Or what about 9 and 10 as well?
>
> On Wednesday, August 24, 2016 at 10:38:39 AM UTC-6, Rex van der Spuy wrote:
>>
>> Just wish to alert everyone that Elm's port code will not work with any 
>> version of IE without a ployfill for `Object.assign` (
>> https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
>> )
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Old browsers

2016-08-23 Thread Max Froumentin
Hi there,
Is there an official list of the browsers that the developers of elm 
support? I've found bits of discussions here and there, but nothing 
definitive (ie, that will help me introduce elm in a project that has to 
work in IE8-11).

Running elm in IE8 clearly doesn't work. A quick try at running various 
programs reveals that elm-reactor uses Object.keys, elm-core uses 
addEventListener, Platform.js has a misplaced comma at the end of an object 
definition. All of those make IE8 drop the JS code.

It's understandable if elm devs would choose not to support old browsers. 
But it would be useful to have a statement about it.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.