From 3d453a1ef5dcce4abeb6b46b9e1877b611e28698 Mon Sep 17 00:00:00 2001 From: Leon Vack Date: Sun, 25 Jun 2023 09:57:23 +0200 Subject: [PATCH] Add additional variants to linktype for the rel attribute Implements the missing variants from the spec: https://html.spec.whatwg.org/multipage/links.html#linkTypes Additionally, includes Me and Prerender variants, which are not listed in the standard but listed in the MDN as important keywords: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel --- CHANGES.md | 3 +++ lib/html_f.ml | 10 +++++++++- lib/html_types.mli | 30 +++++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3eaa0ddfc..493aa176c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,7 @@ # NEXT +* Add additional variants to `linktype` for the `rel` attribute (Leon + @LogicalOverflow Vack) + * Expand options for `autocomplete` attribute on `` elements (#302 by Aron @aronerben Erben) diff --git a/lib/html_f.ml b/lib/html_f.ml index 90bb1d3be..7c90f1eed 100644 --- a/lib/html_f.ml +++ b/lib/html_f.ml @@ -886,6 +886,7 @@ struct | `Author -> "author" | `Bookmark -> "bookmark" | `Canonical -> "canonical" + | `Dns_prefetch -> "dns-prefetch" | `External -> "external" | `First -> "first" | `Help -> "help" @@ -893,12 +894,19 @@ struct | `Index -> "index" | `Last -> "last" | `License -> "license" + | `Manifest -> "manifest" + | `Me -> "me" + | `Modulepreload -> "modulepreload" | `Next -> "next" | `Nofollow -> "nofollow" - | `Noreferrer -> "noreferrer" | `Noopener -> "noopener" + | `Noreferrer -> "noreferrer" + | `Opener -> "opener" | `Pingback -> "pingback" + | `Preconnect -> "preconnect" | `Prefetch -> "prefetch" + | `Preload -> "preload" + | `Prerender -> "prerender" | `Prev -> "prev" | `Search -> "search" | `Stylesheet -> "stylesheet" diff --git a/lib/html_types.mli b/lib/html_types.mli index 858f92776..8e626488b 100644 --- a/lib/html_types.mli +++ b/lib/html_types.mli @@ -108,6 +108,7 @@ type linktype = | `Author | `Bookmark | `Canonical + | `Dns_prefetch | `External | `First | `Help @@ -115,13 +116,20 @@ type linktype = | `Index | `Last | `License + | `Manifest + | `Me + | `Modulepreload | `Next | `Nofollow - | `Noreferrer | `Noopener + | `Noreferrer + | `Opener | `Pingback + | `Preconnect | `Prefetch | `Prev + | `Preload + | `Prerender | `Search | `Stylesheet | `Sidebar @@ -151,6 +159,8 @@ type linktypes = linktype list Gives the permalink for the nearest ancestor section.} {- [`Canonical]: Gives the preferred location for accessing the current document.} + {- [`Dns_prefetch]: + Specifies that the user agent should preemptively perform DNS resolution for the target resource's origin..} {- [`External]: Indicates that the referenced document is not part of the same site as the current document.} {- [`First]: @@ -165,18 +175,32 @@ type linktypes = linktype list Indicates that the current document is a part of a series, and that the last document in the series is the referenced document.} {- [`Licence]: Indicates that the main content of the current document is covered by the copyright license described by the referenced document.} + {- [`Manifest]: + Imports or links to an application manifest.} + {- [`Me]: + Indicates that the current document represents the person who owns the linked content.} + {- [`Modulepreload]: + Specifies that the user agent must preemptively fetch the module script and store it in the document's module map for later evaluation. Optionally, the module's dependencies can be fetched as well.} {- [`Next]: Indicates that the current document is a part of a series, and that the next document in the series is the referenced document.} {- [`Nofollow]: Indicates that the current document's original author or publisher does not endorse the referenced document.} - {- [`Noreferrer]: - Requires that the user agent not send an HTTP Referer (sic) header if the user follows the hyperlink.} {- [`Noopener]: Instructs the browser to open the link without granting the new browsing context access to the document that opened it.} + {- [`Noreferrer]: + Requires that the user agent not send an HTTP Referer (sic) header if the user follows the hyperlink.} + {- [`Opener]: + Creates an auxiliary browsing context if the hyperlink would otherwise create a top-level traversable with a non-auxiliary browsing context (i.e., has "_blank" as target attribute value).} {- [`Pingback]: Gives the address of the pingback server that handles pingbacks to the current document.} + {- [`Preconnect]: + Specifies that the user agent should preemptively connect to the target resource's origin.} {- [`Prefetch]: Specifies that the target resource should be preemptively cached.} + {- [`Preload]: + Specifies that the user agent must preemptively fetch and cache the target resource for current navigation according to the potential destination given by the as attribute (and the priority associated with the corresponding destination).} + {- [`Prerender]: + Specifies that the user agent should preemptively fetch the target resource and process it in a way that helps deliver a faster response in the future.} {- [`Prev]: Indicates that the current document is a part of a series, and that the previous document in the series is the referenced document.} {- [`Search]: