Accessibility Evaluation Library API 2.0

From MemberWiki

Jump to: navigation, search

Accessibility Home | Downloads | Evaluation Library Objects and API | Rule Format | Issue Tracker

Contents

Getting Started Using the Evaluation Library to Evaluate a DOM

  • Top level file for loading evaluation library: [openajax_a11y.js]
  • example usage of API:


.... 
 
 var doc   = window.content.document;
 var title = doc.title;
 var url   = window.content.location.href;
 
 // The two supported ruleset ids are currently 'ARIA_TRANS' and 'ARIA_STRICT'
 var ruleset = OpenAjax.a11y.all_rulesets.getRuleset('ARIA_STRICT'); 
 
 if (ruleset) {
 
   // Default is WCAG Level A and AA
   ruleset.setEvaluationLevel(OpenAjax.a11y.EVALUATION_LEVELS.A_AA);
 
   // Default is not to test if links are broken (false) 
   ruleset.setBrokenLinkTesting(false);
 
   var evaluation_result = ruleset.evaluate(url, title, doc, updateProgress, true);
 
   var rs =  evaluation_result.getResultSummary();
 
   if (evaluation_result.hasResults()) {
     window.alert(rs.percent_passed "% passed, " + rs.violations + " violations, " + rs.warnings + " warnings, " + rs.manual_checks + " manual checks");
   }
   else {
     window.alert("No results");
   } 
 }
 else {
   window.alert("  ** Ruleset with the id '" + preferences.ruleset_id + "' not found!!");
 }
 
 ....  

Getting Rule Category Results

.... 
 
var RC_LANDMARKS = OpenAjax.a11y.RULE_CATEGORIES.LANDMARKS;
 
var rule_category_results = eval_result.getFilteredRuleResultsByRuleCategories(RC_LANDMARKS);
 
var rule_results = rule_category_results.filtered_rule_results;

for (var i = 0; i < rule_results.length; i++) {

 var rule_result = rule_results[i];

 var node_results = rule_result.getNodeResults();

 for (var j = 0; j < node_results.length; j++) {

   var node_result = node_results[j];

 }

}

    
 
 ....  

Primary Evaluation Library Objects

Rule Object

Rule Object documentation (JSDoc Format)

This object contains information about a rule:

  • Summary
  • Definition
  • Purpose
  • Techniques
  • Target resources
  • Primary WCAG 2.0 Success Criteria
  • Secondary WCAG 2.0 Success Criteria
  • Informational Links

Rule Methods

Method Returns Arguments Description
getInformationalLinks Array of InformationLinkInfo none Returns a list of InformationLink objects related to the rule
getManualCheckProcedures Array of Strings none Returns a list of strings describing the manual testing proceedures (NOTE: Can be empty)
getPrimarySuccessCriterion SuccessCriterionInfo none A reference to information about the primary success criteria associated with the rule
getPurpose Array of Strings none Returns a list of strings describing how the rule requirements help people with disabilities
getRelatedSuccessCriteria Array of SuccessCriterionInfo none Returns a list of references to information about the secondary success criteria associated with the rule
getRuleCategory RuleCategoryInfo none A reference to an object describing the rule category associated with the rule
getRuleDefinition String required (Boolean):
  • true if rule is required
  • false is rule is recommended
Returns a string describing the requirements of the rule
getRuleId String none A programmatic id used to associated rule definitions with NLS rule information
getRuleID String none Returns a string describing the requirements of the rule
getRuleIdNLS String none Returns a human readable id used to identify a rule
getRuleScope Number none

A constant representing the rule scope:

  • OpenAjax.a11y.RULE_SCOPE.ELEMENT
  • OpenAjax.a11y.RULE_SCOPE.PAGE
  • OpenAjax.a11y.RULE_SCOPE.WEBSITE
getRuleScopeNLS String none Returns a NLS localized string representing the rule scope:
  • 'Element'
  • 'Page'
  • 'Website'
getRuleSummary String required (Boolean):
  • true if rule is required
  • false is rule is recommended
Returns a short string identifying the requirements of the rule
getTargetResources Array of Strings none Returns a list of strings identifying elements related to the rule
getTargetResourcesDescription String none A string describing the target resources of related to the rule
getTechniques Array of Strings none Returns a list of strings describing the techniques that can be used to satisfy the requirements of a rule
getWCAG20Level String none

