Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
update to 0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
samthor committed Nov 20, 2017
1 parent 4862e48 commit d307e9a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
9 changes: 7 additions & 2 deletions inert-polyfill.js
Expand Up @@ -211,15 +211,20 @@ if (!('inert' in HTMLElement.prototype)) {

// Otherwise, enumerate through adjacent elements to find the next
// focusable element. This won't respect any custom tabIndex.
var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, {
var filter = /** @type {NodeFilter} */ ({
/**
* @param {Node} node
* @return {number}
*/
acceptNode: function(node) {
if (!node.focus || node.tabIndex < 0) {
if (!node || !node.focus || node.tabIndex < 0) {
return NodeFilter.FILTER_SKIP; // look at descendants
}
var contained = inertElement.contains(node);
return contained ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
},
});
var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, filter);
walker.currentNode = inertElement;

var nextFunc = Math.sign(lastTabDirection) === -1 ? walker.previousNode : walker.nextNode
Expand Down
10 changes: 5 additions & 5 deletions inert-polyfill.min.js

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": "inert-polyfill",
"version": "0.2.4",
"version": "0.2.5",
"description": "Polyfill for the HTML inert attribute",
"main": "inert-polyfill.min.js",
"repository": {
Expand Down

0 comments on commit d307e9a

Please sign in to comment.