c******l 发帖数: 3972 | 1 一般写网页,
当然页面也是work的。这个页面里基本是空的,只是个placeholder。页面构造
完全由script完成。常识来讲这段 : : |
p*****w 发帖数: 429 | 3 是什么公司?
script放在head是在render head的时候用,很多追踪,统计用。body是body render网
页用。
【在 c******l 的大作中提到】 : 一般写网页, : :
|
s****y 发帖数: 503 | 4 这样也work javascript容错性是强啊 |
l**********n 发帖数: 8443 | 5 这和JavaScript有毛关系。
【在 s****y 的大作中提到】 : 这样也work javascript容错性是强啊
|
c******l 发帖数: 3972 | 6 这段script是页面构造需要的,是不是应该放在里比较好?我不明白的就是为什
么要放在和的外面,而且也work。我也不确定这样做是不是有什么特殊的
目的。有人知道吗? |
d*******r 发帖数: 3299 | 7 好像 AngularJS 例外,要放在前面?
因为 AngularJS client 端的 page 是 script generate 出来的.
【在 l**********n 的大作中提到】 : script 一般放在最后,放在head是bad practice.
|
l**********n 发帖数: 8443 | 8 inline javascript and too many script tags are bad practice too. usually you
concatenate all the JavaScript files and just include one js file. angular
guys would use grunt to concatenate all the js files into one file.
requirejs guys would use require to include the js files when they are
needed and use almond to optimize it and include just one file. |
d*******r 发帖数: 3299 | 9 "angular guys would use grunt to concatenate all the js files into one file"
这个是你研究后的 AngularJS load module 的 best practice? 这个我还真没研究过
,现在 AngularJS 程序很小.
you
angular
【在 l**********n 的大作中提到】 : inline javascript and too many script tags are bad practice too. usually you : concatenate all the JavaScript files and just include one js file. angular : guys would use grunt to concatenate all the js files into one file. : requirejs guys would use require to include the js files when they are : needed and use almond to optimize it and include just one file.
|
n*****t 发帖数: 22014 | 10 不想放在 head 里,原因已经解释,又要保持 body 干净
【在 c******l 的大作中提到】 : 一般写网页, : :
|
l**********n 发帖数: 8443 | 11 you keep modules in separate files, but concatenate them together so you
need only one script tag in html.
file"
【在 d*******r 的大作中提到】 : "angular guys would use grunt to concatenate all the js files into one file" : 这个是你研究后的 AngularJS load module 的 best practice? 这个我还真没研究过 : ,现在 AngularJS 程序很小. : : you : angular
|
d*******r 发帖数: 3299 | 12 恩,回头试试
【在 l**********n 的大作中提到】 : you keep modules in separate files, but concatenate them together so you : need only one script tag in html. : : file"
|
l**********n 发帖数: 8443 | 13 In general, the CSS for a web page should be loaded at the beginning of the
document within the head, while the JavaScript for a web page should be
loaded at the end, just before the closing body tag. The reason for these
unique placements is because CSS can be loaded while the rest of the website
is being loaded as well. JavaScript, on the other hand, can only render one
file at a time, thus prohibiting anything else from loading. |
c******l 发帖数: 3972 | 14 和Python一样,单线程的致命伤
the
website
one
【在 l**********n 的大作中提到】 : In general, the CSS for a web page should be loaded at the beginning of the : document within the head, while the JavaScript for a web page should be : loaded at the end, just before the closing body tag. The reason for these : unique placements is because CSS can be loaded while the rest of the website : is being loaded as well. JavaScript, on the other hand, can only render one : file at a time, thus prohibiting anything else from loading.
|