Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tabbable

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tabbable - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

4

CHANGELOG.md
# Changelog
## 1.0.3
- Further improvements to caching.
## 1.0.2

@@ -4,0 +8,0 @@

57

index.js
module.exports = function(el) {
// Node cache must be refreshed on every check, in case
// the content of the element has changed
var nodeCache = {};
var nodeCacheIndex = 1;
function isHidden(node) {
if (node === document.documentElement) {
return false;
}
if (node.tabbableCacheIndex) {
return nodeCache[node.tabbableCacheIndex];
}
var result = false;
var style = window.getComputedStyle(node);
if (style.visibility === 'hidden' || style.display === 'none') {
result = true;
} else if (node.parentNode) {
result = isHidden(node.parentNode);
}
node.tabbableCacheIndex = nodeCacheIndex;
nodeCache[node.tabbableCacheIndex] = result;
nodeCacheIndex++;
return result;
}
var basicTabbables = [];
var orderedTabbables = [];
var isHidden = createIsHidden();

@@ -71,1 +44,29 @@ var candidates = el.querySelectorAll('input, select, a[href], textarea, button, [tabindex]');

}
function createIsHidden() {
// Node cache must be refreshed on every check, in case
// the content of the element has changed
var nodeCache = [];
return function isHidden(node) {
if (node === document.documentElement) return false;
var cached = nodeCache.find(function(item) {
return item[0] === node;
});
if (cached) return cached[1];
var result = false;
var style = window.getComputedStyle(node);
if (style.visibility === 'hidden' || style.display === 'none') {
result = true;
} else if (node.parentNode) {
result = isHidden(node.parentNode);
}
nodeCache.push([node, result]);
return result;
}
}
{
"name": "tabbable",
"version": "1.0.2",
"version": "1.0.3",
"description": "Returns an array of all tabbable DOM nodes within a containing node.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc