Skip to content

Commit 371ceab

Browse files
Fix Issue with createNavs and removeNavs Functions by Correcting .some() Method Usage (#241)
This pull request addresses the issue where the createNavs and removeNavs functions in the navigation system were not executing properly due to incorrect usage of the .some() method. Changes Made: Corrected .some() Method Usage: Removed the .length property from the .some() method in the createNavs and removeNavs functions as .some() returns a boolean and not an array.
1 parent 60b8e7a commit 371ceab

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/js/tab/tab.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class TabsElement extends HTMLElement {
310310

311311
// Create navigation elements for inserted tabs
312312
createNavs(tab) {
313-
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;
313+
if ((tab instanceof Element && tab.tagName.toLowerCase() !== 'joomla-tab-element') || ![].some.call(this.children, (el) => el === tab) || !tab.getAttribute('name') || !tab.getAttribute('id')) return;
314314
const tabs = [].slice.call(this.children).filter((el) => el.tagName.toLowerCase() === 'joomla-tab-element');
315315
const index = tabs.findIndex((tb) => tb === tab);
316316

@@ -366,7 +366,7 @@ class TabsElement extends HTMLElement {
366366

367367
// Remove navigation elements for removed tabs
368368
removeNavs(tab) {
369-
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;
369+
if ((tab instanceof Element && tab.tagName.toLowerCase() !== 'joomla-tab-element') || ![].some.call(this.children, (el) => el === tab) || !tab.getAttribute('name') || !tab.getAttribute('id')) return;
370370
const accordionButton = tab.previousSilbingElement;
371371
if (accordionButton && accordionButton.tagName.toLowerCase() === 'button') {
372372
accordionButton.removeEventListener('click', this.keyBehaviour);

0 commit comments

Comments
 (0)