Evaluation Library API: Evaluation Objects

From MemberWiki

Jump to: navigation, search

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

Evaluation Library API: Evaluation Objects | Result Objects | Information and Summary Objects

Contents

Overview

The Evaluation objects are those objects necessary for performing an evaluation of a web page; they must exist prior to the evaluation. They include:

Note to tools developers: Of the objects covered here, it is unlikely you will need to utilize the Ruleset constructor or RulesetFactory object. Ruleset objects are created and stored by the library itself, and are retrievable by tools developers from the RulesetManager object.


Rule object

Rule JSDoc documentation

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
getCategory Number none A number uniquely identifying the rule category:
  • 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
getCategoryInfo RuleCategoryInfo none A reference to an object describing the rule category associated with the rule


getDefinition String required (Boolean):
  • true if rule is required
  • false is rule is recommended
Returns a string describing the requirements of the rule
getGroup Number none

A constant representing the rule group:

  • OpenAjax.a11y.RULE_GROUP.GROUP1
  • OpenAjax.a11y.RULE_GROUP.GROUP2
  • OpenAjax.a11y.RULE_GROUP.GROUP3
getGroupNLS String none Returns a string representing the rule group:
  • 'Group 1'
  • 'Group 2'
  • 'Group 3'


getGuideline Number none A number uniquely identifying the guideline:
  • 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
getGuidelineInfo RuleGuidelineInfo none A reference to an object describing the guideline associated with the rule


getId String none An ID string used to uniquely identify the rule
getIdNLS String none A human readable version of the rule ID
getInformationalLinks Array of InformationalLinkInfo none Returns a list of InformationalLinkInfo 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
getScope Number none

A constant representing the rule scope:

  • OpenAjax.a11y.RULE_SCOPE.ELEMENT
  • OpenAjax.a11y.RULE_SCOPE.PAGE
  • OpenAjax.a11y.RULE_SCOPE.WEBSITE
getScopeNLS String none Returns a string representing the rule scope:
  • 'Element'
  • 'Page'
  • 'Website'
getSummary String required (Boolean):
  • true if rule is required
  • false is rule is recommended
Returns a short string identifying the requirements of the rule
getTargetResourcePrimaryProperty String none Returns a string identifying the primary attribute or calculated property of the element that was used in the evaluation the rule

NOTE: An empty string means no primary property was defined for the rule, this is often the case for rules with scope of Page or Website

getTargetResourceSecondaryProperties Array of Strings none Returns a list of strings identifying the attributes and calculated properties of the element that are used in the evaluation of the rule

NOTE: An empty array means no secondary properties were defined for the rule, this is often the case for rules with scope of Page or Website

getTargetResources Array of Strings none Returns a list of strings identifying elements, attributes or events analyzed by 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 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
getWCAG20LevelNLS (Broken) String none

Returns a string representing the WCAG 2.0 level

  • 'A'
  • 'AA'
  • 'AAA'


Ruleset object

An object that encapsulates all of the evaluation functionality and information associated with a particular ruleset.


Ruleset constructor

Parameter Type Description
1 Ruleset ID String that uniquely identifies the ruleset
2 Array of Rule objects List of rules that the Ruleset will contain
3 Array of RuleNLS objects List of RuleNLS messages that correspond to the Rule objects in the list of rules
4 List of RuleMapping objects Objects that map additional properties to each rule in the ruleset

Each mapping includes:

  • Rule ID
  • Required or recommended
  • Enabled or disabled
5 RulesetInfo object Information about the ruleset


Ruleset methods

Method Returns Arguments Description
getRulesArray Array of Rule objects none Returns the complete list of Rule objects in the ruleset
getRulesetInfo RulesetInfo object none Returns an object that contains information about the current ruleset
getRule Rule object String representing the rule ID Returns the rule object for a given rule ID
getId String none Returns a string that uniquely identifies the ruleset


RulesetFactory object

This object is a wrapper around the Ruleset object. It handles the setup and configuration of a Ruleset, and returns an immutable Ruleset object. It does not have a constructor, but instead has a "newInstance" method, among others.


RulesetFactory methods

Method Returns Arguments Description
newInstance RulesetFactory none Returns a new instance of a RulesetFactory
setParameter Boolean
  • parameter name
  • parameter value
Sets the value of the named parameter required for constructing a Ruleset object
setFeature Boolean
  • feature name
  • feature value
Sets the current ruleset information, returns
  • true if the feature was set
  • false if the feature was not set or is not available
newRuleset Ruleset none Returns a Ruleset object for use in an evaluation


RulesetFactory parameters

