element-behaviors icon indicating copy to clipboard operation
element-behaviors copied to clipboard

[question] has="" and storing data

Open drBenway opened this issue 2 years ago • 1 comments

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 avatar Mar 25 '22 07:03 drBenway

@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?

trusktr avatar Jul 25 '22 22:07 trusktr