在Script Src标记中包含脚本? < script> (JavaScript等) [英] Having Script within a Script Src tag? <script> (JavaScript etc)
本文介绍了在Script Src标记中包含脚本? < script> (JavaScript等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么这不起作用?
<script type="text/javascript" src="//cdn.com/assets/js/jquery.js">
alert("Hello World!");
</script>
但这是吗?
<script type="text/javascript" src="//cdn.com/assets/js/jquery.js"></script>
<script type="text/javascript">
alert("Hello World!");
</script>
这在从源中提取的许多HTML标记中很普遍. 微观优化对我来说很重要,我也很好奇.
This is general across many HTML tags that pull from source. Micro optimization is important in my situation and I am also curious.
推荐答案
来自 w3.org (重点是我):
如果src具有URI值,则用户代理必须忽略元素的 内容,然后通过URI检索脚本.
If the src has a URI value, user agents must ignore the element's contents and retrieve the script via the URI.
这篇关于在Script Src标记中包含脚本? < script> (JavaScript等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文