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

Fixed Issue with createNavs and removeNavs Functions by Correcting .some() Method Usage #241

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/js/tab/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class TabsElement extends HTMLElement {

// Create navigation elements for inserted tabs
createNavs(tab) {
if ((tab instanceof Element && tab.tagName.toLowerCase() !== 'joomla-tab-element') || ![].some.call(this.children, (el) => el === tab).length || !tab.getAttribute('name') || !tab.getAttribute('id')) return;
if ((tab instanceof Element && tab.tagName.toLowerCase() !== 'joomla-tab-element') || ![].some.call(this.children, (el) => el === tab) || !tab.getAttribute('name') || !tab.getAttribute('id')) return;
const tabs = [].slice.call(this.children).filter((el) => el.tagName.toLowerCase() === 'joomla-tab-element');
const index = tabs.findIndex((tb) => tb === tab);

Expand Down Expand Up @@ -359,7 +359,7 @@ class TabsElement extends HTMLElement {

// Remove navigation elements for removed tabs
removeNavs(tab) {
if ((tab instanceof Element && tab.tagName.toLowerCase() !== 'joomla-tab-element') || ![].some.call(this.children, (el) => el === tab).length || !tab.getAttribute('name') || !tab.getAttribute('id')) return;
if ((tab instanceof Element && tab.tagName.toLowerCase() !== 'joomla-tab-element') || ![].some.call(this.children, (el) => el === tab) || !tab.getAttribute('name') || !tab.getAttribute('id')) return;
const accordionButton = tab.previousSilbingElement;
if (accordionButton && accordionButton.tagName.toLowerCase() === 'button') {
accordionButton.removeEventListener('click', this.keyBehaviour);
Expand Down
Loading