Skip to content

WMR 2.0.0 new prerender() returned head object with lang property causes all existing attributes to be removed (as documented in source code) #593

Open
@danielweck

Description

I know that you know :D

if (head.lang) {
// TODO: This removes any existing attributes, but merging them without
// a proper HTML parser is way too error prone.
html = html.replace(/(<html(\s[^>]*?)?>)/, `<html lang="${enc(head.lang)}">`);
}

...but I just wanted to file an issue so that this problem isn't "forgotten" due to other development priorities.

My workaround for this bug is to not set lang in head, and to supply the attribute directly in index.html (alongside the other attributes I need, notably dir="ltr"). There are of course other possible workarounds, such as setting dir="ltr" on body instead, but I have other attributes on the html root element which are used to enforce CSS specificity (notably: id).

So for me this is not a deal breaker as I can just set all required attributes statically in index.html, but this could be problematic for other devs.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions