You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The script and style elements are pretty weird, and would probably need special handling. HTML escaping inside of them makes no sense, but on the other hand, they cannot contain their respective end-tag verbatim. (I think the rules are actually even more strict than this. In Html 4.01, even "</" wasn't allowed in either. It looks like the same is true at least for script in HTML 5, I'm not sure about style.)
The text was updated successfully, but these errors were encountered:
Regarding script and style elements, I found the relevant bits in the HTML 5 spec. These elements are called "raw text elements" in HTML 5. From the spec:
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 (/).
It would be safer if strings were escaped based on context. In particular:
HTML escaping inside of most HTML elements
Attribute escaping inside attribute values:
The
script
andstyle
elements are pretty weird, and would probably need special handling. HTML escaping inside of them makes no sense, but on the other hand, they cannot contain their respective end-tag verbatim. (I think the rules are actually even more strict than this. In Html 4.01, even "</" wasn't allowed in either. It looks like the same is true at least for script in HTML 5, I'm not sure about style.)The text was updated successfully, but these errors were encountered: