开发者

Do layout engines publish events?

开发者 https://www.devze.com 2023-02-12 22:33 出处:网络
Is there a wayto 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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号