class MyComponent extends HTMLElement {
static get observedAttributes () {
return ["data-one","data-two","data-three",so forth...]
}
}
This component could in theory be assigned an arbitrary number of data attributes, so there's no way to predict exactly how many there would be, yet I need the component to do stuff every time a new data attribute is assigned to it, is there any way to do it? having to put into the array returned by "observedAttributes" the specific name of every attribute seems really restrictive
As a bonus, is there any way to observe attributes that don't have a specific name but follow a certain pattern? (e.g. they match against a regex string or something like that)
And as an extra bonus, is there any way to observe all attributes? (I know they made this not be the default behavior due to performance factors, but still it would be good to be able to enable it if needed)
0 comments:
Post a Comment
Thanks