I agree, except with the “simply” part. This is not simple at all, unless you also demand that every property can only ever be a string. Otherwise, you need to think of conversions (eg from and to numbers), and what about properties that can be set to objects? Or properies that don’t correspond to attributes at all?
I agree that any sort of convention/rule here that’d be 100% fixed would’ve been better, but it wouldn’t be simple.
In what way is that not an issue? What happens when you use .outerHTML to get a string representation of the element? Not to mention that, unavoidably, the entire page HTML arrives to the browser as a string.
I do want to point out for those who don't know, on objects with a prototype (such as a class) you can control how JSON.stringify works by adding a special method `toJSON`[0] which will control how that object is serialized.
Right… and that’s an issue people have to work around every day. Non string values in HTML world similarly be an issue everyone would have to work around.
I agree that any sort of convention/rule here that’d be 100% fixed would’ve been better, but it wouldn’t be simple.