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

<!DOCTYPE html> tag is never rendered #2338

Open
thinety opened this issue Feb 19, 2024 · 1 comment
Open

<!DOCTYPE html> tag is never rendered #2338

thinety opened this issue Feb 19, 2024 · 1 comment
Milestone

Comments

@thinety
Copy link

thinety commented Feb 19, 2024

Describe the bug
<!DOCTYPE html> tag does not show up when rendering a view.

Leptos Dependencies

leptos = { version = "0.6", features = ["ssr", "experimental-islands"] }

To Reproduce
Code to reproduce the behavior:

use leptos::{ssr, component, view, IntoView};

#[component]
fn App() -> impl IntoView {
    view! {
        <!DOCTYPE html>
        <html>
        </html>
    }
}

fn main() {
    println!("{}", ssr::render_to_string(App));
}

Expected behavior
Expected to print <!DOCTYPE html><html></html>, but prints only <html></html>.

Additional context
When server side rendering, these are the relevant lines:

Node::Comment(_) | Node::Doctype(_) => quote! {},

Node::Comment(_) | Node::Doctype(_) => {}

When rendering on the client side, the logic is about the same.

Since the Node::Doctype(_) pattern is being handled explicitly, I am not sure if this behavior is by design. It was a little surprising for me when I first encountered it.

@gbj gbj added this to the 0.7 milestone Feb 22, 2024
@gbj
Copy link
Collaborator

gbj commented Feb 22, 2024

I can confirm this already works in the different implementation for the next version. I never intended this to be used as a general-purpose HTML templating library, so DOCTYPE just does nothing. The alternative for this versio would be to emit a compile error in the proc macro in the Node::Doctype(_) branch, to make it clearer. A PR adding that would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants