Skip to content

Commit 0fde851

Browse files
sideshowbarkerhsivonen
authored andcommitted
Ensure doctype name is set to null when missing
This change ensures that the tokenizer sets the doctype name to null when the doctype name is missing in the input source. Otherwise, without this change, the doctype name is set to the empty string — which doesn’t conform to the requirements in the HTML spec, and which causes us to fail 9 tests in the html5lib-tests suite. Relates to #35
1 parent 6c124b3 commit 0fde851

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6119,7 +6119,7 @@ private void initDoctypeFields() {
61196119
// Discard the characters "DOCTYPE" accumulated as a potential bogus
61206120
// comment into strBuf.
61216121
clearStrBufAfterUse();
6122-
doctypeName = "";
6122+
doctypeName = null;
61236123
if (systemIdentifier != null) {
61246124
Portability.releaseString(systemIdentifier);
61256125
systemIdentifier = null;
@@ -6430,7 +6430,7 @@ public void eof() throws SAXException {
64306430
* Create a new DOCTYPE token. Set its force-quirks flag
64316431
* to on.
64326432
*/
6433-
doctypeName = "";
6433+
doctypeName = null;
64346434
if (systemIdentifier != null) {
64356435
Portability.releaseString(systemIdentifier);
64366436
systemIdentifier = null;

0 commit comments

Comments
 (0)