cferdinandi / tabby

Lightweight, accessible vanilla JS toggle tabs.
MIT License
598 stars 73 forks source link

TypeError when no tabs exist on a page #106

Closed Log1x closed 5 years ago

Log1x commented 5 years ago

Currently Tabby is throwing a TypeError when it is being included on a page that doesn't have the selector (e.g. [data-tabs]) present.

You can see this here using your browsers console (Codepen's console does not show it).

The example above is the default Tabby example with data-tabs simply removed from the ul.

Uncaught TypeError: Cannot read property 'addEventListener' of null at init
cferdinandi commented 5 years ago

Ah gotcha. Yea, it should probably bail before then, huh? Thanks for this. Will fix.

cferdinandi commented 5 years ago

The more I think about it, the error is a feature in that it tells you you've done something wrong. Decided to "won't fix" this one. Sorry!