Stimulus currently provides an Array-type for values. However it is encoded as JSON, which while necessary for complex objects, feels un-HTML-like for simple arrays of strings. At a practical level, it means extra care has to be made to escape values.
DOMTokenList is used in many places in Web APIs, such as classList and aria-described-by attributes. Ideally we would mimic that.
static values = {
permittedTypes: 'List' // or possibly DOMTokenList
}
connect() {
this.permittedTypesValue.forEach((permittedType) => {
console.log(permiitedType);
});
}
Stimulus currently provides an Array-type for values. However it is encoded as JSON, which while necessary for complex objects, feels un-HTML-like for simple arrays of strings. At a practical level, it means extra care has to be made to escape values.
DOMTokenListis used in many places in Web APIs, such asclassListandaria-described-byattributes. Ideally we would mimic that.