ppoffice / hexo-component-inferno

A collection of Inferno.js layout components and utility scripts for Hexo
https://ppoffice.github.io/hexo-component-inferno/
24 stars 30 forks source link

Tab plugin does not work with other html hashes #54

Closed ppwwyyxx closed 1 year ago

ppwwyyxx commented 1 year ago

The following code:

https://github.com/ppoffice/hexo-component-inferno/blob/944db588e4e90f4d93469d1b83546e27e9b67af0/src/hexo/tag/tabs.js#L240-L246

treats any location.hash as part of an menu. However, in practice, location.hash may point to other elements in the page.

This causes my page to error at the line:

       Array.from($tabMenuContainer.children).forEach($menu => $menu.classList.remove('is-active')); 

because the classList attribute is not available.

I think there should be a check that location.hash really points to something in a tab menu.

ppwwyyxx commented 1 year ago

(also, maybe should not use querySelector similar to https://github.com/ppoffice/hexo-theme-icarus/pull/1116 )