I'd like you to do a code review. To review this change, run gvn review --project https://google-caja.googlecode.com/svn mikesamuel/[EMAIL PROTECTED]
Alternatively, to review the latest snapshot of this change branch, run gvn --project https://google-caja.googlecode.com/svn review mikesamuel/ignore-doctype to review the following change: *mikesamuel/[EMAIL PROTECTED] | mikesamuel | 2008-11-24 18:24:44 -0800 (Mon, 24 Nov 2008) Description: Issue 882: <!doctype> is a fatal error [When parsing a fragment of markup,] caja tends to consider <!doctype> directives fatal errors, even correctly placed ones. This includes Felix's patch and a modification to one of the existing DomParser unittests to exercise that code path. Affected Paths: M //trunk/src/com/google/caja/parser/html/DomParser.java M //trunk/tests/com/google/caja/parser/html/DomParserTest.java This is a semiautomated message from "gvn mail". See <http://code.google.com/p/gvn/> to learn more. Index: src/com/google/caja/parser/html/DomParser.java =================================================================== --- src/com/google/caja/parser/html/DomParser.java (^/trunk/src/com/google/caja/parser/html/[EMAIL PROTECTED]) +++ src/com/google/caja/parser/html/DomParser.java (^/changes/mikesamuel/ignore-doctype/trunk/src/com/google/caja/parser/html/[EMAIL PROTECTED]) @@ -147,9 +147,11 @@ public final class DomParser { // one exception for whitespace preceding the prologue. Token<HtmlTokenType> t = tokens.peek(); - if (HtmlTokenType.COMMENT == t.type) { - tokens.advance(); - continue; + switch (t.type) { + case COMMENT: + case DIRECTIVE: // expecially DOCTYPEs + tokens.advance(); + continue; } parseDom(elementStack); Index: tests/com/google/caja/parser/html/DomParserTest.java =================================================================== --- tests/com/google/caja/parser/html/DomParserTest.java (^/trunk/tests/com/google/caja/parser/html/[EMAIL PROTECTED]) +++ tests/com/google/caja/parser/html/DomParserTest.java (^/changes/mikesamuel/ignore-doctype/trunk/tests/com/google/caja/parser/html/[EMAIL PROTECTED]) @@ -1680,17 +1680,18 @@ public class DomParserTest extends CajaTestCase { "<xmp><br/></xmp>" ), Arrays.asList( - "Tag : html 2+1-2+17", - " Tag : head 2+1-2+1", - " Tag : body 2+1-2+17", - " Tag : xmp 2+1-2+17", - " Text : <br/> 2+6-2+11" + "Fragment 1+56-2+17", + " Tag : xmp 2+1-2+17", + " Text : <br/> 2+6-2+11" ), Arrays.<String>asList(), Arrays.asList( - "<html><head></head><body><xmp><br/></xmp></body></html>" + "<xmp><br/></xmp>" ), - null, false); + null, + // We have one of these type guessing tests parse a fragment to tests + // the behavior of fragments around DOCTYPEs. + true); } public void testDoctypeGuessAsXhtml() throws Exception { --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to http://groups.google.com/group/google-caja-discuss To unsubscribe, email [EMAIL PROTECTED] -~----------~----~----~----~------~----~------~--~---
