While the guys produce the test results let me follow up on the more theoretical aspect of this discussion.
Other than it being a rainy day in LA anyway, I hope that this discussion can benefit the community in the longer term and can lead to getting this fundamental part of the framework right.
"The root thing is that Properties and Attributes do not overlap 100% in JavaScript." -- I aggree.
But what are these "Properties" exactly and how are they supposed to work? My understanding is that they are vendor specific implementation of what Mozilla calls "IDL attributes".
Generally my impression is that these "IDL attributes" are only there for convenience reasons, so it is easier to manipulate DOM attributes directly in JavaScript. Their behavior is not clearly specified and consequently the implementations are also rather unpredictable.
The main differences in my understanding are the followings:
- The value of a DOM attribute is always of type string -- vs -- the "JavaScript Properties" / "IDL attributes" on the other hand can have several types including boolean, long, non/negative integer etc.
- You can set a the value of a DOM attribute using any arbitrary string, without getting a JS exception, it will default to something defined by the HTML standard for invalid values -- vs -- setting the "JavaScript Properties" / "IDL attributes" can, by definition, result in JavaScript exceptions.
- You can explicitly remove a DOM attribute -- vs -- depending on the type of the particular "JavaScript Property" / "IDL attribute", setting them to particular values should result in the removal of the attribute.
But it can be very unpredictable: for instance setting maxLength on an input to "" or null will set it to 0 instead of removing it -- on all browsers (Edge/Firefox/Chrome).
Here is a sample Elm app that exposes this problem: https://github.com/gaborv/VirtualDomBug
In summary setting DOM attributes directly seems (to me) to work the same way as setting them in plain HTML whereas using JavaScript Properties is typical JavaScript behavior: it is going to work in 90% of the time.
With that in my mind, would you consider using DOM Attributes everywhere instead of JavaScript properties in the next version of elm-html -- like in the code sample you posted?