Returns a string representing the WCAG 2.0 level

  • 'A'
  • 'AA'
  • 'AAA'
getWCAG20LevelConstan Number none

Returns a constant representing the WCAG 2.0 level

  • OpenAjax.a11y.WCAG20_LEVEL.A
  • OpenAjax.a11y.WCAG20_LEVEL.AA
  • OpenAjax.a11y.WCAG20_LEVEL.AA


Ruleset Object

Ruleset Object documentation (JSDoc Format)

This object contains:

  • Contains information about the rules in a ruleset
  • Configuration of evaluation processing
  • Executing an evaluation on specified W3C DOM object
  • Generates evaluation results

Ruleset Methods

Method Returns Arguments Description
evaluate EvaluationResult
  • url (String): url of document being analyzed
  • title (String): Title of document being analyzed
  • doc (DOM Object): Browser document object model (DOM) to be evaluated
Evaluates the rules in the ruleset against a DOM and returns an evaluation result
setBrokenLinkTesting nothing
  • enabled (Boolean): If true tests for broken links; otherwise does not test for broken links (default: false)
Enable or disable the testing of broken links
getBrokenLinkTesting Boolean none Returns true if broken link testing is enabled, otherwise false
setEvaluationLevels nothing
  • level (Number): WCAG 2.0 level constant (e.g. OpenAjax.a11y.EVALUATION_LEVELS.A | OpenAjax.a11y.EVALUATION_LEVELS.A_AA (default) | OpenAjax.a11y.EVALUATION_LEVELS.A_AA_AAA)
Sets a filter to evaluate only rules with a primary WCAG 2.0 success critera of a certain level
getEvaluationLevels Number none Returns the filter constant related to evaluating only rules with a primary WCAG 2.0 success critera of a certain level
setEventHandlerProcessor nothing
  • option (String): 'firefox' | 'fae-util' | 'none' (default)
Sets the event handler identification processor used to identify events on a DOM element
getEventHandlerProcessor String none Returns string representing which event process (if any) is being used to identify events on a DOM node
getRulesetInfo RulesetInfo none Returns an object that contains information about the current ruleset


EvaluationResult Object

EvaluationResult Object Documentation (JSDoc Format)

An object that contains:

  • An array of RuleResult objects
  • Information about the all the rule results, including summary information

EvaluationResult Methods

Method Returns Arguments Description
getDate String none Returns a string representing the date and time of the evaluation
getEvaluationTitle String none Returns a string representing the title defined when the evaluation (e.g. of Ruleset Object) method was called
getEvaluationURL String none Returns a string representing the URL defined when the evaluation (e.g. of Ruleset Object) method was called
getImplementationScore Number none Returns a number between 0-100 indicating the level of implementation of rule requirements
getImplementationValue Number none Returns a constant that can is used to represent the level of implementation based on the implementation score and wether there are manual check results:
  • OpenAjax.a11y.IMPLEMENTATION.MANUAL_CHECKS_ONLY
  • OpenAjax.a11y.IMPLEMENTATION.COMPLETE_WITH_MANUAL_CHECKS
  • OpenAjax.a11y.IMPLEMENTATION.COMPLETE
  • OpenAjax.a11y.IMPLEMENTATION.ALMOST_COMPLETE
  • OpenAjax.a11y.IMPLEMENTATION.PARTIAL_IMPLEMENTATION
  • OpenAjax.a11y.IMPLEMENTATION.NOT_IMPLEMENTED
getRuleResultsArray Array of RuleResult none Returns a list of all RuleResult objects created during the evaluation
getRuleResultsByGuideline RuleGroupResult guidleine_id (Number):
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_1_1
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_1_2
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_1_3
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_1_4
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_2_1
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_2_2
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_2_3
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_2_4
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_3_1
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_3_2
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_3_3
  • OpenAjax.a11y.WCAG20_GUIDELINE.G_4_1
