On Tue, 27 Feb 2024 18:48:22 GMT, Jonathan Gibbons <j...@openjdk.org> wrote:
> We could set "standard" attributes in the `HtmlTree.INPUT` factory method, > optionally conditional on the input type. This would allow the code to set > `autocomplete` just once, in that method, instead of 3 places, as here. It > would also give a single place to explain why we do _not_ set > `autocapitalize` in the HTML tree. This sounds like a good idea, but there are a number of problems when trying to put it into practice. To start with, there are two `HtmlTree.INPUT` factory methods, both are used for text inputs as well as other kinds of controls such as checkboxes and reset buttons where the `autocomplete` attribute does not make sense. Both of these methods consist of a single `return` statement with multiple chained "fluent" setters, so setting an attribute depending on the kind of input would complicate the code quite a bit. With these issues considered, I would prefer to keep the code in its current form. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18029#issuecomment-1969543178