Constructor: ControlsCache

OpenAjax.a11y.cache.ControlsCache

new ControlsCache(dom_cache)

ControlsCache is the constructor for lists of control cache element objects and the root of a tree representation of the control cache element relationships

Parameters:
Name Type Description
dom_cache DOMCache Reference to the DOMCache object
Properties:
Name Type Description
dom_cache DOMCache Reference to the DOMCache object
up_to_date Boolean Boolean true if the cache has been creating using the current DOMElements, else false NOTE: This is a common property of all caches and is used when selectively build caches based on whether a rule needs the cache
child_cache_elements Array Root array of the tree representation of the controls in the document
control_elements Array List of all the InputElement, TextareaElement, ButtonElement, SelectElement, OptionElements and OptgroupElement objects in the cache
control_length Number Length of the control_elements array and used in calculating cache IDs
label_elements Array List of all the LabelElement objects in the cache
label_length Number Length of the label_elements array and used in calculating cache IDs
fieldset_elements Array List of all the FieldsetElement objects in the cache
fieldset_length Number Length of the Fireldset_elements array and used in calculating cache IDs
form_elements Array List of all the FormElement objects in the cache
form_length Number Length of the form_elements array and used in calculating cache IDs
sort_property String The property the list of control element object is currenlty sorted by
ascending Boolean true if the list is ascending order or false if descending
rule_summary_result ResultRuleSummary Rule results associated with this
Source:
  • scripts/cache_controls.js, line 62

Methods

<static> addChildControl(control_element)

Adds a cache control element to the root tree representation of control elements

Parameters:
Name Type Description
control_element WidgetElement | ButtonElement | FieldsetElement | FormElement | InputElement | LabelElement | LegendElement | OptgroupElement | OptionElement | SelectElement | TextareaElement Cache control element object to add
Source:
  • scripts/cache_controls.js, line 132

<static> addControlElement(control_element) → {Number}

Adds a cache control element to the list of controls array and generates a cache_id for each control

Parameters:
Name Type Description
control_element WidgetElement | ButtonElement | FieldsetElement | FormElement | InputElement | LabelElement | LegendElement | OptgroupElement | OptionElement | SelectElement | TextareaElement Cache control element object to add
Source:
  • scripts/cache_controls.js, line 150
Returns:
Returns the number of control objects in the control_elements array
Type
Number

<static> addFieldsetElement(fieldset_element) → {Number}

Adds a FieldsetElement to the list of fieldset elements and generates a cache id for the object

Parameters:
Name Type Description
fieldset_element FieldsetElement FieldsetElement to add
Source:
  • scripts/cache_controls.js, line 228
Returns:
Returns the number of FieldsetElement objects in the list of fieldset elements
Type
Number

<static> addFieldsetLegend(control)

Adds legend content to computed label if control is contained in a fieldset/legend

Parameters:
Name Type Description
control Object Control Object
Source:
  • scripts/cache_controls.js, line 992

<static> addFormElement(form_element) → {Number}

Add a FormElement object to the list of form elements and generates a cache id for the object

Parameters:
Name Type Description
form_element FormElement FormElement to add
Source:
  • scripts/cache_controls.js, line 202
Returns:
Returns number of FormElement objects in the list of form elements
Type
Number

<static> addLabel(control, label, source)

Adds legend content to computed label if control is contained in a fieldset/legend

Parameters:
Name Type Description
control Object Control Object
label String label text
source Number label source
Source:
  • scripts/cache_controls.js, line 1013

<static> addLabelElement(label_element)

Add LabelElement object to list of label elements and generates a cache id for the object

Parameters:
Name Type Description
label_element LabelElement LabelElement object to add
Source:
  • scripts/cache_controls.js, line 179
Returns:
Nothing

<static> applyAriaOwns()

Applies parent/child widget relationships based on the aria-owns property if aria-owns property is defined for any widgets

Source:
  • scripts/cache_controls.js, line 1240

<static> calculateControlLabels()

Calculates labels for all form controls, based on the order of label calculation techniques used by browsers to generate accessible names for accessibility APIs used by assistive technologies

Source:
  • scripts/cache_controls.js, line 1220

<static> calculateLabelsByEncapsulation()

Iterates the list of label elements and calculates the accessible label for any control elements that are encapsulated by a label element

Source:
  • scripts/cache_controls.js, line 1095

<static> calculateLabelsByOther()

Iterates the list of control elements and calculates the accessible label for any control elements that do NOT have a computed label, but has a VALUE, ALT or TITLE attribute value

Source:
  • scripts/cache_controls.js, line 1133

<static> calculateLabelsByReference()

Iterates the list of label elements and calculates the accessible label for any control elements that are referenced by label elements with for attribute

Source:
  • scripts/cache_controls.js, line 1042

<static> calculateLabelsUsingARIA()

Interates the array for control cache elements and calculates the accessible name for any control elements if there is ARIA markup

Source:
  • scripts/cache_controls.js, line 955

<static> emptyCache()

Resests the ControlsCache object properties and empties all the lists and arrays

Source:
  • scripts/cache_controls.js, line 254

<static> getControlElementByCacheId(cache_id) → {cache control element object}

Finds the the control cache element object with the matching cache id

Parameters:
Name Type Description
cache_id String Cache id of control cache element object
Source:
  • scripts/cache_controls.js, line 776
Returns:
Returns cache control element object if cache id is found, otherwise null
Type
cache control element object

<static> getControlElementById(id) → {cache control element object}

Finds the the control cache element object with the matching id

Parameters:
Name Type Description
id String id of control cache element object
Source:
  • scripts/cache_controls.js, line 797
Returns:
Returns cache control element object if cache id is found, otherwise null
Type
cache control element object

<static> getElementTextContent(label_element, include_control_values) → {String}

Traverses the cache to get the text content associated with the label, this will include the values of form controls in the label references

Parameters:
Name Type Description
label_element LabelElement LabelElement object to calculate the text content
include_control_values Boolean True if the values of form controls should be included in accessible name calculation
Source:
  • scripts/cache_controls.js, line 891
Returns:
Returns the text content of a LabelElement
Type
String

<static> getFieldsetElementByCacheId(cache_id) → {FieldsetElement}

Finds the the FieldsetElement object with the matching cache id

Parameters:
Name Type Description
cache_id String Cache id of FieldsetElement object
Source:
  • scripts/cache_controls.js, line 866
Returns:
Returns fieldset element with the cache id if found, otherwise null
Type
FieldsetElement

<static> getFormElementByCacheId(cache_id) → {FormElement}

Finds the the FormElement object with the matching cache id

Parameters:
Name Type Description
cache_id String Cache id of FormElement object
Source:
  • scripts/cache_controls.js, line 841
Returns:
Returns form element with the cache id if found, otherwise null
Type
FormElement

<static> getItemByCacheId(cache_id) → {cache control element object}

Finds the the control cache element object with the matching cache id

Parameters:
Name Type Description
cache_id String Cache id of control cache element object
Source:
  • scripts/cache_controls.js, line 745
Returns:
Returns cache control element object if cache id is found, otherwise null
Type
cache control element object

<static> getLabelElementByCacheId(cache_id) → {LabelElement}

Finds the the LabelElement object with the matching cache id

Parameters:
Name Type Description
cache_id String Cache id of LabelElement object
Source:
  • scripts/cache_controls.js, line 820
Returns:
Returns label element with the cache id if found, otherwise null
Type
LabelElement

<static> getRuleResults(filter) → {Array}

Returns an array of rule results for the cache items in the controls cache

Parameters:
Name Type Description
filter Number Filter for returning rules with particular type(s) of
Source:
  • scripts/cache_controls.js, line 678
Returns:
Returns array of rule results, can be empty
Type
Array

<static> removeFromChildCacheElements()

Removes a control from the tree view of form controls and widgets

Source:
  • scripts/cache_controls.js, line 1285

<static> traverseDOMElementsForControlElements(dom_element, control_info)

Traverses DOMElement objects in the tree to update the controls cache

Parameters:
Name Type Description
dom_element DOMElement DOMElement object to check for inclusion in controls cache
control_info ControlInfo Current control information object that contains information
Source:
  • scripts/cache_controls.js, line 620

<static> updateCache()

Traverses the DOMElements to update the controls cache NOTE: This function is only used when the specialized caches are build as rules need them. In this condition, if the rules dependent on the controls cache are disabled, this cache would not be updated

Source:
  • scripts/cache_controls.js, line 649

<static> updateCacheItems(dom_element, control_info) → {ControlInfo}

Updates the ControlsCache object by checking to see if a DOMElement should be added to the control cache objects

Parameters:
Name Type Description
dom_element DOMElement DOMElement object to check for inclusion in controls cache
control_info ControlInfo Information about the current control relationships in the DOM
Source:
  • scripts/cache_controls.js, line 285
Returns:
Returns updated control info object
Type
ControlInfo