Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON for implementors #527

Open
giacomo-petri opened this issue Sep 3, 2024 · 1 comment
Open

JSON for implementors #527

giacomo-petri opened this issue Sep 3, 2024 · 1 comment

Comments

@giacomo-petri
Copy link
Contributor

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.

@giacomo-petri
Copy link
Contributor Author

(Oh, this script is just for the first table titled "Rules of ARIA attribute usage by HTML element.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant