Skip to content

ally.js

JavaScript library to help modern web applications with accessibility concerns by making accessibility simpler

# ally.get.insignificantBranches

Identifies all the branches of the DOM that do not contain any of the target elements

# Description

The insignificant branches contain all highest level nodes (looking from the root context) that do not contain any target elements (specified in filter). For the following HTML, the insignificant branches of #target are [#sibling, #uncle-1, #uncle-2]. The insignificant branches of [#target, #target-2] are [#sibling, #uncle-1, #cousin-2]:

<div id="uncle-1">
  <div id="cousin-1"></div>
</div>
<div id="parent">
  <div id="target"></div>
  <div id="sibling"></div>
</div>
<div id="uncle-2">
  <div id="cousin-2"></div>
  <div id="target-2"></div>
</div>

# Usage

var elements = ally.get.insignificantBranches({
  filter: '#target',
});

# Arguments

Name Type Default Description
context <selector> documentElement The scope of the DOM in which to search. The first element of a collection is used.
filter <selector> required The significant elements to exclude from the search.

# Returns

Array of HTMLElement.

# Throws

TypeError if filter option is not specified.

# Changes

# Contributing