element-behaviors
element-behaviors copied to clipboard
[question] has="" and storing data
I like the has="" attribute but I'm wondering if it doesn't make sense to go for "data-has". In the example with the player's position this makes even more sense to me. That way you can drop the dependency on custom attributes.
@drBenway Thanks for the ideas, and sorry for the late reply!
I'm not clear on how using data-has
would imply we can drop custom attributes. Either way, regardless of the chosen name, we'd need a way to know when to react to changes, and MutationObserver
(whether here manually, or indirectly via custom-attributes) is the mechanism that notifies us.
Do you have a question on storing data somewhere? If so, what did you want to store?