RuleGroupResult object containing information about the guideline and the rule results of the rules associated with the a WCAG 2.0 guidleine, based on a rules primary WCAG 2.0 Success Criteria reference.
getRuleResultsByRuleCategory RuleGroupResult rule_category_id (Number):
  • OpenAjax.a11y.RULE_CATEGORIES.LANDMARKS
  • OpenAjax.a11y.RULE_CATEGORIES.HEADINGS
  • OpenAjax.a11y.RULE_CATEGORIES.STYLES_READABILITY
  • OpenAjax.a11y.RULE_CATEGORIES.IMAGES
  • OpenAjax.a11y.RULE_CATEGORIES.LINKS
  • OpenAjax.a11y.RULE_CATEGORIES.TABLES
  • OpenAjax.a11y.RULE_CATEGORIES.FORMS
  • OpenAjax.a11y.RULE_CATEGORIES.WIDGETS_SCRIPTS
  • OpenAjax.a11y.RULE_CATEGORIES.AUDIO_VIDEO
  • OpenAjax.a11y.RULE_CATEGORIES.KEYBOARD_SUPPORT
  • OpenAjax.a11y.RULE_CATEGORIES.TIMING
  • OpenAjax.a11y.RULE_CATEGORIES.SITE_NAVIGATION
RuleGroupResult object containing information about the guideline and the rule results of the rules associated with the a rule category based on a rules rule category property
getRuleResultsSummary RuleResultsSummary none Returns a RuleResultsSummary object that contains counts of violations, warnings, manual checks, passed and not applicable rule results
getRuleset Ruleset none Returns the Ruleset Object used to create this EvaluationResult
hasRuleResults Boolean none Returns:
  • true if the evaluation has any rule results
  • false if no rule results
toCSV String none Returns
toHTML String none Returns
toJSON String none Returns

RuleGroupResult Object

RuleGroupResult Object Documentation (JSDoc Format)

An object that contains:

  • an array of RuleResult objects
  • information about the group of rule results, including summary information


RuleGroupResult Methods

Method Returns Arguments Description
getEvaluationResult String none Returns the EvaluationResult Object used to create this RuleGroupResult Object
getImplementationScore Number none Returns a number between 0-100 indicating the level of implementation of rule requirements
getImplementationValue Number none Returns a constant that can is used to represent the level of implementation based on the implementation score and wether there are manual check results:
  • OpenAjax.a11y.IMPLEMENTATION.MANUAL_CHECKS_ONLY
  • OpenAjax.a11y.IMPLEMENTATION.COMPLETE_WITH_MANUAL_CHECKS
  • OpenAjax.a11y.IMPLEMENTATION.COMPLETE
  • OpenAjax.a11y.IMPLEMENTATION.ALMOST_COMPLETE
  • OpenAjax.a11y.IMPLEMENTATION.PARTIAL_IMPLEMENTATION
  • OpenAjax.a11y.IMPLEMENTATION.NOT_IMPLEMENTED
getRuleGroupDescription String none Returns a string describing the rule group
getRuleGroupInformationURL String none Returns a string representing a URL to more information about the rule group
getRuleGroupTitle String none Returns a string representing the title of the rule group
getRuleResultsArray Array of RuleResult none Returns a list of RuleResult objects associated with the rule grouping
getRuleResultsSummary RuleResultsSummary none Returns a RuleResultsSummary object that contains counts of violations, warnings, manual checks, passed and not applicable rule results
hasRuleResults Boolean none Returns a boolean:
  • true: if the RuleGroupResult has RuleResults
  • false: if the RuleGroupResult does not have RuleResults

RuleResult Object

RuleResult Object Documentation (JSDoc Format)

An object that contains:

  • A rule result value
  • A rule result message
  • Information about the associated rule
  • An array of element results
  • Summary information on element results

RuleResult Methods

Method Returns Arguments Description
getElementResultsSummary ElementResultsSummary none Returns a
getElementResultsArray Array of ElementResult none Returns a
getImplementationScore Number none Returns a number between 0-100 indicating the level of implementation of rule requirements
getImplementationValue Number none Returns a constant that can is used to represent the level of implementation based on the implementation score and wether there are manual check results:
  • OpenAjax.a11y.IMPLEMENTATION.MANUAL_CHECKS_ONLY
  • OpenAjax.a11y.IMPLEMENTATION.COMPLETE_WITH_MANUAL_CHECKS
  • OpenAjax.a11y.IMPLEMENTATION.COMPLETE
  • OpenAjax.a11y.IMPLEMENTATION.ALMOST_COMPLETE
  • OpenAjax.a11y.IMPLEMENTATION.PARTIAL_IMPLEMENTATION
  • OpenAjax.a11y.IMPLEMENTATION.NOT_IMPLEMENTED
