Element added to visible DOM event -


is there dom event when element added visible dom?

to describe better:

i have div element created, not yet added document. i'm adding child it. @ moment need calculations based on child rect - if take rect @ moment getclientboundingrect - "zero" element not yet displayed.

the problem don't know when parent div added document can't apply logic after.

let p = document.createelement("div"); let c = document.createelement("div"); c.textcontent = "boo!"; c.addeventlistener("some cool event", () => { alert("boo!")});  p.appendchild(c);  document.body.appendchild(p);  // "some cool event" trigger @ moment 

was thinking mutationobserver - not sure applies here. thanks!


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -