QingWei-Li/vuep

关于解析的问题

xsdlr opened this issue · 4 comments

xsdlr commented

我看源码里解析template部分时会判断script标签是否在末尾并补全,我想问一下这么设计的原因,难道不考虑有些人的书写习惯会将style放在末尾

因为浏览器兼容性问题,在处理 <template></template> 效果不一致。。

<template>
<script>
 console.log(1)
</script>
</template>

在 Chrome 下调用 innerHTML 返回的结果是 <script>console.log(1)

xsdlr commented

感谢你的热心回答,之前可能我没表达清楚,我指的是vuep的template属性,比如在左边的编辑器区域输入以下代码

<template></template>
<script></script>
<style></style>

由于在解析步骤中的这步处理将会自动补全</script>,造成格式错误
我希望知道的是这个设计的原因

对 我回答的就是你这个问题,我设想的用法是 style > template > script 然后末尾的 script 可能会被一些浏览器忽略掉,所以我手动加了 script 闭合标签。没考虑到你的这个问题,那应该是 bug

I have used v-model, and :template to set the source code for the vuep component and It still adds the </script> tag at the end of the content. This 这步处理 isn't what I expect.

@QingWei-Li What browsers have the behavior where you need to append the </script> tag ?