Does $.ready fire before or after all inline [removed]'s have been loaded?

后端 未结 4 948
逝去的感伤
逝去的感伤 2021-01-12 14:31

At the core, this is a javascript question but I\'m interfacing the event with jQuery.

Here\'s an example case:


  
    

        
相关标签:
4条回答
  • 2021-01-12 14:59

    Yes and yes.

    The execution of <script> elements is synchronous except when using the HTML5 "async" attribute. The synchronous execution of JavaScript is required (unless otherwise requested not to be) because the JavaScript can modify the document stream through document.write, etc. (However, the actual fetching of resources may be in parallel.)

    Happy coding.

    0 讨论(0)
  • 2021-01-12 15:02

    $(document).ready() would not be triggered prior to not_cached.js to be loaded and executed (assuming execution in not_chached.js is synchronous)

    0 讨论(0)
  • 2021-01-12 15:12

    Ready fires when all DOM elements are ready for manipulation.

    When the browser comes across a script element, DOM parsing stops until the script has been executed, so because of how it all works, it fires after all scripts are loaded.

    0 讨论(0)
  • 2021-01-12 15:18

    the $.ready script executes after the page is fully loaded, as the onload event does, however if an inline script is found then it is executed.

    0 讨论(0)
提交回复
热议问题