Complete HTML elements and attributes coverage (WHATWG living standard)#366
Open
balat wants to merge 24 commits into
Open
Complete HTML elements and attributes coverage (WHATWG living standard)#366balat wants to merge 24 commits into
balat wants to merge 24 commits into
Conversation
Recent compilers in the dune development profile treat warning 67 (unused functor parameter) as an error, which breaks make build and the CI on every platform. The parameters are only used for their side effects on behavior, not in the result signatures, so they can be anonymous.
The s element represents contents that are no longer accurate or relevant. It is flow and phrasing content, with phrasing content and common attributes. Spec: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-s-element
The bdi element represents a span of text isolated from its surroundings for the purposes of bidirectional text formatting. It is flow and phrasing content, with phrasing content and common attributes (the dir attribute is already available globally). Spec: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-bdi-element
The search element represents a part of a document whose contents relate to performing a search or filtering operation. It is flow content containing flow content, with common attributes. It is grouping content, not a sectioning element. Spec: https://html.spec.whatwg.org/multipage/grouping-content.html#the-search-element
The data element links a content with a machine-readable value. The value attribute is required by the specification, so it is exposed as a mandatory labeled argument, following the img and optgroup precedents. Spec: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-data-element
The track element specifies timed text tracks for audio and video elements. It is a void element with a required src attribute, exposed as a mandatory labeled argument. New attributes: a_kind, a_track_srclang and a_default. The existing a_srclang function stays untouched (it is deprecated and wrongly typed as XML_lang); a_track_srclang uses the reflect.attribute renaming so that <track srclang=...> maps to it in the PPX. audio and video accept a new optional ?tracks argument, mirroring ?srcs, so that track children do not leak into the transparent content type parameter. The PPX assembler for audio and video partitions track children into that argument. Spec: https://html.spec.whatwg.org/multipage/media.html#the-track-element
The slot element (Web Components) defines a placeholder inside a shadow tree. Its content model is transparent, so it uses the same phantom type encoding as canvas and map: the children type is carried in the type parameter and checked at the usage site. The name attribute is provided by the existing a_name function. Spec: https://html.spec.whatwg.org/multipage/scripting.html#the-slot-element
New global attributes, available on every element: - popover (a_popover, values auto, manual, hint; a bare popover attribute parses as auto in the PPX) - inert (a_inert) - enterkeyhint (a_enterkeyhint) - autocapitalize (a_autocapitalize) - autocorrect (a_autocorrect, on/off boolean) - writingsuggestions (a_writingsuggestions, true/false boolean) - nonce (a_nonce) - slot (a_slot) - is (a_is) Also allow the auto value for the dir attribute (a_dir and the required dir argument of bdo). Spec: https://html.spec.whatwg.org/multipage/interaction.html and https://html.spec.whatwg.org/multipage/popover.html
New global attributes: itemscope (a_itemscope), itemtype (a_itemtype), itemid (a_itemid), itemprop (a_itemprop) and itemref (a_itemref). Spec: https://html.spec.whatwg.org/multipage/microdata.html
These attributes expose shadow-tree parts to outside styling. They are defined by the W3C CSS Shadow Parts specification (not by the WHATWG HTML standard) but are global attributes implemented by all browsers. Spec: https://drafts.csswg.org/css-shadow-parts/
New attributes on button (and, for the popover ones, input): - popovertarget (a_popovertarget) and popovertargetaction (a_popovertargetaction) to control popovers from a button - command (a_command) and commandfor (a_commandfor), the Invoker Commands API; custom commands are expressed with the Other constructor of the new command_value type, following the linktype precedent Spec: https://html.spec.whatwg.org/multipage/popover.html and https://html.spec.whatwg.org/multipage/form-elements.html#attr-button-command
- loading (a_loading, lazy/eager) on img and iframe - decoding (a_decoding, sync/async/auto) on img - fetchpriority (a_fetchpriority, high/low/auto) on img (also used by link and script in a following commit) - srcdoc (a_srcdoc) and allow (a_allow) on iframe - also allow the existing crossorigin, usemap and referrerpolicy attributes on img, as specified Spec: https://html.spec.whatwg.org/multipage/embedded-content.html and https://html.spec.whatwg.org/multipage/urls-and-fetching.html
- as (a_as) on link, for preload destinations (the common subset documented by MDN; other destinations remain reachable with Unsafe.string_attrib) - imagesrcset (a_imagesrcset) and imagesizes (a_imagesizes) on link - blocking (a_blocking) on link, script and style, with a new blocking_token type and a new string_of_blocking function in the Wrapped_functions module type - nomodule (a_nomodule) on script - also allow disabled, referrerpolicy and fetchpriority on link and script where specified Spec: https://html.spec.whatwg.org/multipage/semantics.html and https://html.spec.whatwg.org/multipage/urls-and-fetching.html
Also allow the existing referrerpolicy attribute on a and area, as specified. Spec: https://html.spec.whatwg.org/multipage/links.html#ping
- dirname (a_dirname) on input and textarea - capture (a_capture, user/environment) on input; this attribute is defined by the W3C HTML Media Capture specification - also allow the existing autocomplete attribute on select and textarea, as specified Spec: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html and https://www.w3.org/TR/html-media-capture/
- type (a_ol_type) on ordered lists, with a new ol_type value type and a new string_of_ol_type function in the Wrapped_functions module type; the values are case-sensitive so the PPX uses a dedicated parser - abbr (a_abbr) on th cells - closedby (a_closedby) on dialogs - allow the existing media attribute on meta (theme-color) Spec: https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type
- playsinline (a_playsinline) on video (WHATWG) - disablepictureinpicture (a_disablepictureinpicture) on video (W3C Picture-in-Picture specification) - disableremoteplayback (a_disableremoteplayback) on audio and video (W3C Remote Playback specification) Spec: https://html.spec.whatwg.org/multipage/media.html
New attributes on template elements: shadowrootmode (a_shadowrootmode, open/closed), shadowrootdelegatesfocus, shadowrootclonable and shadowrootserializable. Spec: https://html.spec.whatwg.org/multipage/scripting.html#the-template-element
New global event handler attributes: onauxclick, onwheel, onpointercancel, onpointerdown, onpointerenter, onpointerleave, onpointermove, onpointerout, onpointerover, onpointerup, ongotpointercapture and onlostpointercapture. In the DOM, PointerEvent and WheelEvent inherit from MouseEvent, so these handlers use the existing Xml.mouse_event_handler type; adding dedicated handler types to Xml_sigs.T would break every Xml implementation and is left to a future breaking release. Spec: https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers and https://www.w3.org/TR/pointerevents/
New global event handler attributes: onbeforeinput, onbeforematch, onbeforetoggle, oncancel, oncontextlost, oncontextrestored, oncopy, oncut, onpaste, oncuechange, onscrollend, onsecuritypolicyviolation, onslotchange and ontoggle. They all use the generic Xml.event_handler type, following the existing oninput and onchange precedents. Spec: https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
New attributes on body, following the onstorage and onpopstate precedents: onlanguagechange, onrejectionhandled and onunhandledrejection. Spec: https://html.spec.whatwg.org/multipage/webappapis.html#windoweventhandlers
Exercise the popover, command, ol type and blocking parsers through the JSX front-end, following the autocomplete precedent.
The purpose of bdo is to force an explicit text direction, and the rendering of bdo is only defined for the ltr and rtl states, so keep the required dir argument restricted to those two values. The global a_dir function keeps accepting auto.
Member
Author
|
Note on CI: master's CI has been red for a while because recent compilers turn warning 67 (unused functor parameter) into an error in the dune development profile; the failures initially reported on this PR were exactly those pre-existing errors, not caused by these changes. The fix is in #366's sibling PR #367; this branch has been rebased on top of it so its CI can run green. Once #367 is merged, this branch can be rebased onto master and the extra commit will disappear from the diff. The remaining |
- method and formmethod accept the dialog value - the sandbox attribute gains the tokens added to the standard since the original set: allow-downloads, allow-modals, allow-orientation-lock, allow-popups-to-escape-sandbox, allow-presentation, allow-top-navigation-by-user-activation and allow-top-navigation-to-custom-protocols Spec: https://html.spec.whatwg.org/multipage/form-submission.html#attr-fs-method and https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-sandbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR brings TyXML up to date with the WHATWG HTML living standard. All changes are backward compatible, except two additions to the
Wrapped_functionsmodule type (noted below).New elements
s,bdi,search(flow grouping content),data(with a mandatory~valueargument, following theimgprecedent)track: void element with a mandatory~srcargument, plus its attributesa_kind,a_track_srclang(scoped rename ofsrclangfortrack) anda_default.audioandvideogain an optional?tracksargument mirroring?srcs, and the PPX assembler partitionstrackchildren accordingly.slot: transparent content model, encoded likecanvas/mapselectedcontentis deliberately left out: typing the customizableselectcontent model would weakenbuttontyping globally while the spec is still evolving; it remains reachable throughUnsafe.New attributes
popover(a barepopoverparses asautoin the PPX),inert,enterkeyhint,autocapitalize,autocorrect,writingsuggestions,nonce,slot,is, and`Autofora_diritemscope,itemtype,itemid,itemprop,itemrefpart,exportpartspopovertarget,popovertargetaction, and the Invoker Commandscommand/commandfor(custom--*commands via`Other, following thelinktypedesign)loading,decoding,fetchpriority(img; also link/script where specified),srcdocandallow(iframe),as,imagesrcset,imagesizes,blocking,nomodule(link/script/style),ping(a/area),dirnameandcapture(form controls),typeonol(a_ol_type, case-sensitive values with a dedicated PPX parser),abbronth,closedbyondialog,mediaonmeta,playsinline,disablepictureinpicture,disableremoteplayback, and the declarative shadow DOM attributes ontemplate(shadowrootmodeetc.)crossorigin/usemap/referrerpolicyon img,referrerpolicyon a/area,autocompleteon select/textarea,disabledon link)New event handler attributes
onwheelandonauxclick, typed with the existingXml.mouse_event_handler(PointerEvent and WheelEvent inherit from MouseEvent in the DOM; adding dedicated handler types toXml_sigs.Twould break every Xml implementation)onbeforeinput,onbeforematch,onbeforetoggle,oncancel,oncontextlost,oncontextrestored,oncopy,oncut,onpaste,oncuechange,onscrollend,onsecuritypolicyviolation,onslotchange,ontoggleonlanguagechange,onrejectionhandled,onunhandledrejectionCompatibility notes
Wrapped_functionsmodule type gainsstring_of_blockingandstring_of_ol_type. Implementations that delegate toHtml_f.Wrapped_functions(e.g. js_of_ocaml-tyxml) are unaffected; hand-written ones need two delegation lines. This is called out in CHANGES.md.popover,command,ol_type,blocking), each tested through both the[%html]and JSX front-ends.Each addition comes with rendering tests (
test_html.ml) and PPX round-trip tests (test_ppx.ml), a CHANGES.md entry, an MDN link in the documentation, and the spec link in its commit message.