Moving the parent element of a <webview> to another element in the DOM causes reload

52 views
Skip to first unread message

Alexander Ewering

unread,
Dec 4, 2015, 4:20:27 PM12/4/15
to apps-dev
Hello,

in a Chrome app I'm developing, I sometimes need to move a webview's container element to a different parent container. Say it's roughly body > div1 > div2 > webview, I need to move div2 into another node (say, div3). So I do div3.appendChild(div1.removeChild(div2)). Unfortunately, no matter what I do, this causes the webview to lose all its state and reload the current URL.

Is there any way to prevent this from happening? It would require a huge amount of reengineering in this rather complex app to not have to move the node around.

Thanks.

Demetrios Papadopoulos

unread,
Dec 4, 2015, 7:30:00 PM12/4/15
to Alexander Ewering, apps-dev
Do you have to call removeChild() first?
According to https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild, you should be able to directly call div3.appendChild(div2), and it will take care of re-parenting div2. I don't know if this fixes your issue, but it is worth trying.

--
You received this message because you are subscribed to the Google Groups "apps-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apps-dev+u...@chromium.org.

ewe...@gmail.com

unread,
Dec 5, 2015, 11:12:06 AM12/5/15
to apps...@chromium.org

I've just tried to skip removing and instead appending directly as you suggested, however, the issue persists.

So, should this be filed as a bug? Or simply a limitation? If it is considered a limitation, it would still be great to have a way around it.

Michael

unread,
Jan 15, 2017, 5:34:20 PM1/15/17
to apps-dev, ewe...@gmail.com
I'm interested to know if this issue persists in 2017?
Reply all
Reply to author
Forward
0 new messages