Matt-Esch/virtual-dom

using iframes in a dynamic list

samu opened this issue · 0 comments

samu commented

I'm using virtual-dom indirectly through elm and the elm-html package. I asked this question in the elm mailing list as well: topic.

What i have is the following scenario: I have a list of iframes (i use them to display soundcloud players). iframes can be added to the list dynamically by entering a url in an input field which will then be used to populate the iframe. So for example, a user could submit urlA, urlB and urlC to the input field, and we would end up with this dom:

<iframe src="urlA"></iframe>
<iframe src="urlB"></iframe>
<iframe src="urlC"></iframe>

The problem occurs when deleting one of these iframes: It causes all of the iframes below it to reload.

Lets say i remove iframe with urlB. When looking at the chrome dev tools, i see the following behaviour:

Iframe for urlC is removed
src-attribute of Iframe with urlB is populated with urlC, hence causing it to reload.

How would i solve such behaviour? I'd expect virtual-dom to just remove iframe with urlB without touching the others.