Constructor: DOMElementCache

OpenAjax.a11y.cache.DOMElementCache

new DOMElementCache()

Creates a DOMElementCache object for represeting a DOM in a web browser

Properties:
Name Type Description
dom_elements Array A simple array of all the DOMElement objects in the cache
dom_text Array A simple array of all the DOMText objects in the cache
page_element Object The dom element that is used as a place to collect results for rules with scope of page
child_dom_elements Array The roor of a tree of DOMElement objects representing the node relationships on the DOM
sort_property String String The DOMElement property the dom_elements array is sorted by
length Number The running length of the dom_elements array used for calculating the cache_id property of a DOMElement
Source:
  • scripts/cache_dom_element.js, line 7

Methods

getDOMElementByCacheId(cache_id) → {DOMElement}

Finds the the DOMElement object with the matching cache ID value

Parameters:
Name Type Description
cache_id String cache_id of DOMElement object to find
Deprecated:
  • getDOMElementByCacheId
    Source:
    • scripts/cache_dom_element.js, line 201
    Returns:
    Returns DOMElement with the associated cache ID if found, otherwise null
    Type
    DOMElement

    <static> addChild(dom_object)

    Adds a DOMElement or DOMText object to the root level of the tree reflecting the DOM of document

    Parameters:
    Name Type Description
    dom_object DOMElement or DOMText object DOMElement or DOMText object to add to the tree
    Source:
    • scripts/cache_dom_element.js, line 145

    <static> addDOMElement(dom_element) → {Number}

    Adds a DOMElement object to the array of all DOMElements and calculates the elements cache ID

    Parameters:
    Name Type Description
    dom_element DOMElement Object DOMElement object to add
    Source:
    • scripts/cache_dom_element.js, line 87
    Returns:
    Returns the current number of elements in the array of DOMElements
    Type
    Number

    <static> addDOMText(dom_text) → {Number}

    Adds a DOM text object to the array of all DOM text and calculates the cache ID

    Parameters:
    Name Type Description
    dom_text DOMText Object DOM text object to add
    Source:
    • scripts/cache_dom_element.js, line 119
    Returns:
    Returns the current number of elements in the array of DOM text objects
    Type
    Number

    <static> checkForUniqueIDs()

    Check DOMElements for unique ids and set id_unique property for all DOMElements in the cache Sets the 'id_unique' property on DOMElement objects that do not have unique ID attribute values

    Source:
    • scripts/cache_dom_element.js, line 347

    <static> getDOMElementById(id) → {DOMElement}

    Returns the DOMElement object with the id attribute value

    Parameters:
    Name Type Description
    id String id of DOMElement object to find
    Source:
    • scripts/cache_dom_element.js, line 162
    Returns:
    Returns DOMElement with the associated id if found, otherwise null
    Type
    DOMElement

    <static> getItemByCacheId(cache_id) → {DOMElement}

    Finds the the DOMElement object with the matching cache ID value

    Parameters:
    Name Type Description
    cache_id String cache_id of DOMElement object to find
    Source:
    • scripts/cache_dom_element.js, line 205
    Returns:
    Returns DOMElement with the associated cache ID if found, otherwise null
    Type
    DOMElement

    <static> getItemsByNodeResults(filter) → {Array}

    Returns an array of cache items with node results based on the filter

    Parameters:
    Name Type Description
    filter Number Filter for returning items with node results of a particular type(s)
    Source:
    • scripts/cache_dom_element.js, line 233
    Returns:
    Returns array of cache items, can be empty
    Type
    Array

    <static> getPageElement() → {DOMElement}

    Gets the DOM node used to contain page level rule results

    Source:
    • scripts/cache_dom_element.js, line 71
    Returns:
    DOM element object used to contain page level rule results
    Type
    DOMElement

    <static> getTextFromIds(ids) → {String}

    Gets the accessible text content from a list of ids

    Parameters:
    Name Type Description
    ids String a space separated list of ids
    Source:
    • scripts/cache_dom_element.js, line 315
    Returns:
    Returns a string with the concatenated text content of the elements with ids
    Type
    String

    <static> initCache()

    Initializes properties of the DOMElementCache

    Source:
    • scripts/cache_dom_element.js, line 51
    Returns:
    Nothing

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

    Sorts the dom_elements array based on a property of the DOMElement object

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