These correspond to the Ruleset constructor parameters. Each of these parameters is required, and must be set using the 'setParameter' method before calling the 'newRuleset' method.

Name Value Type Description
'rulesetId' String Unique identifier for the ruleset
'rules' Array of Rule objects List of rules that the Ruleset will contain
'rulesNLS' Array of RuleNLS objects List of RuleNLS messages that correspond to the Rule objects in the list of rules
'mappings' List of RuleMapping objects Objects that map additional properties to each rule in the ruleset
'rulesetInfo' RulesetInfo object Information about the ruleset


RulesetFactory features

Calling the 'setFeature' method for any feature with a default value is optional, and can be executed after calling the 'newRuleset' method.

Feature Values Description
'recommendedRules'
  • 'enabled' (default)
  • 'disabled'
If true recommended rules will be included in evaluations
'wcag20Level'
  • 'A'
  • 'A_AA' (default)
  • 'A_AA_AAA'
Filters rules for evaluation based on the WCAG 2.0 level of the primary success criteria:
  • 'A' : Only evaluate rules with primary success criteria that is level A
  • 'A_AA' (default) : Only evaluate rules with primary success criteria that is level A or level AA
  • 'A_AA_AAA': Evaluate all rules


RulesetManager object

An object that provides access to immutable Ruleset objects and information about all of the rulesets that are available.


RulesetManager methods

Method Returns Arguments Description
addRuleset none
  • String: rulesetId
  • Ruleset object
Adds a Ruleset object to the collection of rulesets it maintains. It is expected that the Ruleset object was creating using the RulesetFactory object and is therefore immutable.
getRuleset Ruleset object String: rulesetId Returns a Ruleset object associated with the specified ID
getInfoAllRulesets Array of objects, each of which has the following properties:
  • rulesetId: String: Ruleset ID
  • rulesetInfo: RulesetInfo object
none Returns an array of objects keyed by rulesetId and containing a RulesetInfo object


Evaluator object

This object is used to run an evaluation on a DOM object. It is preconfigured with a Ruleset object and returns an EvaluationResult object. It also has methods for setting evaluation related features such as

  • Broken link testing
  • Event processing options

It does not have a constructor method and can only be created via the EvaluatorFactory object.


Evaluator methods

Method Returns Arguments Description
evaluate EvaluationResult
  1. doc (DOM Object): Browser document object model (DOM) to be evaluated
  2. title (String): Title of document being analyzed
  3. url (String): url of document being analyzed
Evaluates the rules in the ruleset against a DOM and returns an evaluation result
getBrokenLinkTesting Boolean none Returns:
  • true: Links are being tested for reference errors
  • false: Links are NOT being tested for reference errors
isProcessingEvents Boolean none Returns:
  • true: if event information is being processed
  • false: if event information is not being identified (e.g. error or configuration)
getRulesetInfo RulesetInfo none Returns the RulesetInfo object


EvaluatorFactory object

This object is used (and is in fact the only way) to create an Evaluator object. It is preconfigured with a Ruleset object. It also can be configured to:

  • Enable and disable broken link testing
  • Define event processing technique

It does not have a constructor, but instead provides a 'newInstance' method.


EvaluatorFactory methods

Method Returns Arguments Description
newInstance EvaluatorFactory none Returns a new instance of an EvaluatorFactory
setParameter Boolean
  • String: parameter name
  • Object Reference: parameter value
Sets the value of the specified parameter used in constructing an Evaluator object
setFeature Boolean
  • String: feature name
  • String: feature value
Sets the named feature for the EvaluatorFactory, returns
  • true if the feature was set
  • false if the feature was not set or is not available
newEvaluator Evaluator object none Returns a Evaluator object for use in an evaluation


EvaluatorFactory parameters

Each parameter listed is required, and must be set using the 'setParameter' method before calling the 'newEvaluator' method.

Name Value Type Description
'ruleset' Object Reference to the desired and preconfigured ruleset


EvaluatorFactory features

Feature Values Description
'groups'
  • OpenAjax.a11y.RULE_GROUP.GROUP1
  • OpenAjax.a11y.RULE_GROUP.GROUP2
  • OpenAjax.a11y.RULE_GROUP.GROUP3
  • OpenAjax.a11y.RULE_GROUP.GROUP12
  • OpenAjax.a11y.RULE_GROUP.GROUP123 (default)
Identifies which rules will be evaluated based on their rule group
'brokenLinkTesting'

Boolean (default false)

If true tests URL references to see if they are broken links
'eventProcessor'
  • 'firefox'
  • 'fae-util'
  • 'none' (default)
Identifies a method to get event information for the rules to use in evaluations