Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate doctypes #28089

Merged
merged 7 commits into from Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 6 additions & 9 deletions packages/next/server/render.tsx
Expand Up @@ -315,15 +315,12 @@ function renderDocument(
styles: docProps.styles,
head: docProps.head,
}
return (
'<!DOCTYPE html>' +
ReactDOMServer.renderToStaticMarkup(
<AmpStateContext.Provider value={ampState}>
<HtmlContext.Provider value={htmlProps}>
<Document {...htmlProps} {...docProps} />
</HtmlContext.Provider>
</AmpStateContext.Provider>
)
return ReactDOMServer.renderToStaticMarkup(
<AmpStateContext.Provider value={ampState}>
<HtmlContext.Provider value={htmlProps}>
<Document {...htmlProps} {...docProps} />
</HtmlContext.Provider>
</AmpStateContext.Provider>
)
}

Expand Down
5 changes: 5 additions & 0 deletions test/integration/production/test/index.test.js
Expand Up @@ -917,6 +917,11 @@ describe('Production Usage', () => {
expect(missing).toBe(false)
})

it('should only have one DOCTYPE', async () => {
const html = await renderViaHTTP(appPort, '/')
expect(html).toMatch(/^<!DOCTYPE html><html/)
})

if (global.browserName !== 'internet explorer') {
it('should preserve query when hard navigating from page 404', async () => {
const browser = await webdriver(appPort, '/')
Expand Down