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

<input> <textarea> <xmp>等标签中内容不做格式检查 #15

Open
nighca opened this issue Jan 15, 2015 · 9 comments
Open

<input> <textarea> <xmp>等标签中内容不做格式检查 #15

nighca opened this issue Jan 15, 2015 · 9 comments

Comments

@nighca
Copy link
Member

nighca commented Jan 15, 2015

几个疑问,

  • input不是应该没有内容吗
  • 是什么规则都不检查吗
@otakustay
Copy link
Member

  1. <input>是没内容的吧
  2. <textarea这种东西的内部就是纯文本,没有任何规则才对

@chriswong
Copy link
Member

嗯,input 可以去掉,textarea 如果要求严格的话,里面的 <> 应该要转成实体吧?

补充,script[type] 为非脚本类型的值时,按模板处理,脚本时要考虑作脚本的规范检查

@nighca
Copy link
Member Author

nighca commented Jan 15, 2015

按模板处理就是不检查吧,现在遇上script跟style会把里边东西当纯文本。

脚本的规范检查是指要把jshint,csshint的事也做了?

@otakustay
Copy link
Member

<textarea>里应该做encode,这个可以检查,script要符合"restriction on script content",简单来说就是里面不能出现</script>这个串

@chriswong
Copy link
Member

按模板处理就是不检查吧,现在遇上script跟style会把里边东西当纯文本。

脚本的规范检查是指要把jshint,csshint的事也做了?

肯定不重复做,要有个机制抛出来来我接着处理,这块还要想想

@nighca
Copy link
Member Author

nighca commented Jan 15, 2015

<textarea>里应该做encode,这个可以检查,script要符合"restriction on script content",简单来说就是里面不能出现</script>这个串

textarea单独加一条规则检查内容就好了。

但是script的话,如果里边出现</script>,解析器会直接认为script结束了,所以是没法检查的。应该会表现为其后边的标签语法错误。

@Justineo
Copy link
Member

<textarea> 里面不是也只要不匹配 </textarea> 就行么?

@otakustay
Copy link
Member

@Justineo 从标准上来看不是……

关于<textarea>

Content model:
Text.

关于<script>

Content model:
If there is no src attribute, depends on the value of the type attribute, but must match script content restrictions.
If there is a src attribute, the element must be either empty or contain only script documentation that also matches script content restrictions.

"script content restrictions"说的就是不能出现</script>

@Justineo
Copy link
Member

12.1.2.6 Restrictions on the contents of raw text and escapable raw text elements

The text in raw text and escapable raw text elements must not contain any occurrences of the string "</" (U+003C LESS-THAN SIGN, U+002F SOLIDUS) followed by characters that case-insensitively match the tag name of the element followed by one of U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), U+0020 SPACE, U+003E GREATER-THAN SIGN (>), or U+002F SOLIDUS (/).

其中 escapable raw text elements 包括 textareatitle

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

4 participants