tyxml icon indicating copy to clipboard operation
tyxml copied to clipboard

input element allows name attribute values "isindex", ""

Open reynir opened this issue 3 months ago • 2 comments

Today I learned that you can't use the "isindex" value for the name attribute of e.g. : https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name

Neither is an empty name allowed, but tyxml accepts both:

let _ = Tyxml.Html.(input ~a:[a_name "isindex"]) ()
let _ = Tyxml.Html.(input ~a:[a_name ""]) ()

It is personally not a problem for me, but since you advertise in the README that "TyXML is a library for building statically correct HTML5 [...] documents" I thought I would let you know :D

reynir avatar Sep 05 '25 13:09 reynir

Thanks for the report !

These days, Tyxml's credo is to encode as many criterion it can into the type system, but without bothering programmers, and without ever raising dynamic validity failure!

That particular constraint is definitely not something we can catch statically in the typesystem. The best we could really do is to escape isindex (and avoiding emitting empty names). Personally, unless someone can present me a convenient solution that is well rendered by browsers, I'm inclined to let it pass.

Drup avatar Sep 10 '25 09:09 Drup

Thanks for the answer! I think that's a very reasonable approach and goal. So I guess "statically correct HTML5" could be interpreted as things we can statically verify. Do you think it would make sense to document the limitations in the README? I guess they are few.

Please feel free to close this issue either way.

reynir avatar Sep 19 '25 07:09 reynir