I’ve iterated on @briankardell’s initial code and published tokenlist. This was done to fully implement the specified interface, provide tests and expose a simple constructor.
The implementation sports callbacks to encode and decode tokens, thereby allowing us to provide an interface that accepts and resolves
Elements for simpler interactions with ID Reference Lists such as
aria-describedby. This idea is exposed as
Element.prototype._referenceListFor(attributeName). That said, I’m not sure additional operations such as
.prepend() are required in this domain.
I’m unclear on what
DOMTokenList.from() should really do, but tinkering around should be easy enough.