@markuplint/ml-spec 5.0.0-rc.2 → 5.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +0 -8
- package/lib/algorithm/aria/accname/aria-steps.d.ts +0 -24
- package/lib/algorithm/aria/accname/aria-steps.js +0 -24
- package/lib/algorithm/aria/accname/compute.d.ts +0 -10
- package/lib/algorithm/aria/accname/compute.js +0 -10
- package/lib/algorithm/aria/accname/element-names.d.ts +0 -23
- package/lib/algorithm/aria/accname/element-names.js +0 -23
- package/lib/algorithm/aria/accname/helpers.d.ts +2 -64
- package/lib/algorithm/aria/accname/helpers.js +2 -72
- package/lib/algorithm/aria/accname/label-steps.d.ts +2 -18
- package/lib/algorithm/aria/accname/label-steps.js +5 -21
- package/lib/algorithm/aria/accname/types.d.ts +0 -3
- package/lib/algorithm/aria/get-explicit-role.d.ts +1 -8
- package/lib/algorithm/aria/get-explicit-role.js +1 -8
- package/lib/algorithm/aria/get-non-presentational-ancestor.d.ts +2 -10
- package/lib/algorithm/aria/get-non-presentational-ancestor.js +2 -10
- package/lib/algorithm/aria/get-permitted-roles-spec.js +1 -0
- package/lib/algorithm/aria/matches-context-role.d.ts +3 -10
- package/lib/algorithm/aria/matches-context-role.js +3 -10
- package/lib/algorithm/html/content-model-category-to-tag-names.d.ts +5 -0
- package/lib/algorithm/html/content-model-category-to-tag-names.js +5 -0
- package/lib/index.d.ts +28 -0
- package/lib/index.js +28 -0
- package/lib/types/index.d.ts +35 -4
- package/lib/utils/schema-to-spec.d.ts +10 -0
- package/lib/utils/schema-to-spec.js +10 -0
- package/package.json +7 -7
- package/ARCHITECTURE.ja.md +0 -267
- package/ARCHITECTURE.md +0 -267
- package/SKILL.md +0 -116
- package/docs/aria-algorithms.ja.md +0 -802
- package/docs/aria-algorithms.md +0 -804
- package/docs/html-algorithms.ja.md +0 -469
- package/docs/html-algorithms.md +0 -469
- package/docs/maintenance.ja.md +0 -359
- package/docs/maintenance.md +0 -359
- package/docs/spec-resolution.ja.md +0 -575
- package/docs/spec-resolution.md +0 -588
- package/docs/type-definitions.ja.md +0 -584
- package/docs/type-definitions.md +0 -584
package/ARCHITECTURE.md
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
# @markuplint/ml-spec
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
`@markuplint/ml-spec` is the specification foundation layer for markuplint. It provides type definitions, W3C specification algorithms (ARIA/HTML), JSON schemas, and runtime utilities that form the bridge between raw web standard data and markuplint's lint rules.
|
|
6
|
-
|
|
7
|
-
The package reads element specifications, ARIA role/property definitions, and content model data from `@markuplint/html-spec` (and framework-specific spec packages), then exposes algorithms for computing ARIA roles, resolving element specifications, evaluating content models, and determining accessibility tree inclusion. Over 15 downstream packages depend on `@markuplint/ml-spec`.
|
|
8
|
-
|
|
9
|
-
## Directory Structure
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
src/
|
|
13
|
-
├── index.ts # Package entry point; re-exports all public APIs
|
|
14
|
-
├── types/
|
|
15
|
-
│ ├── index.ts # Hand-written core types (MLMLSpec, ElementSpec, ARIARole, etc.)
|
|
16
|
-
│ ├── aria.ts # Generated types from aria.schema.json (ARIA, PermittedRoles, ImplicitRole)
|
|
17
|
-
│ ├── attributes.ts # Generated types from attributes.schema.json (AttributeType, GlobalAttributes)
|
|
18
|
-
│ └── permitted-structures.ts # Generated types from content-models.schema.json (ContentModel, Category)
|
|
19
|
-
├── algorithm/
|
|
20
|
-
│ ├── aria/
|
|
21
|
-
│ │ ├── accname-computation.ts # Accessible name computation facade (DOM resolver + reentrant guard)
|
|
22
|
-
│ │ ├── accname/ # AccName pure algorithm (HTML-AAM §4.1)
|
|
23
|
-
│ │ │ ├── types.ts # AccnameElement/AccnameResolver interfaces
|
|
24
|
-
│ │ │ ├── compute.ts # Core algorithm: Steps 2A-2I
|
|
25
|
-
│ │ │ ├── aria-steps.ts # Steps 2B (aria-labelledby) and 2D (aria-label)
|
|
26
|
-
│ │ │ ├── element-names.ts # Step 2E: element-specific name (HTML-AAM §4.1)
|
|
27
|
-
│ │ │ ├── helpers.ts # Shared utilities (embedded controls, name-from-content)
|
|
28
|
-
│ │ │ ├── label-steps.ts # Step 2E: label association for labelable elements
|
|
29
|
-
│ │ │ ├── svg-helpers.ts # SVG accessible name source check
|
|
30
|
-
│ │ │ └── index.ts # Re-exports public API
|
|
31
|
-
│ │ ├── aria-specs.ts # Version-specific ARIA spec data retrieval
|
|
32
|
-
│ │ ├── get-aria.ts # Element-level ARIA spec resolution with conditions
|
|
33
|
-
│ │ ├── get-computed-aria-props.ts # ARIA property resolution (explicit → HTML → default)
|
|
34
|
-
│ │ ├── get-computed-role.ts # Core: final role computation with conflict resolution
|
|
35
|
-
│ │ ├── get-explicit-role.ts # Explicit role from role attribute with author error handling
|
|
36
|
-
│ │ ├── get-implicit-role.ts # Implicit (native) role from HTML-AAM
|
|
37
|
-
│ │ ├── get-implicit-role-spec.ts # Low-level implicit role name lookup
|
|
38
|
-
│ │ ├── get-non-presentational-ancestor.ts # Ancestor traversal skipping presentational roles
|
|
39
|
-
│ │ ├── get-permitted-roles.ts # Permitted roles for a DOM element
|
|
40
|
-
│ │ ├── get-permitted-roles-spec.ts # Permitted roles from tag name/namespace (low-level)
|
|
41
|
-
│ │ ├── get-role-spec.ts # Full role spec with super-class chain
|
|
42
|
-
│ │ ├── has-required-owned-elements.ts # Required owned elements validation
|
|
43
|
-
│ │ ├── is-exposed.ts # Accessibility tree inclusion/exclusion
|
|
44
|
-
│ │ ├── is-presentational.ts # Presentational role check (presentation/none)
|
|
45
|
-
│ │ └── matches-context-role.ts # Required context role validation
|
|
46
|
-
│ └── html/
|
|
47
|
-
│ ├── content-model-category-to-tag-names.ts # Category → tag name array (cached)
|
|
48
|
-
│ ├── get-content-model.ts # Content model with conditional evaluation
|
|
49
|
-
│ ├── get-selectors-by-content-model-category.ts # Category → CSS selector array
|
|
50
|
-
│ ├── is-nothing-content-model.ts # "Nothing" content model check
|
|
51
|
-
│ ├── is-palpable-elements.ts # Palpable content detection
|
|
52
|
-
│ ├── is-void-element.ts # Void element check (13 elements)
|
|
53
|
-
│ └── may-be-focusable.ts # Focusability heuristic
|
|
54
|
-
├── const/
|
|
55
|
-
│ ├── index.ts # Re-exports all constants
|
|
56
|
-
│ ├── dom.ts # DOM constants (ELEMENT_NODE, TEXT_NODE, namespace URIs)
|
|
57
|
-
│ └── accname.ts # AccName constants (embedded control roles, input types, defaults)
|
|
58
|
-
└── utils/
|
|
59
|
-
├── aria-version.ts # ARIA version constants ('1.1', '1.2', '1.3')
|
|
60
|
-
├── get-attr-specs.ts # Attribute specs for a DOM element (wrapper)
|
|
61
|
-
├── get-attr-specs-spec.ts # Attribute specs by tag name/namespace (core)
|
|
62
|
-
├── get-ns.ts # Namespace URI → shorthand mapping
|
|
63
|
-
├── get-spec.ts # Element spec for a DOM element (wrapper)
|
|
64
|
-
├── get-spec-by-tag-name.ts # Element spec by tag name/namespace (cached)
|
|
65
|
-
├── merge-array.ts # Name-based array merge utility
|
|
66
|
-
├── resolve-namespace.ts # Namespace resolution and prefix normalization
|
|
67
|
-
├── resolve-version.ts # ARIA version-specific property resolution
|
|
68
|
-
├── schema-to-spec.ts # Schema merge pipeline (base + extensions)
|
|
69
|
-
└── validate-aria-version.ts # ARIA version string type guard
|
|
70
|
-
|
|
71
|
-
schemas/
|
|
72
|
-
├── element.schema.json # Top-level element spec schema (11 lines)
|
|
73
|
-
├── aria.schema.json # ARIA role/property schema (291 lines)
|
|
74
|
-
├── attributes.schema.json # Attribute type schema (190 lines)
|
|
75
|
-
├── content-models.schema.json # Content model pattern schema (215 lines)
|
|
76
|
-
└── global-attributes.schema.json # Global attribute categories schema (787 lines)
|
|
77
|
-
|
|
78
|
-
gen/
|
|
79
|
-
├── gen.ts # Schema generator for global-attributes.schema.json
|
|
80
|
-
└── global-attribute.data.ts # Global attribute category definitions
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Architecture Diagram
|
|
84
|
-
|
|
85
|
-
```mermaid
|
|
86
|
-
flowchart TD
|
|
87
|
-
subgraph input ["Input Layer"]
|
|
88
|
-
htmlSpec["@markuplint/html-spec\n(MLMLSpec JSON)"]
|
|
89
|
-
fwSpec["Framework specs\n(ExtendedSpec)"]
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
subgraph merge ["Spec Resolution"]
|
|
93
|
-
schemaToSpec["schemaToSpec()"]
|
|
94
|
-
getSpec["getSpec() / getSpecByTagName()"]
|
|
95
|
-
getAttrSpecs["getAttrSpecs()"]
|
|
96
|
-
resolveNS["resolveNamespace()"]
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
subgraph aria ["ARIA Algorithms"]
|
|
100
|
-
getComputedRole["getComputedRole()"]
|
|
101
|
-
getExplicitRole["getExplicitRole()"]
|
|
102
|
-
getImplicitRole["getImplicitRole()"]
|
|
103
|
-
getPermittedRoles["getPermittedRoles()"]
|
|
104
|
-
getRoleSpec["getRoleSpec()"]
|
|
105
|
-
getARIA["getARIA()"]
|
|
106
|
-
getComputedAriaProps["getComputedAriaProps()"]
|
|
107
|
-
isExposed["isExposed()"]
|
|
108
|
-
getAccname["getAccname()"]
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
subgraph html ["HTML Algorithms"]
|
|
112
|
-
getContentModel["getContentModel()"]
|
|
113
|
-
isPalpable["isPalpableElement()"]
|
|
114
|
-
isVoid["isVoidElement()"]
|
|
115
|
-
mayBeFocusable["mayBeFocusable()"]
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
subgraph types ["Type Definitions"]
|
|
119
|
-
handWritten["MLMLSpec, ElementSpec\nARIARole, ComputedRole"]
|
|
120
|
-
generated["ARIA, PermittedRoles\nContentModel, Category"]
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
htmlSpec --> schemaToSpec
|
|
124
|
-
fwSpec --> schemaToSpec
|
|
125
|
-
schemaToSpec --> getSpec
|
|
126
|
-
getSpec --> getAttrSpecs
|
|
127
|
-
getSpec --> getARIA
|
|
128
|
-
resolveNS --> getSpec
|
|
129
|
-
|
|
130
|
-
getARIA --> getComputedRole
|
|
131
|
-
getExplicitRole --> getComputedRole
|
|
132
|
-
getImplicitRole --> getComputedRole
|
|
133
|
-
getPermittedRoles --> getExplicitRole
|
|
134
|
-
getRoleSpec --> getImplicitRole
|
|
135
|
-
getRoleSpec --> getExplicitRole
|
|
136
|
-
getComputedRole --> getComputedAriaProps
|
|
137
|
-
getComputedRole --> isExposed
|
|
138
|
-
|
|
139
|
-
getSpec --> getContentModel
|
|
140
|
-
getSpec --> isPalpable
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Core Components
|
|
144
|
-
|
|
145
|
-
### 1. Type Definitions
|
|
146
|
-
|
|
147
|
-
The type system defines the structure of markup language specifications, element specs, ARIA roles, and attributes.
|
|
148
|
-
|
|
149
|
-
| File | Purpose |
|
|
150
|
-
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
151
|
-
| `types/index.ts` | Hand-written types: `MLMLSpec`, `ElementSpec`, `ExtendedSpec`, `ARIARole`, `ComputedRole`, etc. |
|
|
152
|
-
| `types/aria.ts` | Generated: `ARIA`, `PermittedRoles`, `ImplicitRole`, `PermittedARIAProperties`, `ImplicitProperties` |
|
|
153
|
-
| `types/attributes.ts` | Generated: `AttributeType`, `ConditionalAttributeType`, `GlobalAttributes`, `AttributeJSON`, `List`, `Enum`, `Number`, `Directive` |
|
|
154
|
-
| `types/permitted-structures.ts` | Generated: `PermittedContentPattern`, `ContentModel`, `Category` (HTML 13 + SVG 19 + MathML 3 categories) |
|
|
155
|
-
|
|
156
|
-
### 2. ARIA Algorithms
|
|
157
|
-
|
|
158
|
-
ARIA algorithms implement WAI-ARIA, HTML-AAM, SVG-AAM, MathML-AAM, and AccName 1.2 specifications for role computation and accessibility tree management.
|
|
159
|
-
|
|
160
|
-
| File | Purpose |
|
|
161
|
-
| -------------------------------- | --------------------------------------------------------------------------------- |
|
|
162
|
-
| `get-computed-role.ts` | Core algorithm: computes final role with Presentational Roles Conflict Resolution |
|
|
163
|
-
| `get-explicit-role.ts` | Resolves explicit roles from `role` attribute with author error handling |
|
|
164
|
-
| `get-implicit-role.ts` | Determines implicit (native) ARIA role from HTML-AAM |
|
|
165
|
-
| `get-computed-aria-props.ts` | Resolves ARIA properties: explicit `aria-*` → HTML equivalent → spec defaults |
|
|
166
|
-
| `is-exposed.ts` | Determines accessibility tree inclusion/exclusion per WAI-ARIA rules |
|
|
167
|
-
| `get-permitted-roles.ts` | Lists permitted roles for an element (Any/No/specific list) |
|
|
168
|
-
| `get-role-spec.ts` | Retrieves full role spec with super-class role chain |
|
|
169
|
-
| `has-required-owned-elements.ts` | Validates required owned element constraints |
|
|
170
|
-
| `matches-context-role.ts` | Validates required context role conditions in ancestor chain |
|
|
171
|
-
| `accname-computation.ts` | Accessible name computation facade (DOM resolver + reentrant guard) |
|
|
172
|
-
| `accname/compute.ts` | Pure AccName algorithm: Steps 2A-2I per HTML-AAM §4.1 |
|
|
173
|
-
| `accname/element-names.ts` | Step 2E: Element-specific name computation (HTML-AAM §4.1) |
|
|
174
|
-
| `get-aria.ts` | Element-level ARIA spec with version and condition resolution |
|
|
175
|
-
| `is-presentational.ts` | Checks if a role is `presentation` or `none` |
|
|
176
|
-
|
|
177
|
-
### 3. HTML Algorithms
|
|
178
|
-
|
|
179
|
-
HTML algorithms implement content model evaluation and element classification from the HTML Living Standard.
|
|
180
|
-
|
|
181
|
-
| File | Purpose |
|
|
182
|
-
| -------------------------------------------- | ----------------------------------------------------------------- |
|
|
183
|
-
| `get-content-model.ts` | Retrieves content model with conditional pattern evaluation |
|
|
184
|
-
| `content-model-category-to-tag-names.ts` | Converts content model category to sorted tag name array |
|
|
185
|
-
| `get-selectors-by-content-model-category.ts` | Maps content model category to CSS selectors |
|
|
186
|
-
| `is-palpable-elements.ts` | Palpable content detection with SVG/MathML/exposable extensions |
|
|
187
|
-
| `is-void-element.ts` | Void element check (13 HTML void elements) |
|
|
188
|
-
| `is-nothing-content-model.ts` | "Nothing" content model check (void + iframe + template) |
|
|
189
|
-
| `may-be-focusable.ts` | Focusability heuristic (interactive + tabindex + contenteditable) |
|
|
190
|
-
|
|
191
|
-
### 4. Spec Resolution Utilities
|
|
192
|
-
|
|
193
|
-
Utilities for merging, resolving, and caching specifications.
|
|
194
|
-
|
|
195
|
-
| File | Purpose |
|
|
196
|
-
| -------------------------- | --------------------------------------------------------------------------- |
|
|
197
|
-
| `schema-to-spec.ts` | Merges base `MLMLSpec` with `ExtendedSpec[]` (global attrs, ARIA, elements) |
|
|
198
|
-
| `get-spec-by-tag-name.ts` | Looks up element spec by tag name + namespace (cached) |
|
|
199
|
-
| `get-attr-specs-spec.ts` | Retrieves merged attribute specs (global + element-specific) |
|
|
200
|
-
| `resolve-namespace.ts` | Normalizes element names with namespace prefixes |
|
|
201
|
-
| `resolve-version.ts` | Resolves ARIA version-specific overrides with fallback |
|
|
202
|
-
| `merge-array.ts` | Name-based array merging (add/override by `name` property) |
|
|
203
|
-
| `validate-aria-version.ts` | Type guard for valid ARIA version strings |
|
|
204
|
-
|
|
205
|
-
## External Dependencies
|
|
206
|
-
|
|
207
|
-
| Dependency | Purpose | Where Used |
|
|
208
|
-
| -------------------- | ------------------------------------------------- | ----------------------------- |
|
|
209
|
-
| `@markuplint/ml-ast` | `NamespaceURI` type for XML namespace handling | `types/index.ts`, utils |
|
|
210
|
-
| `@markuplint/types` | `Type` union for attribute value type definitions | via `types/attributes.ts` |
|
|
211
|
-
| `is-plain-object` | Plain object detection for AAM info | `get-permitted-roles-spec.ts` |
|
|
212
|
-
| `type-fest` | `ReadonlyDeep` utility type for deep immutability | Multiple files |
|
|
213
|
-
|
|
214
|
-
## Integration Points
|
|
215
|
-
|
|
216
|
-
```mermaid
|
|
217
|
-
flowchart LR
|
|
218
|
-
subgraph upstream ["Upstream"]
|
|
219
|
-
htmlSpec["@markuplint/html-spec"]
|
|
220
|
-
vueSpec["@markuplint/vue-spec"]
|
|
221
|
-
reactSpec["@markuplint/react-spec"]
|
|
222
|
-
otherSpec["Other framework specs"]
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
subgraph pkg ["@markuplint/ml-spec"]
|
|
226
|
-
types["Type definitions"]
|
|
227
|
-
ariaAlgo["ARIA algorithms"]
|
|
228
|
-
htmlAlgo["HTML algorithms"]
|
|
229
|
-
specRes["Spec resolution"]
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
subgraph downstream ["Downstream"]
|
|
233
|
-
mlCore["@markuplint/ml-core"]
|
|
234
|
-
rules["@markuplint/rules"]
|
|
235
|
-
selector["@markuplint/selector"]
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
htmlSpec -->|"MLMLSpec JSON"| specRes
|
|
239
|
-
vueSpec -->|"ExtendedSpec"| specRes
|
|
240
|
-
reactSpec -->|"ExtendedSpec"| specRes
|
|
241
|
-
otherSpec -->|"ExtendedSpec"| specRes
|
|
242
|
-
|
|
243
|
-
specRes --> ariaAlgo
|
|
244
|
-
specRes --> htmlAlgo
|
|
245
|
-
types --> mlCore
|
|
246
|
-
ariaAlgo -->|"role computation\naccessibility tree"| rules
|
|
247
|
-
htmlAlgo -->|"content model\nelement classification"| rules
|
|
248
|
-
types --> selector
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Upstream
|
|
252
|
-
|
|
253
|
-
`@markuplint/html-spec` provides the base `MLMLSpec` JSON containing all HTML element specifications, ARIA definitions, and content model data. Framework-specific packages (`@markuplint/vue-spec`, `@markuplint/react-spec`, etc.) provide `ExtendedSpec` objects that add or override elements, attributes, and ARIA mappings.
|
|
254
|
-
|
|
255
|
-
### Downstream
|
|
256
|
-
|
|
257
|
-
- **`@markuplint/ml-core`** uses the type definitions to represent parsed document elements with spec awareness.
|
|
258
|
-
- **`@markuplint/rules`** calls ARIA and HTML algorithms to implement lint rules (role validation, content model checking, accessibility checks).
|
|
259
|
-
- **`@markuplint/selector`** uses type definitions for element matching.
|
|
260
|
-
|
|
261
|
-
## Documentation Map
|
|
262
|
-
|
|
263
|
-
- [ARIA Algorithms](docs/aria-algorithms.md) -- Role computation, accessibility tree, ARIA property resolution
|
|
264
|
-
- [HTML Algorithms](docs/html-algorithms.md) -- Content models, element classification, void elements
|
|
265
|
-
- [Type Definitions](docs/type-definitions.md) -- Core types, generated types, JSON schemas
|
|
266
|
-
- [Spec Resolution](docs/spec-resolution.md) -- Schema merging, namespace resolution, caching
|
|
267
|
-
- [Maintenance Guide](docs/maintenance.md) -- Schema generation, dependency management, recipes, troubleshooting
|
package/SKILL.md
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Verify documentation claims against web standards and source code
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# verify-docs
|
|
6
|
-
|
|
7
|
-
Verify that documentation claims in `@markuplint/ml-spec` are accurate by cross-referencing them against official web standards (WAI-ARIA, HTML-AAM, SVG-AAM, AccName, HTML Living Standard) and the actual source code implementation.
|
|
8
|
-
|
|
9
|
-
## Input
|
|
10
|
-
|
|
11
|
-
`$ARGUMENTS` specifies the target: a package name (e.g., `@markuplint/ml-spec`) or a specific documentation file path. If omitted, defaults to all `docs/*.md` files in `packages/@markuplint/ml-spec/`.
|
|
12
|
-
|
|
13
|
-
## Phase 1: Discovery
|
|
14
|
-
|
|
15
|
-
Read all target documentation files and extract every claim that references an external specification. Look for:
|
|
16
|
-
|
|
17
|
-
- Specification URLs (e.g., `https://www.w3.org/TR/wai-aria-1.2/...`, `https://html.spec.whatwg.org/...`)
|
|
18
|
-
- WAI-ARIA algorithm descriptions (role computation, presentational conflict resolution)
|
|
19
|
-
- HTML-AAM implicit role mappings
|
|
20
|
-
- SVG-AAM accessibility tree inclusion rules
|
|
21
|
-
- AccName computation references
|
|
22
|
-
- Content model category claims (element counts, category membership)
|
|
23
|
-
- Specific numeric claims (e.g., "13 void elements", "11 error codes")
|
|
24
|
-
- Function behavior claims ("returns X when Y")
|
|
25
|
-
- Statements like "Implements the X spec" or "according to Y specification"
|
|
26
|
-
|
|
27
|
-
Collect each claim as a structured item:
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
{ file, line, claim, specDomain, specURL }
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Phase 2: Categorize
|
|
34
|
-
|
|
35
|
-
Group extracted claims by specification domain:
|
|
36
|
-
|
|
37
|
-
| Domain | Examples |
|
|
38
|
-
| ------------- | ------------------------------------------------------------------------------ |
|
|
39
|
-
| WAI-ARIA | Role computation, presentational roles conflict resolution, accessibility tree |
|
|
40
|
-
| HTML-AAM | Implicit role mappings, permitted roles, ARIA property defaults |
|
|
41
|
-
| AccName | Accessible name computation algorithm, placeholder fallback |
|
|
42
|
-
| SVG-AAM | SVG element inclusion rules, graphics ARIA roles |
|
|
43
|
-
| HTML Standard | Content models, void elements, interactive content, palpable content |
|
|
44
|
-
|
|
45
|
-
## Phase 3: Parallel Verification
|
|
46
|
-
|
|
47
|
-
For each domain group, launch a parallel agent using the **Task tool** with `subagent_type: "general-purpose"`. Each agent:
|
|
48
|
-
|
|
49
|
-
1. **Searches the official specification** using WebSearch to find the authoritative definition
|
|
50
|
-
2. **Compares the documentation claim** against the spec definition
|
|
51
|
-
3. **Reads the corresponding source code** to confirm the implementation matches
|
|
52
|
-
4. **Assigns a verdict** to each claim:
|
|
53
|
-
- **PASS** — Documentation accurately describes the spec and matches the implementation
|
|
54
|
-
- **FAIL** — Documentation is inaccurate (wrong number, incorrect algorithm, misleading description)
|
|
55
|
-
- **WARN** — Documentation is technically correct but potentially misleading or incomplete
|
|
56
|
-
|
|
57
|
-
Each agent returns its results as a structured list:
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
| # | File:Line | Claim | Spec Source | Verdict | Notes |
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Phase 4: Report
|
|
64
|
-
|
|
65
|
-
Collect results from all parallel agents and produce a consolidated PASS/FAIL table:
|
|
66
|
-
|
|
67
|
-
```markdown
|
|
68
|
-
## Verification Report
|
|
69
|
-
|
|
70
|
-
| # | Domain | File:Line | Claim Summary | Verdict | Notes |
|
|
71
|
-
| --- | ------------- | ---------------------- | ----------------------------- | ------- | -------------------------------------- |
|
|
72
|
-
| 1 | WAI-ARIA | aria-algorithms.md:125 | 11 RoleComputationError codes | PASS | Matches source types/index.ts |
|
|
73
|
-
| 2 | HTML Standard | html-algorithms.md:45 | 13 void elements | PASS | Matches is-void-element.ts Set |
|
|
74
|
-
| 3 | HTML-AAM | aria-algorithms.md:200 | getImplicitRole returns false | WARN | Returns ImplicitRole (false or string) |
|
|
75
|
-
| ... | ... | ... | ... | ... | ... |
|
|
76
|
-
|
|
77
|
-
**Summary:** X PASS / Y FAIL / Z WARN out of N total claims
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Phase 5: Correction Plan
|
|
81
|
-
|
|
82
|
-
For every FAIL item, produce a concrete correction instruction:
|
|
83
|
-
|
|
84
|
-
```markdown
|
|
85
|
-
### Correction 1: [Brief description]
|
|
86
|
-
|
|
87
|
-
- **File:** `path/to/file.md`
|
|
88
|
-
- **Line:** 125
|
|
89
|
-
- **Current:** `(11 error codes)`
|
|
90
|
-
- **Corrected:** `(12 error codes)`
|
|
91
|
-
- **Reason:** Source code `types/index.ts` contains 12 entries in `RoleComputationError` union
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
For WARN items, produce an advisory note with a suggested improvement (not mandatory).
|
|
95
|
-
|
|
96
|
-
## Rules
|
|
97
|
-
|
|
98
|
-
1. **Source code is the source of truth for implementation behavior.** If the docs say "implements X" but the code does something slightly different, the docs should be corrected to accurately describe what the code does.
|
|
99
|
-
2. **Specification is the source of truth for what the standard defines.** If the code intentionally deviates from the spec, the docs should note the deviation explicitly.
|
|
100
|
-
3. **Code bugs are a separate category.** If the code itself doesn't match the spec, flag it as a code issue (not a documentation issue) and note it separately.
|
|
101
|
-
4. **Numeric claims must be exact.** Count arrays, enum values, union members, and Set entries in the source code to verify numbers stated in documentation.
|
|
102
|
-
5. **Algorithm descriptions must match the actual code flow.** Verify that documented step orders, condition checks, and branching logic correspond to the implementation.
|
|
103
|
-
6. **Use WebSearch for spec verification.** Always fetch the latest version of the referenced specification — do not rely on cached knowledge.
|
|
104
|
-
|
|
105
|
-
## Hardcoded Test Data
|
|
106
|
-
|
|
107
|
-
The following test files contain hardcoded spec data that must stay in sync
|
|
108
|
-
with `@markuplint/html-spec`:
|
|
109
|
-
|
|
110
|
-
| Test file | Data | Trigger |
|
|
111
|
-
| ----------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------- |
|
|
112
|
-
| `src/algorithm/aria/get-permitted-roles-spec.spec.ts` | `permittedRoles` arrays for img, button, input, form, etc. | `permittedRoles` changes in `html-spec/src/spec.*.json` |
|
|
113
|
-
|
|
114
|
-
When `@markuplint/html-spec` ARIA mappings change, update these arrays.
|
|
115
|
-
The arrays are version-specific — update only the correct version's expectations
|
|
116
|
-
(e.g., `'1.2'` tests but not `'1.1'` tests for newly added roles).
|