Re: [a11yapi] Patterns (#28)

> +        <h3>
> +          <code>taxonOf</code> method
> +        </h3>
> +        <p>
> +          Returns a taxon object of <code>Taxon</code> interface for the given
> +          taxonomy and taxon name. Depending on the taxonomy the object may
> +          implement other interfaces derived from <code>Taxon</code> interface.
> +          For example, the returned object for the <code>role</code> taxonomy
> +          implements <code>RoleTaxon</code> interface.
> +        </p>
> +        <p>
> +          The example logs out all parents of the <code>bibliography</code>
> +          role.
> +        </p>
> +        <pre class="example highlight">
> +function logParents(taxon) {

like this?
function logRoleTree(taxon, level) {
  for (let i = 0; i < taxon.children.length; i++) {
    var child = taxon.children[i];
    console.log(`{$level} ${child.name}`);
    logRoleTree(child, `${level}.${i}`);
  }
}
let taxon = document.a11ement.taxonOf('role', 'base');
logRoleTree(taxon);

---
Reply to this email directly or view it on GitHub:
https://github.com/WICG/a11yapi/pull/28/files#r45501085

Received on Friday, 20 November 2015 18:31:29 UTC