Comparing version 1.0.7 to 1.0.8
# Changelog | ||
## 1.0.8 | ||
- Allows operation against elements that reside within iframes, by inspecting the element to determine its correct parent `document` (rather than relying on the global `document` object). | ||
## 1.0.7 | ||
@@ -4,0 +8,0 @@ |
15
index.js
module.exports = function(el) { | ||
var elementDocument = el.ownerDocument; | ||
var basicTabbables = []; | ||
@@ -7,3 +8,3 @@ var orderedTabbables = []; | ||
// - it's computed style | ||
var isUnavailable = createIsUnavailable(); | ||
var isUnavailable = createIsUnavailable(elementDocument); | ||
@@ -30,3 +31,3 @@ var candidateSelectors = [ | ||
|| candidate.disabled | ||
|| isUnavailable(candidate) | ||
|| isUnavailable(candidate, elementDocument) | ||
) { | ||
@@ -60,3 +61,3 @@ continue; | ||
function createIsUnavailable() { | ||
function createIsUnavailable(elementDocument) { | ||
// Node cache must be refreshed on every check, in case | ||
@@ -72,3 +73,3 @@ // the content of the element has changed | ||
function isOff(node, nodeComputedStyle) { | ||
if (node === document.documentElement) return false; | ||
if (node === elementDocument.documentElement) return false; | ||
@@ -80,3 +81,3 @@ // Find the cached node (Array.prototype.find not available in IE9) | ||
nodeComputedStyle = nodeComputedStyle || window.getComputedStyle(node); | ||
nodeComputedStyle = nodeComputedStyle || elementDocument.defaultView.getComputedStyle(node); | ||
@@ -97,5 +98,5 @@ var result = false; | ||
return function isUnavailable(node) { | ||
if (node === document.documentElement) return false; | ||
if (node === elementDocument.documentElement) return false; | ||
var computedStyle = window.getComputedStyle(node); | ||
var computedStyle = elementDocument.defaultView.getComputedStyle(node); | ||
@@ -102,0 +103,0 @@ if (isOff(node, computedStyle)) return true; |
{ | ||
"name": "tabbable", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Returns an array of all tabbable DOM nodes within a containing node.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131200
106