Scenario: An element needs to be inserted into a page's <div class="insertHere">
element. The insertHere element is not created until later in the page's lifecycle (either a user action results in the creatation of the insertHere element, or after a certain period of time the insertHere element is created).
Currently, my code inserts an element only once the page is loaded. This results in a lack of the inserted element when the insertHere element of the page does not exist originally.
More specifically: I am writing a plugin that inserts a new button into YouTube's button toolbar found at the bottom of their video player. This new button is easily inserted when the video player is loaded right away, but if the user first starts at, for example, YouTube's homepage, and then navigates to a video, I believe some form of AJAX is used to update the page and thus my extension is not able to insert the new button into the toolbar.