getRule Rule none Returns a
getRuleDefinition String none Returns a string with rule definition based if the rule was required or recommended in the ruleset
getRuleResultValue Number none Returns a
getRuleResultMessage String none Returns a string with rule result message
getRuleSummary String none Returns the rule summary based on if the rule is required or recommended in the ruleset
hasElementResults Boolean none Returns a
hasHiddenElements Boolean none Returns
isRuleRequired Boolean none Returns a

ElementResult Object

ElementResult Object Documentation (JSDoc Format)

An object that contains:

  • An element result value
  • An element result message
  • Tag name and/or attribute information used to identify the element
  • A reference to the live DOM node in the web page
  • The ordinal position of the element in the DOM
  • Important information about the element used by the rule evaluation method
  • The primary element information needed for understanding the accessibility of the element for this rule
  • An array of RelatedElementsInfo objects (each with information such as headers for a table cell, elements referenced by ARIA-LABELLEDBY, ...)

ElementResult Methods

Method Returns Arguments Description
getElementResultValue Number none Returns a
getElementResultMessage String none Returns a
getElementIdentifier String none Returns a
getElementInfoPrimary ElementInfo none Returns a
getElementInfoArray Array of ElementInfo none Returns a
getOrdinalPosition Number none Returns a
getDOMNode DOM node none Returns a
getRelatedElementsInfoArray Array of RelatedElementsInfo none Returns a

Result Summary Evaluation Library Objects

ElementResultsSummary Object

ElementResultsSummary Object Documentation (JSDoc Format)

An object that contains:

  • Count information about the element result values for a group of rules

ElementResultsSummary Properties

Property Type Description
num_element_violations Number Number of element results that are a violation
num_element_warnings Number Number of element results that are a warning
num_element_manual_checks Number Number of element results that require a manual check
num_element_passed Number Number of element results that passed
num_element_hidden Number Number of elements that a rule applied by the element was not evaluated because it was hidden

RuleResultsSummary Object

RuleResultsSummary Object Documentation (JSDoc Format)

An object that contains:

  • Count information about the rule result values for a group of rules

RuleResultsSummary Properties

Property Type Description
num_rule_violations Number Number of rule results with the result of violation
num_rule_warnings Number Number of rule results with the result of warning
num_rule_manual_checks Number Number of rule results with the result of manual check
num_rule_passed Number Number of rule results with the result of passed
num_rule_not_applicable Number Number of rule results with the result of not applicable

Information Related Evaluation Library Objects

ElementInfo Object

ElementInfo Object Documentation (JSDoc Format)

An object that contains:

  • NLS localized name of an element property
  • value of an element property

ElementInfo Properties

Property Type Description
property_name String Name of element attribute or property
property_value String Value of element attribute or property

GuidelineInfo Object

GuidelineInfo Object Documentation (JSDoc Format)


InformationLinkInfo Object

InformationLinkInfo Object Documentation (JSDoc Format)


RelatedElementsInfo Object

RelatedElementsInfo Object Documentation (JSDoc Format)

An object that contains:

  • The name of the relationship
  • An array of RelatedElement objects

RelatedElementsInfo Properties

Property Type Description
related_elements Array of RelatedElement An array of related element objects identifies the elements with the relationship
related_title String A title that describes the relationship (e.g. labeling elements, data table headers,..)

RelatedElementInfo Object

RelatedElementInfo Object Documentation (JSDoc Format)

An object that contains:

  • Element tag and/or attribute information use to identify the element
  • Reference to the live DOM node in the web page

RelatedElementInfo Properties

Property Type Description
element_identifier String A string that identifies the element
dom_node DOM Node DOM node pointer of the element in the document object


RuleCategoryInfo Object

RuleCategoryInfo Object Documentation (JSDoc Format)


RulesetInfo Object

RulesetInfo Object Documentation (JSDoc Format)


SuccessCriterionInfo Object

SuccessCriterionInfo Object Documentation (JSDoc Format)

Deprecated API Information

FIltered Rule Result Objects

Filtered rule result objects are ad hoc (non-persistent) groupings of rule results, and by extension node results, based on the following filtering criteria:

  • Node result type (i.e. element level manual check)
  • Rule Category
  • WCAG 2.0 Principle, Guideline or Success Criterion

