themefoundation / mo-js

Menu Object. A mobile-first, progressibly enhanced menu system.
22 stars 4 forks source link

Why the empty <div> around the menu toggle button? #9

Open rootwork opened 9 years ago

rootwork commented 9 years ago

I'm not sure why the <div> is here:

        // Automatically insert a toggle button if previously selected button doesn't exist.
        if ( menu.toggleButton.length < 1 ) {
          if ( '' === mo.mobileMenuLocation ) {
            $('<div><span class="menu-toggle-button mojs-toggle-' + mojsMenuId + '">' + mo.toggleButtonContent + '</span></div>').prependTo(menu.container);
          } else {
            $('<div><span class="menu-toggle-button mojs-toggle-' + mojsMenuId + '">' + mo.toggleButtonContent + '</span></div>').prependTo(mo.mobileMenuLocation);
          }
          menu.toggleButton = $('.mojs-toggle-' + mojsMenuId).hide();
          if ( mo.toggleButtonID ) {
            menu.toggleButton.attr('id', mo.toggleButtonID);
          }
        }
      }

If it does need to be there, putting a class on it would make it a little easier to target with CSS.

themefoundation commented 9 years ago

To be honest, I don't remember what purpose it served. Feel free to play around with it and see what happens. I'd love to go over all the mo.js code and make improvements, but I don't have time at the moment. I'm looking forward to it when I can find the time though!