Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For the sake of thoroughness and bringing a clear solution to my question to light, herewith my conclusion. Thank you all for your thoughts and suggestions, I've learnt a lot and clearly got people thinking!</p> <p>Initially I was hoping for a magical jQuery function that I'd perhaps overlooked, something along the lines of:</p> <pre><code>$("#parent-element").monitorDom(function(added_element){ ... }); </code></pre> <p>...but there just isn't anything, which is probably a good thing because I suspect I've stumbled onto poor code design, and allowing for hooks and callbacks is a better way to go. I.e.: use the smaller, established and tested building blocks instead of trying to over-engineer something.</p> <p>If you don't care about supporting Internet Explorer and it's quirks, you may definitely look at the <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Events/Mutation_events" rel="nofollow noreferrer">deprecated mutation events</a>, or their replacement the <a href="https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver" rel="nofollow noreferrer">MutationObserver</a>. Here is also a decently answered SO question with the use of mutators: <a href="https://stackoverflow.com/questions/2844565/is-there-a-jquery-dom-change-listener">Is there a JavaScript/jQuery DOM change listener?</a></p> <p>In a nutshell, as of this post, there is no built-in jQuery function to monitor DOM changes, and in my case my problem can be resolved with better code design. Thank you all for all the answers, and let's keep pushing the limits!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload