Re: [w3c/webcomponents] [idea] Allow HTML Element attributes to accept any type of value, not just strings. (#519)

> Changing that would break content all over.

Not necessarily. getAttribute can turn any value, and the engine can use ToString on it for use with selecting.

> How would this change affect mutation observers?

It doesn't: a record is queued when setAttribute is called. The new value (string or not) is stored in the record.

> How would it affect HTML element definitions that assume attribute values are always strings? 

Which element definition for example?

> How would it affect selectors?

String attributes would be useful here still. Selection doesn't have to work on everything. Also if an attribute isn't a string, it didn't mean the steering result is not predictable. An attribute with a numerical array value is still easy to select for example. `[position="1,2,3"]` if the actual value of the array is `[1, 2, 3]`. Not everything would be easily selectable, but so? How does this break anything?

---

What I realized though, is that in my use cases so far, I want this feature in custom elements. I can easily override setAttribute to do this. And per web manifesto, I should be able to. It seems difficult to disagree with the ideal of web manifesto, and as love of the web, I would hope we fight for it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/519#issuecomment-322713028

Received on Wednesday, 16 August 2017 09:14:39 UTC