On Wednesday, March 1, 2017 at 11:19:02 AM UTC, Rupert Smith wrote:
>
> On Tuesday, February 28, 2017 at 10:54:56 PM UTC, Witold Szczerba wrote:
>>
>> Hi,
>> few days ago I was trying to embed a date picker in my Elm app. I have 
>> used MutationObserver, so in Elm all I have to do is to add a specific 
>> class and custom event handler, so there is no need to track it by "id". 
>> The mutation observer is attached at the top node of the Elm app. This 
>> works OK so far.
>>
>
> I think I can still find the nodes by id, instead of class. The reason id 
> was not working for me, is that I was finding the id, then attaching a 
> mutation observer to that node. The node would then be replaced by a new 
> one with the same id, but it is not the same node, so the mutation observer 
> is not watching it.
>
> The way you are doing it is to watch for mutations at the top-level, then 
> find a particular class. I should be able to do the same; watch for 
> mutations at the top-level, then find a particular id. 
>

I think I will use a class though. Then I can watch for resize events on a 
particular class and report the event and the id together. Inspired by your 
use of custom events, I can then achieve all of this without using any 
ports and subscriptions - very nice idea, thanks. 

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to