Open
Description
Tyxml's phantom-type trickery prevents a form from being the child of another form:
# Html5.M.(form [form []]);;
Error: This expression has type ([> Html5_types.form ] as 'a) Html5.M.elt
but an expression was expected of type
([< Html5_types.form_content_fun ] as 'b) Html5.M.elt
However, it does not prevent a form from being the grandchild of another form:
# Html5.M.(form [div [form []]]);;
- : [> Html5_types.form ] Html5.M.elt = <abstr>
There seems to be at least one example in the wild where this loophole caused problems: depending on the content-type, browsers will either reluctantly accept nested forms or reject them by messing with the parse tree.
This problem is probably difficult to fix without major changes to Tyxml's phantom-type trickery, but should perhaps be at least documented, as it's damn hard to diagnose when things go wrong.