Skip to content

Commit

Permalink
remove Array.from usage and update to beta5
Browse files Browse the repository at this point in the history
  • Loading branch information
mynamesleon committed Jan 9, 2020
1 parent 40f37d8 commit 51302d5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions examples/index.html
Expand Up @@ -126,6 +126,9 @@
margin-bottom: 10px;
padding: 7px 10px;
}
[role='tab'] {
cursor: pointer;
}
[role='tabpanel'] {
width: 100%;
margin-right: 0;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "aria-tablist",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"description": "Dependency-free plain JavaScript module for WCAG compliant tablists",
"main": "dist/aria-tablist.min.js",
"scripts": {
Expand Down
9 changes: 5 additions & 4 deletions src/aria-tablist.js
Expand Up @@ -251,10 +251,11 @@ class Tablist {

// create tabs and panels arrays
// only for tabs that control an element, or have a panel labelled by it
Array.from(tabs).forEach(tab => {
for (let i = 0, l = tabs.length; i < l; i += 1) {
const tab = tabs[i];
// do not process non-element nodes
if (tab.nodeType !== 1) {
return;
continue;
}

// ensure tab has an associated panel
Expand All @@ -266,7 +267,7 @@ class Tablist {
tab.removeAttribute('aria-controls');
tab.removeAttribute('aria-selected');
tab.removeAttribute('aria-expanded');
return;
continue;
}

// ensure element has the tab role
Expand All @@ -278,7 +279,7 @@ class Tablist {

// store index on the tab itself for arrow keypresses
tab[TAB_INDEX_PROP] = this.tabs.length - 1;
});
}
}

/**
Expand Down

0 comments on commit 51302d5

Please sign in to comment.