Skip to content

Commit

Permalink
change back to getters
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed May 23, 2019
1 parent 2b80529 commit 86991b9
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/checks/keyboard/focusable-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Note:
* Check if given node contains focusable elements (excluding thyself)
*/
const tabbableElements = virtualNode.tabbableElements();
const tabbableElements = virtualNode.tabbableElements;

if (!tabbableElements) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/checks/keyboard/focusable-disabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const elementsThatCanBeDisabled = [
'TEXTAREA'
];

const tabbableElements = virtualNode.tabbableElements();
const tabbableElements = virtualNode.tabbableElements;

if (!tabbableElements || !tabbableElements.length) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/checks/keyboard/focusable-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* - if element is focusable
* - if element is in focus order via `tabindex`
*/
const isFocusable = virtualNode.isFocusable();
const isFocusable = virtualNode.isFocusable;

let tabIndex = parseInt(virtualNode.actualNode.getAttribute('tabindex'), 10);
tabIndex = !isNaN(tabIndex) ? tabIndex : null;
Expand Down
2 changes: 1 addition & 1 deletion lib/checks/keyboard/focusable-not-tabbable.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const elementsThatCanBeDisabled = [
'TEXTAREA'
];

const tabbableElements = virtualNode.tabbableElements();
const tabbableElements = virtualNode.tabbableElements;

if (!tabbableElements || !tabbableElements.length) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/commons/dom/get-tabbable-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dom.getTabbableElements = function getTabbableElements(virtualNode) {
const nodeAndDescendents = axe.utils.querySelectorAll(virtualNode, '*');

const tabbableElements = nodeAndDescendents.filter(vNode => {
const isFocusable = vNode.isFocusable();
const isFocusable = vNode.isFocusable;
let tabIndex = vNode.actualNode.getAttribute('tabindex');
tabIndex =
tabIndex && !isNaN(parseInt(tabIndex, 10)) ? parseInt(tabIndex) : null;
Expand Down
4 changes: 2 additions & 2 deletions lib/core/base/virtual-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class VirtualNode {
* Determine if the element is focusable and cache the result.
* @return {Boolean} True if the element is focusable, false otherwise.
*/
isFocusable() {
get isFocusable() {
if (!this._cache.hasOwnProperty('isFocusable')) {
this._cache.isFocusable = axe.commons.dom.isFocusable(this.actualNode);
}
Expand All @@ -76,7 +76,7 @@ class VirtualNode {
* Return the list of tabbable elements for this element and cache the result.
* @returns {VirtualNode[]}
*/
tabbableElements() {
get tabbableElements() {
if (!this._cache.hasOwnProperty('tabbableElements')) {
this._cache.tabbableElements = axe.commons.dom.getTabbableElements(this);
}
Expand Down

0 comments on commit 86991b9

Please sign in to comment.