Tyxml should not accept a form as an indirect descendant of another form
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 179
- Forks
- 63
- Avg merge
- 5h
- Merged PRs (30d)
- 22
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two Html5.M examples from the issue and compare the accepted grandchild case with the rejected direct child case. Trace Tyxml's phantom-type definitions to determine whether indirect nesting can be prevented without the major changes mentioned; otherwise, document the limitation and its browser consequences clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100