[email protected] wrote: > Issue 17063 http://codereview.appspot.com/17063 > Issue 967: embedded rendering mode should parenthesize post-decrement > inside comparisons > > The code > x-- > 3 > is valid javascript. > > HTML 4 says of the grammar for comments: > White space is not permitted between the markup declaration open > delimiter("<!") and the comment open delimiter ("--"), but is > permitted between the comment close delimiter ("--") and the > markup declaration close delimiter (">"). > > So the -- > in the javascript snippet above could end an HTML comment, thus > defeating embedded mode guarantees. This can be solved by rendering it as > (x--) > 3. > > This has to be done for post-decrement ops as the left hand argument to the > following operators >, >=, >>, >>>, >>=, >>>=. > > This may be a security issue if clients use embedding and browsers > implement escaping text spans using the same grammar as HTML4 comments. > > HTML5 has a tighter syntax for comments, and so a strict HTML5 parser would > not lose embedding.
I don't understand this issue. My reading of the HTML4 spec suggests that HTML comment delimiters are not supposed to be interpreted at all inside a <script> tag, and testing in IE7 and Firefox seems to be consistent with that. Embedded mode is only for embedding code in a <script> tag, isn't it? Here are the rules that I am hoping to use for Jacaranda 0.4 in order to allow it to be embedded in a <script> tag (in either HTML or XHTML). Assuming that the character encoding is correct and is UTF-8 or UTF-16, do you know of any other reason why these might not be sufficient? A Jacaranda source text MUST NOT contain the sequences of unescaped code units «]]>» or «</», or an initial subsequence of these at the end of the text. A Jacaranda source text MUST NOT contain the code unit «&» unless immediately followed by «&», «=», «(», «+», «-», «!», «~», «'», «"», «/», «\», <DecimalDigit>, <WhiteSpace>, or <LineTerminator>. (If followed by «&», the same restriction applies to the next code unit.) -- David-Sarah Hopwood ⚥
