fix: attributes on <body> not being rendered (#1648)
This commit is contained in:
@@ -67,6 +67,7 @@ export function renderOuterDocument(
|
|||||||
docHead,
|
docHead,
|
||||||
renderedHtmlTag,
|
renderedHtmlTag,
|
||||||
docTitle,
|
docTitle,
|
||||||
|
docBody,
|
||||||
docHeadNodes,
|
docHeadNodes,
|
||||||
headVNodes,
|
headVNodes,
|
||||||
} = state;
|
} = state;
|
||||||
@@ -90,7 +91,10 @@ export function renderOuterDocument(
|
|||||||
h("link", { rel: "modulepreload", href: src })
|
h("link", { rel: "modulepreload", href: src })
|
||||||
),
|
),
|
||||||
headVNodes,
|
headVNodes,
|
||||||
h("body", { dangerouslySetInnerHTML: { __html: opts.bodyHtml } }),
|
h("body", {
|
||||||
|
...docBody,
|
||||||
|
dangerouslySetInnerHTML: { __html: opts.bodyHtml },
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -66,3 +66,15 @@ Deno.test("don't duplicate <title>", async () => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test("sets <html> + <head> + <body> classes", async () => {
|
||||||
|
await withFresh(
|
||||||
|
"./tests/fixture_explicit_app/main.ts",
|
||||||
|
async (address) => {
|
||||||
|
const doc = await fetchHtml(`${address}`);
|
||||||
|
assertSelector(doc, "html.html");
|
||||||
|
assertSelector(doc, "head.head");
|
||||||
|
assertSelector(doc, "body.body");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ export default function App(
|
|||||||
{ Component, state }: AppProps<unknown, { lang: string }>,
|
{ Component, state }: AppProps<unknown, { lang: string }>,
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<html lang={state.lang}>
|
<html lang={state.lang} class="html">
|
||||||
<head>
|
<head class="head">
|
||||||
<meta charSet="utf-8" />
|
<meta charSet="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>fresh title</title>
|
<title>fresh title</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="body">
|
||||||
<div class="inner-body">
|
<div class="inner-body">
|
||||||
<Component />
|
<Component />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user