如果我的HTML5组件/ WebComponent的component.html
文件定义了<template>
,则在其中进行<!DOCTYPE html>
声明component.html
是否有意义?也就是说,以下哪项是最佳做法?
<template>
<!-- some html content -->
</template>
要么
<!DOCTYPE html>
<template>
<!-- some html content -->
</template>
在所有支持该template
元素的现代浏览器中,两者都将以相同的方式进行解析和处理。
一个是轻了几个八位字节!
因此,这取决于您是否更喜欢速度而不是严格的标准合规性
遵循KISS原则:我编写(和阅读)的代码越少,我感觉越好;-)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句