Monday, March 28, 2016

How can I set the parent of an Element?

I am "injecting" HTML code into a contenteditable <div>. Since any content there could potentially be removed with e.g. BACKSPACE, I want to know when this elements are getting detached in order to remove the whole panel from the parent contenteditable div.

However, these events don't seem to work. I managed to get events like Event.ONKEYPRESS etc. but no Attach/DetachEvent.

I also tried a MutationObserver [1] - this is giving me at least the attach/detach event but the problem is that the elements which are coming in, at least those of which I am interested in, do not have a parent.

You can have a look at the code on my github repository if you want but please keep in mind this is just my own experimental stuff. Here [2] is how I "inject" the HTML code into the contenteditable at the caret position and here [3]
you can see the line where I have the problem of the parent being null.

Widget does have a setParent() method but I cannot override it.


You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment