Constructor: HeadingsLandmarksCache

OpenAjax.a11y.cache.HeadingsLandmarksCache

new HeadingsLandmarksCache(dom_cache)

HeadingsLandmarksCache is the constructor for lists of heading and landmrk element objects and the root of a tree representation of the landmark and heading 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 landmarks and headings in the document
landmark_elements Array List of all the landmark elements in the document
landmarks_sort_property String Name of the landmark element property the landmark elements array is currently sorted
landmark_length Number The length of the landmark elements list, used in calculating cache id values
heading_elements Array List of all the heading elements in the document
headings_sort_property String Name of the heading element property the heading elements array is currently sorted
heading_length Number The length of the heading elements list, used in calculating cache id values
elements_with_content Array List of content elements and text nodes outside of landmarks
main_elements Array List of all the main landmark elements in the document
main_length Number The length of the main landmark elements list, used in calculating cache id values
h1_elements Array List of all the h1 heading elements in the document
h1_length Number The length of the main landmark elements list, used in calculating cache id values
has_main_landmarks Boolean True if document contians at lewast one main landmark, otherwise false
has_title Boolean Title element is defined in the document
title_element TitleElement The title element is used as a placeholder for title rule results
page_element PageElementHeadingsLandmarks The body element is used as a placeholder rule results for items missing in a document like H1 elements and Main landmarks
rule_summary_result ResultRuleSummary Rule results associated with this cache
Source:
  • scripts/cache_headings_landmarks.js, line 106

Methods

<static> addChildElement(child_element)

Adds a landmark or header element object to the root level of a tree of landmark/heading elements

Parameters:
Name Type Description
child_element LandmarkElement | HeadingElement Landmark or heading element object to add
Source:
  • scripts/cache_headings_landmarks.js, line 141

<static> addChildMainElement(child_element)

Adds a main landmark or h1 heading element object to the root level of a tree of title and main elements

Parameters:
Name Type Description
child_element MainElement | H1Element Main landmark or h1 heading element object to add
Source:
  • scripts/cache_headings_landmarks.js, line 207

<static> addH1Element(h1_element)

Adds a h1 element object to the h1 heading elements list

Parameters:
Name Type Description
h1_element H1Element h1 heading element to add
Source:
  • scripts/cache_headings_landmarks.js, line 226

<static> addHeadingElement(heading_element) → {Number}

Adds a heading element object to the heading elements list

Parameters:
Name Type Description
heading_element HeadingElement HeadingElement object to a heading_elements array
Source:
  • scripts/cache_headings_landmarks.js, line 184
Returns:
Returns the length of the heading elements list
Type
Number

<static> addLandmarkElement(heading_element) → {Number}

Adds a landmark element object to the heading elements list

Parameters:
Name Type Description
heading_element LandmarkElement Landmark element object to a landmark elements list
Source:
  • scripts/cache_headings_landmarks.js, line 160
Returns:
Returns the length of the landmark elements list
Type
Number

<static> addMainElement(main_element) → {Number}

Adds a main, h1 or title element object to the main_elements array and cacluates a cache id value

Parameters:
Name Type Description
main_element MainElement | H1Element | TitleElement | PageElementHeadingsLandmarks Main, h1 heading or title element object to add
Source:
  • scripts/cache_headings_landmarks.js, line 247
Returns:
length is the number of elements in the main_elements list
Type
Number

<static> getHeadingElementByCacheId(cache_id) → {HeadingElement|null}

Finds the heading element object with the cache id value

Parameters:
Name Type Description
cache_id String cache id of a heading element object
Source:
  • scripts/cache_headings_landmarks.js, line 333
Returns:
Returns a heading object if cache id found, otherwise null
Type
HeadingElement | null

<static> getItemByCacheId(cache_id) → {LandmarkElement|HeadingElement|null}

Finds the landmark or heading element object with the cache id value

Parameters:
Name Type Description
cache_id String cache id of a landmark element object
Source:
  • scripts/cache_headings_landmarks.js, line 272
Returns:
Returns a landmark element object if cache id found, otherwise null
Type
LandmarkElement | HeadingElement | null

<static> getLandmarkElementByCacheId(cache_id) → {LandmarkElement|null}

Finds the landmark element object with the cache id value

Parameters:
Name Type Description
cache_id String cache id of a landmark element object
Source:
  • scripts/cache_headings_landmarks.js, line 306
Returns:
Returns a landmark element object if cache id found, otherwise null
Type
LandmarkElement | null

<static> initCache()

Empties the landmark and headings cache

Source:
  • scripts/cache_headings_landmarks.js, line 361

<static> sortHeadingElements(property, ascending) → {Boolean}

Sorts the heading_elements array based on a property of the HeadingElement object

Parameters:
Name Type Description
property String HeadingElement object property used to sort the cache
ascending Boolean true if sort in ascending order; false in descending order
Source:
  • scripts/cache_headings_landmarks.js, line 718
Returns:
true if list was sorted, false if not
Type
Boolean

<static> sortLandmarkElements(property, ascending) → {Boolean}

Sorts the landmark elements list based on a property of the landmark element object

Parameters:
Name Type Description
property String LandmarkElement object property used to sort the cache
ascending Boolean true if sort in ascending order; false in descending order
Source:
  • scripts/cache_headings_landmarks.js, line 658
Returns:
Return true if list was sorted; false was not sorted due to an error
Type
Boolean

<static> traverseDOMElementsForLandmarkElements(dom_element)

Traverses DOMElement objects in the tree to update the landmarks and headings cache

Parameters:
Name Type Description
dom_element DOMElement DOMElement object to check for inclusion in landmarks and headings cache
Source:
  • scripts/cache_headings_landmarks.js, line 603

<static> updateCache()

Traverses the DOMElements to update the landmarks and heading 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 landmark and headings cache are disabled, this cache would not be updated

Source:
  • scripts/cache_headings_landmarks.js, line 628

<static> updateCacheItems(dom_element, landmark_info) → {LandmarkInfo}

Updates the landmarks and headings cache by checking to see if a DOMElement should be added

Parameters:
Name Type Description
dom_element DOMElement DOMElement object to check for inclusion in links cache
landmark_info LandmarkInfo Information about the current landmarks that are parents to this item
Source:
  • scripts/cache_headings_landmarks.js, line 399
Returns:
Returns updated landmark info object
Type
LandmarkInfo