Skip to content

Type the itemtype and ping attributes as URI lists - #385

Merged
balat merged 1 commit into
masterfrom
html-uri-typing
Aug 28, 2026
Merged

Type the itemtype and ping attributes as URI lists#385
balat merged 1 commit into
masterfrom
html-uri-typing

Conversation

@balat

@balat balat commented Aug 28, 2026

Copy link
Copy Markdown
Member

The rule is that an attribute holding a URL takes Xml.uri, and string otherwise. Two attributes did not follow it.

a_itemtype and a_ping both took a string list and went through Xml.space_sep_attrib, although the specification says their values are URLs: a set of space-separated tokens, each of which must be a valid URL. They now take an Xml.uri list and go through Xml.uris_attrib.

Survey of the other URL-valued attributes, for the record: a_href, a_src, a_cite, a_action, a_formaction, a_manifest, a_poster, a_icon, a_data and a_itemid already take an Xml.uri, and a_srcset and a_imagesrcset go through image_candidate, which is built on uri. a_usemap is left alone: it is a valid hash-name reference (#name), not a URL.

Impact

Xml.uris_attrib is already part of Xml_sigs.T, so there is nothing new for the implementations to provide.

Breaking in theory only. In Tyxml.Html, Xml.uri is string, and tyxml_xml.ml builds AStrL (Space, …) for uris_attrib exactly as for space_sep_attrib, so neither the accepted values nor the output change. The gain is for implementations whose URI type is abstract, which now get the URI treatment on these two attributes.

The reflected parsers are unchanged (wrap (spaces string)), so the PPX and the JSX syntax behave exactly as before and the existing tests pass without modification.

The Xml.uri list case in reflect.ml comes from #343; toastal is credited as co-author on the commit.


Tests: 434 green (59 + 52 + 201 ppx + 122 jsx). dune build @check, dune build @doc, make build and make test all pass.

Both hold URLs, so they belong to Xml.uris_attrib like every other URL-valued
attribute, instead of being plain space-separated strings. The reflection case
for Xml.uri list comes from #343.

Co-authored-by: toastal <toastal@posteo.net>
@balat balat mentioned this pull request Aug 28, 2026
@balat
balat merged commit e07516c into master Aug 28, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant