Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于解析的问题 #17

Open
xsdlr opened this issue Aug 1, 2017 · 4 comments
Open

关于解析的问题 #17

xsdlr opened this issue Aug 1, 2017 · 4 comments

Comments

@xsdlr
Copy link

xsdlr commented Aug 1, 2017

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

@QingWei-Li
Copy link
Owner

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

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

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

@xsdlr
Copy link
Author

xsdlr commented Aug 2, 2017

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

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

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

@QingWei-Li
Copy link
Owner

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

@jaunkst
Copy link

jaunkst commented Apr 5, 2018

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants