Skip to content

Commit 066f019

Browse files
committed
on the way to use html5 doctype for all our tests
1 parent 6545b7e commit 066f019

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/main/java/org/htmlunit/MockWebConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public void setResponse(final URL url, final String content, final String conten
386386
* @param title the title of the page
387387
*/
388388
public void setResponseAsGenericHtml(final URL url, final String title) {
389-
final String content = "<html><head><title>" + title + "</title></head><body></body></html>";
389+
final String content = "<!DOCTYPE html><html><head><title>" + title + "</title></head><body></body></html>";
390390
setResponse(url, content);
391391
}
392392

src/main/java/org/htmlunit/WebResponseData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept
113113
LOG.error("Reading gzip encodec content failed.", e);
114114
stream.close();
115115
stream = IOUtils.toInputStream(
116-
"<html>\n"
116+
"<!DOCTYPE html><html>\n"
117117
+ "<head><title>Problem loading page</title></head>\n"
118118
+ "<body>\n"
119119
+ "<h1>Content Encoding Error</h1>\n"
@@ -136,7 +136,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept
136136
LOG.error("Reading Brotli encodec content failed.", e);
137137
stream.close();
138138
stream = IOUtils.toInputStream(
139-
"<html>\n"
139+
"<!DOCTYPE html><html>\n"
140140
+ "<head><title>Problem loading page</title></head>\n"
141141
+ "<body>\n"
142142
+ "<h1>Content Encoding Error</h1>\n"

src/main/java/org/htmlunit/javascript/host/dom/DOMImplementation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ public HTMLDocument createHTMLDocument(final Object titleObj) {
241241
final WebWindow webWindow = getWindow().getWebWindow();
242242
final String html;
243243
if (JavaScriptEngine.isUndefined(titleObj)) {
244-
html = "<html><head></head><body></body></html>";
244+
html = "<!DOCTYPE html><html><head></head><body></body></html>";
245245
}
246246
else {
247-
html = "<html><head><title>"
247+
html = "<!DOCTYPE html><html><head><title>"
248248
+ JavaScriptEngine.toString(titleObj)
249249
+ "</title></head><body></body></html>";
250250
}

0 commit comments

Comments
 (0)