Filtered rule result objects are created from calling methods on the EvaluationResult object. The methods can return one of two types of objects:

  1. FilteredRuleResultsGroup object: Object containing a list of FilteredRuleResult objects
  2. FilteredRuleResultsGroups object: Object containing a list of FilteredRuleResultsGroups or FilteredRuleResultsGroup objects

NOTE: Programmer needs to maintain references to the returned FilteredRuleResult objects, since they do not persist in the EvaluationResult object.

FIlteredRuleResultsGroup object includes:

  • Summary results for the group of rule results
  • A list of FilteredRuleResult objects associated with the group
  • A list of FilteredNodeResult objects for each FilteredRuleResult object

FIlteredRuleResultsGroups object includes:

  • Summary results for all rule results for the entire document
  • Groupings are based on one of the follow:
    1. Required/Recommend rule types
    2. All the Rule Categories
    3. The complete WCAG 2.0 hierarchy
  • A list of FilteredRuleResultsGroups or FilteredRuleResultsGroup objects


The FilteredRuleResultsGroups object is pimarily used to generate WCAG 2.0 compliance view to show how the rule results for each Success Criterion, Guideline, and Principle.

Shared Methods for Rule. RuleResult, NodeResult, FilteredRuleResult and FilteredNodeResult objects

Method Returns Rule Object RuleResult Object NodeResult Object FilteredRuleResult Object FilteredNodeResult Object
getPrincipleFilterConstant Number X X
getGuidelineFilterConstant Number X X
getSuccessCriterionFilterConstant Number X X
getTargetResourceProperties Array X X
getCorrectiveAction String X X X X X
getInfoLinks Array of RuleInformationItem objects X X X X X
getManualCheckProcedures Array of RuleInformationItem objects X X X X X
getPrimarySuccessCriterion SuccessCriterionInformation X X X X X
getPurpose Array of RuleInformationItem objects X X X X X
getRelatedSuccessCriteria Array of SuccessCriterionInformation objects X X X X X
getRuleCategory RuleInformationItem X X X X X
getRuleCategoryConstant Number X X X X X
getRuleDefinition String X X X X X
getRuleId String X X X X X
getRuleIdNLS String X X X X X
getRuleScope String X X X X X
getRuleSummary String X X X X X
getTargetResources Array X X X X X
getTargetResourcesDescription String X X X X X
getTechniques Array of RuleInformationItem objects X X X X X
getWCAG20Level String X X X X X
getWCAG20LevelConstant Number
(typically used for sorting)
X X X X X
isScopeElement Boolean X X X X X
isScopePage Boolean X X X X X
getResultMessage String X X X X
getResultMessages String X X
isRuleRequired Boolean X X X X
getOrdinalPosition Number X X
getResultProperties Array of Strings X X
getResultValue Object X X
getResultValueConstant Number
(can be used for sorting at list)
X X
getCacheItem Object X X
getXPath String X X
getCorrectiveAction String X X
hasCorrectiveAction Boolean X X
getNodeResults Array of NodeResult objects X X
getResultSummary ResultSummary object X X
hasResults Boolean X X

Shared Methods for EvaluationResult, FilteredRuleResultsGroups, FilteredRuleResultsGroup and FilteredCacheItemResults objects

Method Returns FilteredRuleResultsGroup Object FilteredRuleResultsGroups Object EvaluationResult Object FilteredCacheItemResults Object
getDocumentObject DOM Object X X X X
getResultSummary ResultSummary object X X X X
hasResults Boolean X X X X
hasRules Boolean X X X X
hasElements Boolean X
isTree Boolean X
toHTML String X X X X
toJSON String X X X X
toCSV String X X X X
Proposed New Methods 2.0.4a
getRulesetInformation (proposed change to getRulesetInfo) RulesetInformation object X X X X
getWebPageInformation (proposed change to getPageInfo) WebPageInformation object X X X X
getGroupInformation (proposed change to getRuleResultsGroupInfo) GroupInformation object X X
Proposed Depricated Methods 2.0.5a
getTitle String X X X X
getDescription String X X X
getURL String X X X X
getNumberOfRules Number X X X
getNumberOfRequiredRules Number X X X
getNumberOfRecommenedRules Number X X X

Methods for CacheItemResult objects

Method Returns CacheItemResult Object
getCacheItem Object X
getHighestResultTypeConstant Number X
getNodeResults Array of NodeResult objects X
getOrdinalPosition Number X
getResultSummary ResultSumary Object X
hasResults Boolean X
Personal tools