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

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 opened this issue May 5, 2021 · 1 comment · May be fixed by #651
Labels
bug Something isn't working

Comments

@danielweck
Copy link

danielweck commented May 5, 2021

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.

@danielweck danielweck added the bug Something isn't working label May 5, 2021
@marvinhagemeister
Copy link
Member

Looks like my shitty hack didn't even last for a full day! 😂

@danielweck danielweck changed the title WMR 2.0.0 new prerender() returned head object with lang property caused all existing attributes to be removed (as documented in source code) WMR 2.0.0 new prerender() returned head object with lang property causes all existing attributes to be removed (as documented in source code) May 5, 2021
@marvinhagemeister marvinhagemeister linked a pull request May 30, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants