Open cramertj opened 7 years ago
After some thought, I'm probably just going to special-case certain strings, ala Elm. It's the easiest on users of the library, and it only imposes a tiny runtime cost (a single match statement).
an enum seems to be the way to go design-wise. it would not restrict to a predefined set, if you add one variant to the enum typed Other(String).
Currently, there's no distinction between attributes and properties-- attributes are used as attributes in HTML and as properties in the browser. This is necessary for things like "value" to work-- setting the "value" attribute in the browser doesn't change the content, and it's not possible to set properties in HTML AFAIK. However, this causes weirdness for things that have both an attribute and property with different names, such as "class" and "className". Elm special-cases a bunch of these names in order to apply them differently, but that's really messy. Attribute/property keys could be changed to an enum and matched on, but this has the unfortunate side effect of restricting keys to a predefined set, as well as requiring an import for each attribute used.