I posted a few days ago and got some awesome help which fixed my issue on selecting the ul within a <nav> tag without a specified class name.
I have now realised I should be using a class for the semantic html to future-proof any additional navs in the future.
Using querySelector for the <nav class="navigation-bar"> which selects correctly, however when I extend and use querySelector('.navigation-bar').getElementsByTagName('ul'); nothing happens.
So when I had it as just querySelector('.navigation-bar');
The functionality comes back but it moves the nav-menu and anything within the flex container to the ulâs style rather than showing the .navigation-bar ul contents.
If you just have one ul within that section then you can just do this.
const menu = document.querySelector('.navigation-bar ul');
Why are you toggling nav-menu which is the hamburger and then applying the hamburger nav-menu class to the ul? Shouldnât you just be adding something like a nav-open class to the ul instead.
This probably isnât the best css, but a bit of a refactor anyway. I dropped some of the flex boxes you had. display: block; seemed just fine for the nav-menu â thatâs just my take though.
From memory with a nodelist the nodeName is in uppercase.
So I only use uppercase to avoid confusion and errors as some method return htmlcollections and others return a nodelist.
And if you are developing in HTML5 why worry about XHTML?
I know that itâs unsettling for nodeName to be in uppercase and all other uses of element names being recommended to be in lowercase, but thatâs the way things are.
Fortunately using all uppercase for the qualifiedName is supported in many cases. When there are multiple ways that are supported, that then tends to become a case for standards and styleguides to help resolve the differences.