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

TypeError: Cannot read properties of null (reading 'cloneNode') at r.active #871

Closed
Mecanik opened this issue Jan 27, 2023 · 4 comments · Fixed by #872
Closed

TypeError: Cannot read properties of null (reading 'cloneNode') at r.active #871

Mecanik opened this issue Jan 27, 2023 · 4 comments · Fixed by #872
Labels
bug Something isn't working

Comments

@Mecanik
Copy link

Mecanik commented Jan 27, 2023

Hi,

I get this browser error for some reason in production using this skeleton:

TypeError: Cannot read properties of null (reading 'cloneNode') at r.active (.../assets/init/bundle.min.49ca593671343b66a416b4bd8189e17a42797780b147ad52850b38b96c697fad.js:1:2588) at .../assets/init/bundle.min.49ca593671343b66a416b4bd8189e17a42797780b147ad52850b38b96c697fad.js:1:1949

I unpacked the minified script and the culprit is here:

         active(t) {
                (this.mode = t),
                    s.setItem(this.key, t),
                    this.items.forEach((o) => {
                        let a = o.querySelector(".dropdown-item").classList;
                        o.getAttribute("data-color-mode") === t ? a.add("active") : a.remove("active");
                    });
                **let e = document.querySelector('.mode-item[data-color-mode="' + t + '"] .mode-icon').cloneNode(!0);**
                e.setAttribute("id", "modeIcon"), document.querySelector("#modeIcon").replaceWith(e);
           }

Possible to add an if case for everyone to benefit?

Thanks

@razonyang
Copy link
Owner

I guess that you set the topAppBar.colorToggle as false?

@Mecanik
Copy link
Author

Mecanik commented Jan 27, 2023

I guess that you set the topAppBar.colorToggle as false?

That is correct yes, I only have language selector - that's all.

@razonyang razonyang transferred this issue from razonyang/hugo-theme-bootstrap-skeleton Jan 27, 2023
@razonyang razonyang added the bug Something isn't working label Jan 27, 2023
@razonyang
Copy link
Owner

Fixed, you may need to upgrade the theme to the master branch via hugo mod get github.com/razonyang/hugo-theme-bootstrap@master.

Thanks for reporting this issue.

@Mecanik
Copy link
Author

Mecanik commented Jan 28, 2023

Thank you.

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