Dynamic script addition should be ordered?

后端 未结 6 2011
花落未央
花落未央 2020-12-16 04:31

I\'m adding some

6条回答
  •  死守一世寂寞
    2020-12-16 05:16

    I was investigating this while working on a little library that loads modules dynamically like YUI 3. I created a little test here that loads two scripts that just insert content into divs. One is a common JS file and the other is a PHP file that waits 3 seconds to execute.

    http://www.juandopazo.com.ar/tests/asyn-script-test.html

    As you can see, scripts are executed when they finish loading, and not in the order in which you append them to the DOM, in every browser.

提交回复
热议问题