Is there a way to listen to layout engine events ? , something like "finished_rendering_element" or something of that sort ? , i.e. : i want to be informed when a div with an id of "mydiv" has been rendered ? i could do that by including a settimout in the top of the page and testing the dom and execute approximately at the time it is aval开发者_StackOverflowiable but i was wondering if there is a better way ?
I am not aware of any JavaScript interfaces or events on this level being exposed by any browser.
And probably rightly so: I can hardly think of scenarios where such fine-grained event control would make real-world sense.
It is possible to place <script>
tags after an element:
<a id="my_link">Link</a>
<script>....</script>
you can safely assume that the a
element is available to you in the script.
Other than that, you are left with the DOMReady
and load
events.
精彩评论