Does inline javascript block the UI thread?
blocking, javascript, nonblocking, src, ui-thread
Solution
Any loading of a JS file or any execution of any JS (whether in an external file or inline) will block the UI thread.
The exception for the `<script>` tag is an asynchronous load where the script will load and execute asynchronously in the background.
There are also "deferred" loads (i.e. the `defer` attribute) which tells the browser not to actually execute the JS therein until the rest of the page has loaded.
Problem
I read this nice article on how external scripts block the UI thread but it wasn't clear to me whether the blocking is actually due to the presence of the `<script>` tag or the `src='/myscript.js'` src attribute. My question is does inline javascript (lacking a src attribute declaration), for example this: ``` <script type='text/javascript'> alert('am i blocking too?');</script> ``` or this: ``` <script type='text/javascript'> var php='<?=json_encode($myObj)?>';</script> ``` also block the UI thread?