Handle supported doctypes as expected in AUTO mode. r=hsivonen.
authorMichael[tm] Smith <mike@w3.org>
Mon, 04 Nov 2013 21:59:28 +0900
changeset 755 2a1a57b4c8ff8b1258bcc5d41f5242d414b66d36
parent 754 7d3cb0808da6fee74219005362b95327cbea2091
child 756 4213245790e0fe6c706e123fc27000e967f691f3
push id101
push userhsivonen@mozilla.com
push dateMon, 04 Nov 2013 14:11:21 +0000
reviewershsivonen
Handle supported doctypes as expected in AUTO mode. r=hsivonen.
src/nu/validator/htmlparser/impl/TreeBuilder.java
--- a/src/nu/validator/htmlparser/impl/TreeBuilder.java
+++ b/src/nu/validator/htmlparser/impl/TreeBuilder.java
@@ -829,19 +829,27 @@ public abstract class TreeBuilder<T> imp
                         if (firstCommentLocation != null) {
                             warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
                                     firstCommentLocation);
                         }
                         if ("-//W3C//DTD HTML 4.01//EN".equals(publicIdentifier)) {
                             if (!"http://www.w3.org/TR/html4/strict.dtd".equals(systemIdentifier)) {
                                 warn("The doctype did not contain the system identifier prescribed by the HTML 4.01 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
                             }
+                        } else if ("-//W3C//DTD XHTML 1.0 Strict//EN".equals(publicIdentifier)) {
+                            if (!"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".equals(systemIdentifier)) {
+                                warn("The doctype did not contain the system identifier prescribed by the XHTML 1.0 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\u201D.");
+                            }
+                        } else if ("//W3C//DTD XHTML 1.1//EN".equals(publicIdentifier)) {
+                            if (!"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd".equals(systemIdentifier)) {
+                                warn("The doctype did not contain the system identifier prescribed by the XHTML 1.1 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\u201D.");
+                            }
                         } else if (!((systemIdentifier == null || Portability.literalEqualsString(
                                 "about:legacy-compat", systemIdentifier)) && publicIdentifier == null)) {
-                            err("Legacy doctype. Expected e.g. \u201C<!DOCTYPE html>\u201D.");
+                            err("Unexpected doctype. Expected, e.g., \u201C<!DOCTYPE html>\u201D.");
                         }
                         documentModeInternal(DocumentMode.STANDARDS_MODE,
                                 publicIdentifier, systemIdentifier, html4);
                     }
                     break;
                 case NO_DOCTYPE_ERRORS:
                     if (isQuirky(name, publicIdentifier, systemIdentifier,
                             forceQuirks)) {