new DOMCache(url, title, document)
Constructs a DOMCache Object
Parameters:
Name | Type | Description |
---|---|---|
url |
String | URL of the page being evaluated |
title |
String | The value of title property of the document being evaluated |
document |
Object | The document object reference of the document being evaluated |
- Source:
- scripts/cache_dom_traversal.js, line 7
Properties:
Name | Type | Description |
---|---|---|
nls |
String | NLS cache items for properties |
url |
String | URL of the page being evaluated |
base_url |
String | Base URL of the page being evaluated calculated from the URL |
title |
String | The value of title property of the document being evaluated |
document |
Object | The document object reference of the document being evaluated DOM cache element objects |
element_cache |
Object | dom element cache for all elements |
element_with_id_cache |
Object | dom element cache items with a defined id Specialize cache element objects |
abbreviations_cache |
Object | Cache of abbreviation elements |
color_contrast_cache |
Object | Cache of abbreviation items |
controls_cache |
Object | Cache of form controls and widgets |
headings_landmarks_cache |
Object | Cache of headings and abbreviations |
images_cache |
Object | Cache of image and area elements |
keyboard_focus_cache |
Object | Cache of all interactive elements on a web page |
languages_cache |
Object | Cache of language change items |
links_cache |
Object | Cache of a and area elements |
lists_cache |
Object | Cache of list elements |
media_cache |
Object | Cache of media elements |
tables_cache |
Object | Cache of table elements |
Example
var dom_cache = new OpenAjax.a11y.cache.DOMCache(url, title, doc, locale);
dom_cache.updateDOMElementCache();
dom_cache.updateAllCaches();
Methods
-
<static> addTitleDOMElement()
-
Adds a DOMElement to represent a TITLE
- Source:
- scripts/cache_dom_traversal.js, line 283
Returns:
Nothing -
<static> calculateDescriptions()
-
Calculates a description if a element has an aria-describedby attribute defined
- Source:
- scripts/cache_dom_traversal.js, line 465
-
<static> getDescriptionFromARIADescribedby(element)
-
Calculates a description based on ARIA properties
Parameters:
Name Type Description element
Object Cache element object - Source:
- scripts/cache_dom_traversal.js, line 571
-
<static> getNameForLink(link)
-
Calculates a computed accessible name for a link, using ARIA properties if defined
Parameters:
Name Type Description link
LinkElement Link element object - Source:
- scripts/cache_dom_traversal.js, line 488
-
<static> getNameFromARIALabel(control)
-
Calculates a computed label and accessible name based on ARIA properties
Parameters:
Name Type Description control
Object Control cache element object - Source:
- scripts/cache_dom_traversal.js, line 527
-
<static> getNameFromARIALabel(image)
-
Calculates a computed accessible name based on ALT attribute and ARIA label properties
Parameters:
Name Type Description image
Object Image cache element object - Source:
- scripts/cache_images.js, line 221
-
<static> getTextFromIDs(ids)
-
Returns the text content of the elements identified in the list of ids
Parameters:
Name Type Description ids
String An string with space separated ids - Source:
- scripts/cache_dom_traversal.js, line 598
Returns:
String -
<static> initCache()
-
Initialize specialized caches The specialized caches will be updated all at once or or when needed by a rule depending on how an evaluation is requested
- Source:
- scripts/cache_dom_traversal.js, line 82
-
<static> isUpToDate(cache_name)
-
Checks to see if the specified cache is up to date
Parameters:
Name Type Description cache_name
String Cache to update - Source:
- scripts/cache_dom_traversal.js, line 114
Returns:
Object with two properties: o.up_to_date Boolean true if cache is up to date, otherwise false o.exists Boolean true if cache exists, otherwise false -
<static> sortArrayOfObjects(objects, property, ascending)
-
Sort an array of objects by one of its properties and marks any properties that are duplicates
Parameters:
Name Type Description objects
Array Array of objects to sort property
String Text string of property to sort ascending
Boolean True sort by ascending values otherwise sort by descending values - Source:
- scripts/cache_dom_traversal.js, line 617
Returns:
Array of sorted objects -
<static> traverseDOMElementsForAllCaches(dom_element, landmark_info, table_info, control_info, list_info)
-
Updates all the specialized caches at one time, in general this is faster than updating the caches individually based on the needs of rules, but may create caches that will not be used if some rules are disabled
Parameters:
Name Type Description dom_element
Object Current DOMElement object being processed landmark_info
Object LandmarkInfo object containing current landmark and heading information for tree representations table_info
Object TableInfo object containing current table information for tree representations control_info
Object ControlInfo object containing current control information for tree representations list_info
Object Current LanguageElement object that contains the DOMElement - Source:
- scripts/cache_dom_traversal.js, line 161
Returns:
none -
<static> updateAllCaches()
-
Traverses the DOMElements and calls the update function to see which specialized caches want information on this element
- Source:
- scripts/cache_dom_traversal.js, line 213
Returns:
none -
<static> updateCache(cache_name) → {Boolean}
-
Updates the specified cache
Parameters:
Name Type Description cache_name
String name of the cache to update - Source:
- scripts/cache_dom_traversal.js, line 136
Returns:
Returns true if cache is updated, false if cache does not exist- Type
- Boolean
-
<static> updateDOMElementCache()
-
Updates a DOMElement object caches by traversing the DOM of the browser object
- Source:
- scripts/cache_dom_traversal.js, line 246
Returns:
DOMCache Object -
<static> updateDOMElements(node, parent_dom_element, previous_sibling)
-
Traverse document DOM and create a tree of DOMElement objects. The DOMElement objects will be used to generate more specific lists of elements without need to touch the document DOM. Additional information is collected on tables to be used in creating the table cache
Parameters:
Name Type Description node
Object node is the current node object tbing analyzed parent_dom_element
Object DOMElement object that is the parent of the current node previous_sibling
Object The DOMElement or DOMText object that is the previous sibling return nothing - Source:
- scripts/cache_dom_traversal.js, line 337