Skip to content

Commit 5a209fd

Browse files
zcorpansideshowbarker
authored andcommitted
Remove warning about comments before doctype
This only applied to IE6..9, and does not apply to conditional comments.
1 parent da6c1ec commit 5a209fd

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

src/nu/validator/htmlparser/impl/TreeBuilder.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,6 @@ public abstract class TreeBuilder<T> implements TokenHandler,
391391

392392
private DoctypeExpectation doctypeExpectation = DoctypeExpectation.HTML;
393393

394-
private LocatorImpl firstCommentLocation;
395-
396394
// ]NOCPP]
397395

398396
private boolean scriptingEnabled = false;
@@ -614,7 +612,6 @@ final void warn(String message, Locator locator) throws SAXException {
614612
html4 = false;
615613
idLocations.clear();
616614
wantingComments = wantsComments();
617-
firstCommentLocation = null;
618615
// ]NOCPP]
619616
start(fragment);
620617
charBufferLen = 0;
@@ -763,22 +760,12 @@ public final void doctype(@Local String name, String publicIdentifier,
763760
publicIdentifier, systemIdentifier, false);
764761
} else if (isAlmostStandards(publicIdentifier,
765762
systemIdentifier)) {
766-
// [NOCPP[
767-
if (firstCommentLocation != null) {
768-
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
769-
firstCommentLocation);
770-
}
771-
// ]NOCPP]
772763
errAlmostStandardsDoctype();
773764
documentModeInternal(
774765
DocumentMode.ALMOST_STANDARDS_MODE,
775766
publicIdentifier, systemIdentifier, false);
776767
} else {
777768
// [NOCPP[
778-
if (firstCommentLocation != null) {
779-
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
780-
firstCommentLocation);
781-
}
782769
if ((Portability.literalEqualsString(
783770
"-//W3C//DTD HTML 4.0//EN", publicIdentifier) && (systemIdentifier == null || Portability.literalEqualsString(
784771
"http://www.w3.org/TR/REC-html40/strict.dtd",
@@ -821,19 +808,11 @@ public final void doctype(@Local String name, String publicIdentifier,
821808
publicIdentifier, systemIdentifier, true);
822809
} else if (isAlmostStandards(publicIdentifier,
823810
systemIdentifier)) {
824-
if (firstCommentLocation != null) {
825-
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
826-
firstCommentLocation);
827-
}
828811
err("Almost standards mode doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
829812
documentModeInternal(
830813
DocumentMode.ALMOST_STANDARDS_MODE,
831814
publicIdentifier, systemIdentifier, true);
832815
} else {
833-
if (firstCommentLocation != null) {
834-
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
835-
firstCommentLocation);
836-
}
837816
if ("-//W3C//DTD HTML 4.01//EN".equals(publicIdentifier)) {
838817
if (!"http://www.w3.org/TR/html4/strict.dtd".equals(systemIdentifier)) {
839818
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.");
@@ -855,10 +834,6 @@ public final void doctype(@Local String name, String publicIdentifier,
855834
publicIdentifier, systemIdentifier, true);
856835
} else if (isAlmostStandards(publicIdentifier,
857836
systemIdentifier)) {
858-
if (firstCommentLocation != null) {
859-
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
860-
firstCommentLocation);
861-
}
862837
if ("-//W3C//DTD HTML 4.01 Transitional//EN".equals(publicIdentifier)
863838
&& systemIdentifier != null) {
864839
if (!"http://www.w3.org/TR/html4/loose.dtd".equals(systemIdentifier)) {
@@ -871,10 +846,6 @@ public final void doctype(@Local String name, String publicIdentifier,
871846
DocumentMode.ALMOST_STANDARDS_MODE,
872847
publicIdentifier, systemIdentifier, true);
873848
} else {
874-
if (firstCommentLocation != null) {
875-
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
876-
firstCommentLocation);
877-
}
878849
err("The doctype was not the HTML 4.01 Transitional doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
879850
documentModeInternal(DocumentMode.STANDARDS_MODE,
880851
publicIdentifier, systemIdentifier, true);
@@ -892,19 +863,11 @@ public final void doctype(@Local String name, String publicIdentifier,
892863
publicIdentifier, systemIdentifier, html4);
893864
} else if (isAlmostStandards(publicIdentifier,
894865
systemIdentifier)) {
895-
if (firstCommentLocation != null) {
896-
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
897-
firstCommentLocation);
898-
}
899866
errAlmostStandardsDoctype();
900867
documentModeInternal(
901868
DocumentMode.ALMOST_STANDARDS_MODE,
902869
publicIdentifier, systemIdentifier, html4);
903870
} else {
904-
if (firstCommentLocation != null) {
905-
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
906-
firstCommentLocation);
907-
}
908871
if ("-//W3C//DTD HTML 4.01//EN".equals(publicIdentifier)) {
909872
if (!"http://www.w3.org/TR/html4/strict.dtd".equals(systemIdentifier)) {
910873
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.");
@@ -978,9 +941,6 @@ public final void comment(@NoLength char[] buf, int start, int length)
978941
throws SAXException {
979942
needToDropLF = false;
980943
// [NOCPP[
981-
if (firstCommentLocation == null) {
982-
firstCommentLocation = new LocatorImpl(tokenizer);
983-
}
984944
if (!wantingComments) {
985945
return;
986946
}

0 commit comments

Comments
 (0)