Evaluation Library API: Evaluation Objects
From MemberWiki
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
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:
|
| getCategoryInfo | RuleCategoryInfo | none | A reference to an object describing the rule category associated with the rule
|
| getDefinition | String | required (Boolean):
| Returns a string describing the requirements of the rule |
| getGroup | Number | none |
A constant representing the rule group:
|
| getGroupNLS | String | none | Returns a string representing the rule group:
|
| getGuideline | Number | none | A number uniquely identifying the guideline:
|
| 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:
|
| getScopeNLS | String | none | Returns a string representing the rule scope:
|
| getSummary | String | required (Boolean):
| 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
|
| getWCAG20LevelNLS (Broken) | String | none |
Returns a string representing the WCAG 2.0 level
|
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:
|
| 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 |
| Sets the value of the named parameter required for constructing a Ruleset object |
| setFeature | Boolean |
| Sets the current ruleset information, returns
|
| 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' |
| If true recommended rules will be included in evaluations |
| 'wcag20Level' |
| Filters rules for evaluation based on the WCAG 2.0 level of the primary success criteria:
|
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 |
| 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:
| 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 |
| Evaluates the rules in the ruleset against a DOM and returns an evaluation result |
| getBrokenLinkTesting | Boolean | none | Returns:
|
| isProcessingEvents | Boolean | none | Returns:
|
| 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 |
| Sets the value of the specified parameter used in constructing an Evaluator object |
| setFeature | Boolean |
| Sets the named feature for the EvaluatorFactory, returns
|
| 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' |
| 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' |
| Identifies a method to get event information for the rules to use in evaluations |
