makeup-roving-tabindex
Advanced tools
Comparing version 0.1.1 to 0.1.2
54
index.js
@@ -25,4 +25,2 @@ 'use strict'; | ||
this._items = Util.nodeListToArray(this._el.querySelectorAll(this._itemSelector)); | ||
this._items.forEach(function (el, index) { | ||
@@ -78,17 +76,31 @@ if (index !== modelIndex) { | ||
var RovingTabindex = function RovingTabindex(el) { | ||
_classCallCheck(this, RovingTabindex); | ||
var RovingTabindex = function () { | ||
function RovingTabindex(el) { | ||
_classCallCheck(this, RovingTabindex); | ||
this._el = el; | ||
this._onMutationListener = onModelMutation.bind(this); | ||
this._onChangeListener = onModelChange.bind(this); | ||
this._onInitListener = onModelInit.bind(this); | ||
this._onResetListener = onModelReset.bind(this); | ||
this._el = el; | ||
this._onMutationListener = onModelMutation.bind(this); | ||
this._onChangeListener = onModelChange.bind(this); | ||
this._onInitListener = onModelInit.bind(this); | ||
this._onResetListener = onModelReset.bind(this); | ||
el.addEventListener('navigationModelMutation', this._onMutationListener); | ||
el.addEventListener('navigationModelChange', this._onChangeListener); | ||
el.addEventListener('navigationModelInit', this._onInitListener); | ||
el.addEventListener('navigationModelReset', this._onResetListener); | ||
}; | ||
this._el.addEventListener('navigationModelMutation', this._onMutationListener); | ||
this._el.addEventListener('navigationModelChange', this._onChangeListener); | ||
this._el.addEventListener('navigationModelInit', this._onInitListener); | ||
this._el.addEventListener('navigationModelReset', this._onResetListener); | ||
} | ||
_createClass(RovingTabindex, [{ | ||
key: 'destroy', | ||
value: function destroy() { | ||
this._el.removeEventListener('navigationModelMutation', this._onMutationListener); | ||
this._el.removeEventListener('navigationModelChange', this._onChangeListener); | ||
this._el.removeEventListener('navigationModelInit', this._onInitListener); | ||
this._el.removeEventListener('navigationModelReset', this._onResetListener); | ||
} | ||
}]); | ||
return RovingTabindex; | ||
}(); | ||
var LinearRovingTabindex = function (_RovingTabindex) { | ||
@@ -105,3 +117,2 @@ _inherits(LinearRovingTabindex, _RovingTabindex); | ||
_this._itemSelector = itemSelector; | ||
_this._items = Util.nodeListToArray(el.querySelectorAll(itemSelector)); | ||
@@ -117,2 +128,7 @@ _this._navigationEmitter = NavigationEmitter.createLinear(el, itemSelector, { | ||
_createClass(LinearRovingTabindex, [{ | ||
key: 'destroy', | ||
value: function destroy() { | ||
this._navigationEmitter.destroy(); | ||
} | ||
}, { | ||
key: 'wrap', | ||
@@ -122,2 +138,10 @@ set: function set(newWrap) { | ||
} | ||
// we cannot use a cached version of the items in question since the DOM may change without notice | ||
}, { | ||
key: '_items', | ||
get: function get() { | ||
return Util.nodeListToArray(this._el.querySelectorAll(this._itemSelector)); | ||
} | ||
}]); | ||
@@ -124,0 +148,0 @@ |
{ | ||
"name": "makeup-roving-tabindex", | ||
"description": "Implements a roving tab index on given collection of elements", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "index.js", | ||
@@ -51,3 +51,3 @@ "repository": "https://github.com/makeup-js/makeup-roving-tabindex.git", | ||
"dependencies": { | ||
"makeup-navigation-emitter": "~0.1.2" | ||
"makeup-navigation-emitter": "~0.1.3" | ||
}, | ||
@@ -54,0 +54,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
236055
138
1