Skip to content

JSON for implementors #527

@giacomo-petri

Description

@giacomo-petri

Hi @scottaohara,

while working on implementing the rules, I organized the test cases into a JSON format for easier validation.

I'm not sure if this would be of interest to you, but based on the current structure of the "Implementation Report" page (https://w3c.github.io/html-aria/results/implementation-results.html), here's a vanilla JavaScript snippet that generates the JSON:

var result = {};
var rows = document.querySelectorAll('table:nth-of-type(1) tbody tr');

rows.forEach(function(row) {
    var th = row.querySelector('th');
    if (th) {
        var hrefs = [];
        var td = row.querySelectorAll('td')[2];

        if (td) {
            var links = td.querySelectorAll('a');
            links.forEach(function(link) {
                hrefs.push(link.getAttribute('href'));
            });
        }

        result[th.textContent.trim()] = hrefs;
    }
});

//console.log(result);

I've attached the generated output for your reference.
ARIA-in-HTML-json.js.zip

This approach might be similar to the ARIA JSON that implementors use to build the rules (https://github.com/w3c/aria/blob/main/common/script/roleInfo.js).

Let me know if this is useful or if you need something else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions