Skip to content

Commit

Permalink
code refactor #1974
Browse files Browse the repository at this point in the history
  • Loading branch information
shunguoy committed Aug 30, 2024
1 parent 5f93813 commit eeb7eb8
Show file tree
Hide file tree
Showing 176 changed files with 1,115 additions and 1,080 deletions.
10 changes: 5 additions & 5 deletions accessibility-checker-engine/src/v2/api/IEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,27 @@ export { eGuidelineType as eRulesetType } from "../../v4/api/IGuideline";
/**
* @deprecated See ../../v4/api/IRule
*/
export let RulePass = RulePassNew;
export const RulePass = RulePassNew;

/**
* @deprecated See ../../v4/api/IRule
*/
export let RuleRender = RuleRenderNew;
export const RuleRender = RuleRenderNew;

/**
* @deprecated See ../../v4/api/IRule
*/
export let RuleFail = RuleFailNew;
export const RuleFail = RuleFailNew;

/**
* @deprecated See ../../v4/api/IRule
*/
export let RulePotential = RulePotentialNew;
export const RulePotential = RulePotentialNew;

/**
* @deprecated See ../../v4/api/IRule
*/
export let RuleManual = RuleManualNew;
export const RuleManual = RuleManualNew;

/**
* @deprecated See ../../v4/api/IRule
Expand Down
6 changes: 3 additions & 3 deletions accessibility-checker-engine/src/v2/common/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Context, PartInfo, AttrInfo } from "./Context";
import { Config } from "../config/Config";
import { DOMMapper } from "../dom/DOMMapper";
import { DOMUtil } from "../dom/DOMUtil";
import { clearCaches } from "../../v4/util/CacheUtil";
import { CacheUtil } from "../../v4/util/CacheUtil";
import { Issue, Rule, RuleContext, RuleContextHierarchy, RuleResult, eRuleConfidence } from "../../v4/api/IRule";
import { HelpMap, IEngine, NlsMap } from "../../v4/api/IEngine";
import { IMapper } from "../../v4/api/IMapper";
Expand Down Expand Up @@ -161,7 +161,7 @@ export class Engine implements IEngine {
root = (root as Document).documentElement;
}
root.ownerDocument && ((root.ownerDocument as any).PT_CHECK_HIDDEN_CONTENT = false);
clearCaches(root);
CacheUtil.clearCaches(root);
const walker = new DOMWalker(root);
const retVal : Report = {
results: [],
Expand Down Expand Up @@ -244,7 +244,7 @@ export class Engine implements IEngine {
}
}
} while (walker.nextNode());
clearCaches(root);
CacheUtil.clearCaches(root);
retVal.totalTime = new Date().getTime()-start;
return Promise.resolve(retVal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { VisUtil } from "../util/VisUtil";
import { Rule, RuleResult, RuleContext, RulePotential, RulePass, RuleContextHierarchy } from "../api/IRule";
import { eRulePolicy, eToolkitLevel } from "../api/IRule";

export let a_target_warning: Rule = {
export const a_target_warning: Rule = {
id: "a_target_warning",
context: "dom:a[target],dom:area[target],dom:base[target]",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { CommonUtil } from "../util/CommonUtil";
import { VisUtil } from "../util/VisUtil";
import { eRulePolicy, eToolkitLevel } from "../api/IRule";

export let a_text_purpose: Rule = {
export const a_text_purpose: Rule = {
id: "a_text_purpose",
// doc-biblioref is a link
context: "aria:link,aria:doc-biblioref",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { VisUtil } from "../util/VisUtil";
import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy } from "../api/IRule";
import { eRulePolicy, eToolkitLevel } from "../api/IRule";

export let applet_alt_exists: Rule = {
export const applet_alt_exists: Rule = {
id: "applet_alt_exists",
context: "dom:applet",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { VisUtil } from "../util/VisUtil";
import { Rule, RuleResult, RuleContext, RulePotential, RulePass, RuleContextHierarchy } from "../api/IRule";
import { eRulePolicy, eToolkitLevel } from "../api/IRule";

export let application_content_accessible: Rule = {
export const application_content_accessible: Rule = {
id: "application_content_accessible",
context: "aria:application",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { VisUtil } from "../util/VisUtil";
import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy } from "../api/IRule";
import { eRulePolicy, eToolkitLevel } from "../api/IRule";

export let area_alt_exists: Rule = {
export const area_alt_exists: Rule = {
id: "area_alt_exists",
context: "dom:area",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { CommonUtil } from "../util/CommonUtil";

export let aria_activedescendant_tabindex_valid: Rule = {
export const aria_activedescendant_tabindex_valid: Rule = {
id: "aria_activedescendant_tabindex_valid",
context: "dom:*[aria-activedescendant]",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { FragmentUtil } from "../../v2/checker/accessibility/util/fragment";
import { VisUtil } from "../util/VisUtil";
import { DOMUtil } from "../../v2/dom/DOMUtil";

export let aria_activedescendant_valid: Rule = {
export const aria_activedescendant_valid: Rule = {
id: "aria_activedescendant_valid",
context: "dom:*[aria-activedescendant]",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { getCache, setCache } from "../util/CacheUtil";
import { CacheUtil } from "../util/CacheUtil";

export let aria_application_label_unique: Rule = {
export const aria_application_label_unique: Rule = {
id: "aria_application_label_unique",
context: "aria:application",
refactor: {
Expand Down Expand Up @@ -60,14 +60,14 @@ export let aria_application_label_unique: Rule = {
return null;
}

let dupes = getCache(
let dupes = CacheUtil.getCache(
ruleContext.ownerDocument,
"aria_application_label_unique",
null
);
if (!dupes) {
dupes = AriaUtil.findAriaLabelDupes(landmarks);
setCache(
CacheUtil.setCache(
ruleContext.ownerDocument,
"aria_application_label_unique",
dupes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { VisUtil } from "../util/VisUtil";

export let aria_application_labelled: Rule = {
export const aria_application_labelled: Rule = {
id: "aria_application_labelled",
context: "aria:application",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { getCache, setCache } from "../util/CacheUtil";
import { CacheUtil } from "../util/CacheUtil";

export let aria_article_label_unique: Rule = {
export const aria_article_label_unique: Rule = {
id: "aria_article_label_unique",
context: "aria:article",
refactor: {
Expand Down Expand Up @@ -60,14 +60,14 @@ export let aria_article_label_unique: Rule = {
return null;
}

let dupes = getCache(
let dupes = CacheUtil.getCache(
ruleContext.ownerDocument,
"aria_article_label_unique",
null
);
if (!dupes) {
dupes = AriaUtil.findAriaLabelDupes(landmarks);
setCache(
CacheUtil.setCache(
ruleContext.ownerDocument,
"aria_article_label_unique",
dupes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { ARIADefinitions } from "../../v2/aria/ARIADefinitions";
import { AriaUtil } from "../util/AriaUtil";

export let aria_attribute_allowed: Rule = {
export const aria_attribute_allowed: Rule = {
id: "aria_attribute_allowed",
context: "dom:*",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";

export let aria_attribute_conflict: Rule = {
export const aria_attribute_conflict: Rule = {
id: "aria_attribute_conflict",
context: "dom:*[aria-required], dom:*[aria-autocomplete], dom:*[aria-readonly], dom:*[aria-disabled], dom:*[aria-placeholder]"
+ ", dom:*[aria-checked], dom:*[aria-hidden], dom:*[aria-valuemax], dom:*[aria-valuemin], dom:*[aria-colspan]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Rule, RuleResult, RuleFail, RuleContext, RuleContextHierarchy } from ".
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";

export let aria_attribute_deprecated: Rule = {
export const aria_attribute_deprecated: Rule = {
id: "aria_attribute_deprecated",
context: "dom:*",
help: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CommonUtil } from "../util/CommonUtil";
import { ARIADefinitions } from "../../v2/aria/ARIADefinitions";
import { VisUtil } from "../util/VisUtil";

export let aria_attribute_exists: Rule = {
export const aria_attribute_exists: Rule = {
id: "aria_attribute_exists",
context: "dom:*[role]",
dependencies: ["aria_role_allowed"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";

export let aria_attribute_redundant: Rule = {
export const aria_attribute_redundant: Rule = {
id: "aria_attribute_redundant",
context: "dom:*[aria-required], dom:*[aria-autocomplete], dom:*[aria-readonly], dom:*[aria-disabled], dom:*[aria-placeholder]"
+ ", dom:*[aria-checked], dom:*[aria-hidden], dom:*[aria-valuemax], dom:*[aria-valuemin], dom:*[aria-colspan]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { CommonUtil } from "../util/CommonUtil";
import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy } from "../api/IRule";
import { eRulePolicy, eToolkitLevel } from "../api/IRule";

export let aria_attribute_required: Rule = {
export const aria_attribute_required: Rule = {
id: "aria_attribute_required",
context: "dom:*[role]",
dependencies: ["aria_role_allowed"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { ARIADefinitions } from "../../v2/aria/ARIADefinitions";

export let aria_attribute_value_valid: Rule = {
export const aria_attribute_value_valid: Rule = {
id: "aria_attribute_value_valid",
context: "dom:*",
dependencies: ["aria_attribute_allowed"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { CacheUtil } from "../util/CacheUtil";

export let aria_banner_label_unique: Rule = {
export const aria_banner_label_unique: Rule = {
id: "aria_banner_label_unique",
context: "aria:banner",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";

export let aria_banner_single: Rule = {
export const aria_banner_single: Rule = {
id: "aria_banner_single",
context: "dom:*[role], dom:header",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CommonUtil } from "../util/CommonUtil";
import { ARIADefinitions } from "../../v2/aria/ARIADefinitions";
import { VisUtil } from "../util/VisUtil";

export let aria_child_tabbable: Rule = {
export const aria_child_tabbable: Rule = {
id: "aria_child_tabbable",
context: "dom:*[role]",
dependencies: ["aria_role_allowed"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { VisUtil } from "../util/VisUtil";

export let aria_child_valid: Rule = {
export const aria_child_valid: Rule = {
id: "aria_child_valid",
//context: "dom:*[role]",
//dependencies: ["Rpt_Aria_ValidRole"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { CacheUtil } from "../util/CacheUtil";

export let aria_complementary_label_unique: Rule = {
export const aria_complementary_label_unique: Rule = {
id: "aria_complementary_label_unique",
context: "aria:complementary",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";

export let aria_complementary_label_visible: Rule = {
export const aria_complementary_label_visible: Rule = {
id: "aria_complementary_label_visible",
context: "dom:*[role], dom:aside",
dependencies: ["aria_complementary_labelled"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { VisUtil } from "../util/VisUtil";

export let aria_complementary_labelled: Rule = {
export const aria_complementary_labelled: Rule = {
id: "aria_complementary_labelled",
context: "aria:complementary",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { DOMWalker } from "../../v2/dom/DOMWalker";
import { VisUtil } from "../util/VisUtil";
import { TableUtil } from "../util/TableUtil";

export let aria_content_in_landmark: Rule = {
export const aria_content_in_landmark: Rule = {
id: "aria_content_in_landmark",
context: "dom:*",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { CacheUtil } from "../util/CacheUtil";

export let aria_contentinfo_label_unique: Rule = {
export const aria_contentinfo_label_unique: Rule = {
id: "aria_contentinfo_label_unique",
context: "aria:contentinfo",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";

export let aria_contentinfo_misuse: Rule = {
export const aria_contentinfo_misuse: Rule = {
id: "aria_contentinfo_misuse",
context: "dom:*[role], dom:footer, dom:address",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";

export let aria_contentinfo_single: Rule = {
export const aria_contentinfo_single: Rule = {
id: "aria_contentinfo_single",
context: "dom:*[role], dom:footer, dom:address",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { VisUtil } from "../util/VisUtil";

export let aria_descendant_valid: Rule = {
export const aria_descendant_valid: Rule = {
id: "aria_descendant_valid",
context: "dom:*",
dependencies: ["aria_role_valid"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { CacheUtil } from "../util/CacheUtil";

export let aria_document_label_unique: Rule = {
export const aria_document_label_unique: Rule = {
id: "aria_document_label_unique",
context: "aria:document",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";

export let aria_eventhandler_role_valid: Rule = {
export const aria_eventhandler_role_valid: Rule = {
id: "aria_eventhandler_role_valid",
context: "dom:*[onclick],dom:*[onblur], dom:*[ondblclick], dom:*[onfocus], dom:*[onkeydown],dom:*[onkeypress], dom:*[onkeyup], dom:*[onmousedown], dom:*[onmouseup], dom:*[onmousemove], dom:*[onmouseout], dom:*[onmouseover], dom:*[onresize], dom:*[onchange]",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { CacheUtil } from "../util/CacheUtil";

export let aria_form_label_unique: Rule = {
export const aria_form_label_unique: Rule = {
id: "aria_form_label_unique",
context: "aria:form",
refactor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { VisUtil } from "../util/VisUtil";

export let aria_graphic_labelled: Rule = {
export const aria_graphic_labelled: Rule = {
id: "aria_graphic_labelled",
context: "aria:graphics-document,aria:graphics-symbol",
refactor: {
Expand Down
Loading

0 comments on commit eeb7eb8

Please sign in to comment.