UNPKG

hastx

Version:

JSX Transform emitting Rehype syntax trees (HAST)

1,590 lines (1,403 loc) 103 kB
import type * as hast from "@types/hast"; export type HTMLChild = | string | number | boolean | hast.Element | hast.Root | hast.Text; export type HTMLChildren = HTMLChild | Iterable<HTMLChild>; export interface HTMLVoidElement extends HTMLElement { children?: never; } export interface HTMLElement extends HTMLAttributes { children?: HTMLChildren; } export interface HTMLAttributes { accesskey?: string; autocapitalize?: "off" | "none" | "on" | "setences" | "words" | "characters"; class?: string; contenteditable?: "true" | "false" | "plaintext-only"; dir?: "ltr" | "rtl" | "auto"; draggable?: "true" | "false"; enterkeyhint?: | "enter" | "done" | "go" | "next" | "previous" | "search" | "send"; hidden?: "hidden" | "until-found"; id?: string; inert?: boolean; inputmode?: | "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url"; is?: string; itemid?: string; itemprop?: string; itemref?: string; itemscope?: string; itemtype?: string; lang?: string; nonce?: string; spellcheck?: "true" | "false" | "default"; style?: string; tabindex?: number; title?: string; translate?: "yes" | "no"; } export interface HTMLHTML extends HTMLElement { /** * Specifies the XML Namespace of the document. Default value is * "http://www.w3.org/1999/xhtml". This is required in documents parsed with * XML parsers, and optional in text/html documents. */ xmlns?: string; } export interface HTMLArea extends HTMLVoidElement { /** * A text string alternative to display on browsers that do not * display images. The text should be phrased so that it presents * the user with the same kind of choice as the image would offer * when displayed without the alternative text. This attribute is * required only if the href attribute is used. */ alt?: string; /** * The coords attribute details the coordinates of the shape * attribute in size, shape, and placement of an <area>. This * attribute must not be used if shape is set to default. */ coords?: string; /** * This attribute, if present, indicates that the author intends the * hyperlink to be used for downloading a resource. See <a> for a * full description of the download attribute. */ download?: string; /** * The hyperlink target for the area. Its value is a valid URL. This * attribute may be omitted; if so, the <area> element does not * represent a hyperlink. */ href?: string; /** * Contains a space-separated list of URLs to which, when the * hyperlink is followed, POST requests with the body PING will be * sent by the browser (in the background). Typically used for * tracking. */ ping?: string; /** * A string indicating which referrer to use when fetching the * resource: */ referrerpolicy?: | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; /** * For anchors containing the href attribute, this attribute * specifies the relationship of the target object to the link * object. The value is a space-separated list of link types. The * values and their semantics will be registered by some authority * that might have meaning to the document author. The default * relationship, if no other is given, is void. Use this attribute * only if the href attribute is present. */ rel?: string; /** * The shape of the associated hot spot. The specifications for HTML * defines the values rect, which defines a rectangular region; * circle, which defines a circular region; poly, which defines a * polygon; and default, which indicates the entire region beyond * any defined shapes. */ shape?: "rect" | "circle" | "poly" | "default"; /** * A keyword or author-defined name of the browsing context to * display the linked resource. */ target?: "_self" | "_blank" | "_parent" | "_top" | string; } export interface HTMLBase extends HTMLVoidElement { /** * The base URL to be used throughout the document for relative URLs. Absolute * and relative URLs are allowed. * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html */ href?: string; /** * A keyword or author-defined name of the default browsing context * to show the results of navigation from <a>, <area>, or <form> * elements without explicit target attributes. The following * keywords have special meanings */ target?: "_self" | "_blank" | "_parent" | "_top" | string; } export interface HTMLHead extends HTMLElement {} export interface HTMLLink extends HTMLVoidElement { /** * This attribute is only used when rel="preload" or rel="prefetch" * has been set on the <link> element. It specifies the type of * content being loaded by the <link>, which is necessary for * request matching, application of correct content security policy, * and setting of correct Accept request header. Furthermore, * rel="preload" uses this as a signal for request * prioritization. The table below lists the valid values for this * attribute and the elements or resources they apply to. */ as?: | "audio" | "document" | "embed" | "fetch" | "font" | "image" | "object" | "script" | "style" | "track" | "video" | "worker"; /** * This enumerated attribute indicates whether CORS must be used when fetching * the resource. CORS-enabled images can be reused in the <canvas> element * without being tainted. */ crossorigin?: "anonymous" | "use-credentials"; /** * Provides a hint of the relative priority to use when fetching a preloaded * resource. */ fetchpriority?: "high" | "low" | "auto"; /** * This attribute specifies the URL of the linked resource. A URL can be * absolute or relative. */ href?: string; /** * This attribute indicates the language of the linked resource. It * is purely advisory. Allowed values are specified by RFC 5646: * Tags for Identifying Languages (also known as BCP 47). Use this * attribute only if the href attribute is present. */ hreflang?: string; /** * For rel="preload" and as="image" only, the imagesizes attribute * is a sizes attribute that indicates to preload the appropriate * resource used by an img element with corresponding values for its * srcset and sizes attributes. */ imagesizes?: string; /** * For rel="preload" and as="image" only, the imagesrcset attribute * is a sourceset attribute that indicates to preload the * appropriate resource used by an img element with corresponding * values for its srcset and sizes attributes. */ imagesrcset?: string; /** * Contains inline metadata — a base64-encoded cryptographic hash of * the resource (file) you're telling the browser to fetch. The * browser can use this to verify that the fetched resource has been * delivered free of unexpected manipulation. See Subresource * Integrity. */ integrity?: string; /** * This attribute specifies the media that the linked resource * applies to. Its value must be a media type / media query. This * attribute is mainly useful when linking to external stylesheets — * it allows the user agent to pick the best adapted one for the * device it runs on. */ media?: string; /** * Identifies a resource that might be required by the next * navigation and that the user agent should retrieve it. This allows * the user agent to respond faster when the resource is requested in * the future. */ prefetch?: boolean; /** * A string indicating which referrer to use when fetching the resource: */ referrerpolicy?: | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "unsafe-url"; /** * This attribute names a relationship of the linked document to the * current document. The attribute must be a space-separated list of * link type values. */ rel?: string; /** * This attribute defines the sizes of the icons for visual media * contained in the resource. It must be present only if the rel * contains a value of icon or a non-standard type such as Apple's * apple-touch-icon. It may have the following values: */ sizes?: string; /** * The title attribute has special semantics on the <link> * element. When used on a <link rel="stylesheet"> it defines a * default or an alternate stylesheet. */ title?: string; /** * This attribute is used to define the type of the content linked * to. The value of the attribute should be a MIME type such as * text/html, text/css, and so on. The common use of this attribute * is to define the type of stylesheet being referenced (such as * text/css), but given that CSS is the only stylesheet language * used on the web, not only is it possible to omit the type * attribute, but is actually now recommended practice. It is also * used on rel="preload" link types, to make sure the browser only * downloads file types that it supports. */ type?: string; /** * This attribute explicitly indicates that certain operations * should be blocked on the fetching of an external resource. The * operations that are to be blocked must be a space-separated list * of blocking attributes listed below. */ blocking?: string; } export interface HTMLMeta extends HTMLVoidElement { /** * This attribute declares the document's character encoding. If the * attribute is present, its value must be an ASCII case-insensitive * match for the string "utf-8", because UTF-8 is the only valid * encoding for HTML5 documents. <meta> elements which declare a * character encoding must be located entirely within the first 1024 * bytes of the document. */ charset?: "utf-8" | "UTF-8"; /** * This attribute contains the value for the http-equiv or name attribute, * depending on which is used. */ content?: string; /** * Defines a pragma directive. The attribute is named * http-equiv(alent) because all the allowed values are names of * particular HTTP headers: */ "http-equiv"?: | "content-security-policy" | "content-type" | "default-style" | "x-ua-compatible" | "refresh"; /** * The name and content attributes can be used together to provide * document metadata in terms of name-value pairs, with the name * attribute giving the metadata name, and the content attribute * giving the value. */ name?: string; /** * The name and content attributes can be used together to provide * document metadata in terms of name-value pairs, with the name * attribute giving the metadata name, and the content attribute * giving the value. */ property?: string; } export interface HTMLStyle extends HTMLElement { /** * This attribute defines which media the style should be applied * to. Its value is a media query, which defaults to all if the * attribute is missing. */ media?: string; /** * A cryptographic nonce (number used once) used to allow inline * styles in a style-src Content-Security-Policy. The server must * generate a unique nonce value each time it transmits a policy. It * is critical to provide a nonce that cannot be guessed as * bypassing a resource's policy is otherwise trivial. */ nonce?: string; /** * This attribute specifies alternative style sheet sets. */ title?: string; /** * This attribute explicitly indicates that certain operations * should be blocked on the fetching of critical * subresources. @import-ed stylesheets are generally considered as * critical subresources, whereas background-image and fonts are * not. */ blocking?: "render"; } export interface HTMLTitle extends HTMLElement {} export interface HTMLBody extends HTMLElement {} export interface HTMLBlockquote extends HTMLElement { /** * A URL that designates a source document or message for the * information quoted. This attribute is intended to point to * information explaining the context or the reference for the * quote. */ cite?: string; } export interface HTMListItem extends HTMLElement { /** * This integer attribute indicates the current ordinal value of the * list item as defined by the <ol> element. The only allowed value * for this attribute is a number, even if the list is displayed * with Roman numerals or letters. List items that follow this one * continue numbering from the value set. The value attribute has no * meaning for unordered lists (<ul>) or for menus (<menu>). */ value?: number; } export interface HTMLOrderedList extends HTMLElement { /** * This Boolean attribute specifies that the list's items are in * reverse order. Items will be numbered from high to low. */ reversed?: boolean; /** * An integer to start counting from for the list items. Always an * Arabic numeral (1, 2, 3, etc.), even when the numbering type is * letters or Roman numerals. For example, to start numbering * elements from the letter "d" or the Roman numeral "iv," use * start="4". */ start?: number; /** * Sets the numbering type: * * a for lowercase letters * A for uppercase letters * i for lowercase Roman numerals * I for uppercase Roman numerals * 1 for numbers (default) * * The specified type is used for the entire list unless a different * type attribute is used on an enclosed <li> element. */ type?: "a" | "A" | "i" | "I" | "1"; } export interface HTMLAnchor extends HTMLElement { /** * Causes the browser to treat the linked URL as a download. Can be * used with or without a filename value: */ download?: string; /** * The URL that the hyperlink points to. Links are not restricted to * HTTP-based URLs — they can use any URL scheme supported by * browsers: */ href?: string; /** * Hints at the human language of the linked URL. No built-in * functionality. Allowed values are the same as the global lang * attribute. */ hreflang?: string; /** * A space-separated list of URLs. When the link is followed, the * browser will send POST requests with the body PING to the * URLs. Typically for tracking. */ ping?: string; /** * How much of the referrer to send when following the link. */ referrerpolicy?: | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; /** * The relationship of the linked URL as space-separated link types. */ rel?: string; /** * Where to display the linked URL, as the name for a browsing * context (a tab, window, or <iframe>). The following keywords have * special meanings for where to load the URL: */ target?: "_self" | "_blank" | "_parent" | "_top" | string; /** * Hints at the linked URL's format with a MIME type. No built-in * functionality. */ type?: string; } export interface HTMLTime extends HTMLElement { /** * This attribute indicates the time and/or date of the element * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time#valid_datetime_values */ datetime?: string; } export interface HTMLBDO extends HTMLElement { /** * The direction in which text should be rendered in this element's * contents. */ dir: "rtl" | "ltr"; } export interface HTMLData extends HTMLElement { /** * This attribute specifies the machine-readable translation of the * content of the element. */ value: string; } export interface HTMLAudio extends HTMLElement { /** * A Boolean attribute: if specified, the audio will automatically * begin playback as soon as it can do so, without waiting for the * entire audio file to finish downloading. */ autoplay?: boolean; /** * If this attribute is present, the browser will offer controls to * allow the user to control audio playback, including volume, * seeking, and pause/resume playback. */ controls?: boolean; /** * The controlslist attribute, when specified, helps the browser * select what controls to show for the audio element whenever the * browser shows its own set of controls (that is, when the controls * attribute is specified). */ controlslist?: string; /** * This enumerated attribute indicates whether to use CORS to fetch * the related audio file. CORS-enabled resources can be reused in * the <canvas> element without being tainted. */ crossorigin?: "anonymous" | "use-credentials"; /** * A Boolean attribute used to disable the capability of remote * playback in devices that are attached using wired (HDMI, DVI, * etc.) and wireless technologies (Miracast, Chromecast, DLNA, * AirPlay, etc.). See this proposed specification for more * information. */ disableremotplayback?: boolean; /** * A Boolean attribute: if specified, the audio player will * automatically seek back to the start upon reaching the end of the * audio. */ loop?: boolean; /** * A Boolean attribute that indicates whether the audio will be * initially silenced. Its default value is false. */ muted?: boolean; /** * This enumerated attribute is intended to provide a hint to the * browser about what the author thinks will lead to the best user * experience. It may have one of the following values: */ preload?: "none" | "metadata" | "auto"; /** * The URL of the audio to embed. This is subject to HTTP access * controls. This is optional; you may instead use the <source> * element within the audio block to specify the audio to embed. */ src?: string; } export interface HTMLImage extends HTMLVoidElement { /** * Defines an alternative text description of the image. */ alt?: string; /** * Indicates if the fetching of the image must be done using a CORS * request. Image data from a CORS-enabled image returned from a * CORS request can be reused in the <canvas> element without being * marked "tainted". * * If the crossorigin attribute is not specified, then a non-CORS * request is sent (without the Origin request header), and the * browser marks the image as tainted and restricts access to its * image data, preventing its usage in <canvas> elements. * * If the crossorigin attribute is specified, then a CORS request is * sent (with the Origin request header); but if the server does not * opt into allowing cross-origin access to the image data by the * origin site (by not sending any Access-Control-Allow-Origin * response header, or by not including the site's origin in any * Access-Control-Allow-Origin response header it does send), then the * browser blocks the image from loading, and logs a CORS error to the * devtools console. */ crossorigin?: "anonymous" | "use-credentials"; /** * Provides an image decoding hint to the browser. Allowed values: */ decoding?: "sync" | "async" | "auto"; /** * Marks the image for observation by the PerformanceElementTiming * API. The value given becomes an identifier for the observed image * element. See also the elementtiming attribute page. */ elementiming?: boolean; /** * Provides a hint of the relative priority to use when fetching the * image */ fetchpriority?: "high" | "low" | "auto"; /** * The intrinsic height of the image, in pixels. Must be an integer * without a unit. */ height?: number; /** * This Boolean attribute indicates that the image is part of a * server-side map. If so, the coordinates where the user clicked on * the image are sent to the server. */ ismap?: boolean; /** * Indicates how the browser should load the image */ loading?: "eager" | "lazy"; /** * A string indicating which referrer to use when fetching the * resource: */ referrerpolicy?: | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; /** * One or more strings separated by commas, indicating a set of source sizes. * Each source size consists of: * * 1. A media condition. This must be omitted for the last item in the list. * 2. A source size value. * * Media Conditions describe properties of the viewport, not of the * image. For example, (max-height: 500px) 1000px proposes to use a * source of 1000px width, if the viewport is not higher than 500px. * * Source size values specify the intended display size of the * image. User agents use the current source size to select one of the * sources supplied by the srcset attribute, when those sources are * described using width (w) descriptors. The selected source size * affects the intrinsic size of the image (the image's display size * if no CSS styling is applied). If the srcset attribute is absent, * or contains no values with a width descriptor, then the sizes * attribute has no effect. */ sizes?: string; /** * The image URL. Mandatory for the <img> element. On browsers * supporting srcset, src is treated like a candidate image with a * pixel density descriptor 1x, unless an image with this pixel * density descriptor is already defined in srcset, or unless srcset * contains w descriptors. */ src: string; /** * One or more strings separated by commas, indicating possible * image sources for the user agent to use. Each string is composed * of: * * 1. A URL to an image * 2. Optionally, whitespace followed by one of: * - A width descriptor (a positive integer directly followed by * w). The width descriptor is divided by the source size * given in the sizes attribute to calculate the effective * pixel density. * - A pixel density descriptor (a positive floating point number * directly followed by x). * If no descriptor is specified, the source is assigned the default descriptor of 1x. * * It is incorrect to mix width descriptors and pixel density * descriptors in the same srcset attribute. Duplicate descriptors * (for instance, two sources in the same srcset which are both * described with 2x) are also invalid. * If the srcset attribute uses width descriptors, the sizes * attribute must also be present, or the srcset itself will be * ignored. * * The user agent selects any of the available sources at its * discretion. This provides them with significant leeway to tailor their * selection based on things like user preferences or bandwidth * conditions. See our Responsive images tutorial for an example. */ srcset?: string; /** * The intrinsic width of the image in pixels. Must be an integer * without a unit. */ width?: number; /** * The partial URL (starting with #) of an image map associated with * the element. */ usemap?: boolean; } export interface HTMLMap extends HTMLElement { /** * The name attribute gives the map a name so that it can be * referenced. The attribute must be present and must have a * non-empty value with no space characters. The value of the name * attribute must not be equal to the value of the name attribute of * another <map> element in the same document. If the id attribute * is also specified, both attributes must have the same value. */ name: string; } export interface HTMLTrack extends HTMLVoidElement { /** * This attribute indicates that the track should be enabled unless * the user's preferences indicate that another track is more * appropriate. This may only be used on one track element per media * element. */ default?: boolean; /** * How the text track is meant to be used. If omitted the default * kind is subtitles. If the attribute contains an invalid value, it * will use metadata (Versions of Chrome earlier than 52 treated an * invalid value as subtitles). The following keywords are allowed: */ kind?: "subtitles" | "captions" | "descriptions" | "chapters" | "metadata"; /** * A user-readable title of the text track which is used by the * browser when listing available text tracks. */ label?: string; /** * Address of the track (.vtt file). Must be a valid URL. This * attribute must be specified and its URL value must have the same * origin as the document — unless the <audio> or <video> parent * element of the track element has a crossorigin attribute. */ src: string; /** * Language of the track text data. It must be a valid BCP 47 * language tag. If the kind attribute is set to subtitles, then * srclang must be defined */ srclang?: string; } export interface HTMLVideo extends HTMLElement { /** * A Boolean attribute; if specified, the video automatically begins * to play back as soon as it can do so without stopping to finish * loading the data. */ autoplay?: boolean; /** * If this attribute is present, the browser will offer controls to * allow the user to control video playback, including volume, * seeking, and pause/resume playback. */ controls?: boolean; /** * The controlslist attribute, when specified, helps the browser * select what controls to show for the video element whenever the * browser shows its own set of controls (that is, when the controls * attribute is specified). */ controlslist?: string; /** * This enumerated attribute indicates whether to use CORS to fetch * the related video. CORS-enabled resources can be reused in the * <canvas> element without being tainted. */ crossorigin?: "anonymous" | "use-credentials"; /** * Prevents the browser from suggesting a Picture-in-Picture context * menu or to request Picture-in-Picture automatically in some * cases. */ disablepictureinpicture?: boolean; /** * A Boolean attribute used to disable the capability of remote * playback in devices that are attached using wired (HDMI, DVI, * etc.) and wireless technologies (Miracast, Chromecast, DLNA, * AirPlay, etc.). */ disableremoteplayback?: boolean; /** * The height of the video's display area, in CSS pixels (absolute * values only; no percentages). */ height: number; /** * A Boolean attribute; if specified, the browser will automatically * seek back to the start upon reaching the end of the video. */ loop?: boolean; /** * A Boolean attribute that indicates the default setting of the * audio contained in the video. If set, the audio will be initially * silenced. Its default value is false, meaning that the audio will * be played when the video is played. */ muted?: boolean; /** * A Boolean attribute indicating that the video is to be played * "inline", that is within the element's playback area. Note that * the absence of this attribute does not imply that the video will * always be played in fullscreen. */ playsinline?: boolean; /** * A URL for an image to be shown while the video is downloading. If * this attribute isn't specified, nothing is displayed until the * first frame is available, then the first frame is shown as the * poster frame. */ poster?: string; /** * This enumerated attribute is intended to provide a hint to the * browser about what the author thinks will lead to the best user * experience regarding what content is loaded before the video is * played. */ preload?: "none" | "metadata" | "auto"; /** * The URL of the video to embed. This is optional; you may instead * use the <source> element within the video block to specify the * video to embed. */ src?: string; /** * The width of the video's display area, in CSS pixels (absolute * values only; no percentages). */ width: number; } export interface HTMLEmbed extends HTMLVoidElement { /** * The displayed height of the resource, in CSS pixels. This must be * an absolute value; percentages are not allowed. */ height?: number; /** * The URL of the resource being embedded. */ src: string; /** * The MIME type to use to select the plug-in to instantiate. */ type: string; /** * The displayed width of the resource, in CSS pixels. This must be * an absolute value; percentages are not allowed. */ width?: number; } export interface HTMLIFrame extends HTMLVoidElement { /** * Specifies a Permissions Policy for the <iframe>. The policy * defines what features are available to the <iframe> (for example, * access to the microphone, camera, battery, web-share, etc.) based * on the origin of the request. */ allow?: string; /** * Set to true if the <iframe> can activate fullscreen mode by * calling the requestFullscreen() method. */ allowfullscreen?: boolean; /** * Set to true if a cross-origin <iframe> should be allowed to * invoke the Payment Request API. */ allowpaymentrequest?: boolean; /** * Set to true to make the <iframe> credentialless, meaning that its * content will be loaded in a new, ephemeral context. It doesn't * have access to the network, cookies, and storage data associated * with its origin. It uses a new context local to the top-level * document lifetime. In return, the Cross-Origin-Embedder-Policy * (COEP) embedding rules can be lifted, so documents with COEP set * can embed third-party documents that do not. See IFrame * credentialless for more details. */ credentialless?: boolean; /** * A Content Security Policy enforced for the embedded resource. See * HTMLIFrameElement.csp for details. */ csp?: string; /** * The height of the frame in CSS pixels. Default is 150. */ height?: number; /** * Indicates how the browser should load the iframe */ loading?: "eager" | "lazy"; /** * A targetable name for the embedded browsing context. This can be * used in the target attribute of the <a>, <form>, or <base> * elements; the formtarget attribute of the <input> or <button> * elements; or the windowName parameter in the window.open() * method. */ name?: string; /** * Indicates which referrer to send when fetching the frame's * resource */ referrerpolicy?: | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "scrict-origin-when-cross-origin" | "unsafe-url"; /** * Controls the restrictions applied to the content embedded in the * <iframe>. The value of the attribute can either be empty to apply * all restrictions, or space-separated tokens to lift particular * restrictions */ sandbox?: string; /** * The URL of the page to embed. Use a value of about:blank to embed * an empty page that conforms to the same-origin policy. Also note * that programmatically removing an <iframe>'s src attribute * (e.g. via Element.removeAttribute()) causes about:blank to be * loaded in the frame in Firefox (from version 65), Chromium-based * browsers, and Safari/iOS. */ src?: string; /** * Inline HTML to embed, overriding the src attribute. If a browser * does not support the srcdoc attribute, it will fall back to the * URL in the src attribute. */ srcdoc?: string; /** * The width of the frame in CSS pixels. Default is 300. */ width?: number; } export interface HTMLObject extends HTMLVoidElement { /** * The address of the resource as a valid URL. At least one of data * and type must be defined. */ data?: string; /** * The form element, if any, that the object element is associated * with (its form owner). The value of the attribute must be an ID * of a <form> element in the same document. */ form?: string; /** * The height of the displayed resource, in CSS pixels. — (Absolute * values only. NO percentages) */ height?: number; /** * The name of valid browsing context (HTML5), or the name of the * control (HTML 4). */ name?: string; /** * The content type of the resource specified by data. At least one * of data and type must be defined. */ type?: string; /** * A hash-name reference to a <map> element; that is a '#' followed * by the value of a name of a map element. */ usemap?: string; /** * The width of the display resource, in CSS pixels. — (Absolute * values only. NO percentages) */ width?: number; } export interface HTMLPortal extends HTMLVoidElement { /** * Sets the referrer policy to use when requesting the page at the * URL given as the value of the src attribute. */ referrerpolicy?: string; /** * The URL of the page to embed. */ src: string; } export interface HTMLSource extends HTMLVoidElement { /** * The MIME media type of the image or other media type, optionally * with a codecs parameter. */ type?: string; /** * Required if the source element's parent is an <audio> and <video> * element, but not allowed if the source element's parent is a * <picture> element. * * Address of the media resource. */ src?: string; /** * A list of one or more strings, separated by commas, indicating a * set of possible images represented by the source for the browser to * use. * * Required if the source element's parent is a <picture> element, * but not allowed if the source element's parent is an <audio> or * <video> element. */ srcset?: string; /** * Allowed if the source element's parent is a <picture> element, * but not allowed if the source element's parent is an <audio> or * <video> element. * * A list of source sizes that describes the final rendered width of * the image represented by the source. Each source size consists of a * comma-separated list of media condition-length pairs. Before laying * the page out, the browser uses this information to determine which * image is defined in srcset to use. Please note that sizes will have * its effect only if width dimension descriptors are provided with * srcset instead of pixel ratio values (200w instead of 2x for * example). */ /** * Media query of the resource's intended media. * * Allowed if the source element's parent is a <picture> element, * but not allowed if the source element's parent is an <audio> or * <video> element. */ media?: string; /** * The intrinsic height of the image, in pixels. Must be an integer * without a unit. * * Allowed if the source element's parent is a <picture> element, * but not allowed if the source element's parent is an <audio> or * <video> element. */ height?: number; /** * The intrinsic width of the image, in pixels. Must be an integer * without a unit. * * Allowed if the source element's parent is a <picture> element, * but not allowed if the source element's parent is an <audio> or * <video> element. */ width?: number; } export interface HTMLCanvas extends HTMLElement { /** * The height of the coordinate space in CSS pixels. Defaults to * 150. */ height?: number; /** * The width of the coordinate space in CSS pixels. Defaults to 300. */ width?: number; } export interface HTMLScript extends HTMLElement { /** * For classic scripts, if the async attribute is present, then the * classic script will be fetched in parallel to parsing and * evaluated as soon as it is available. * * For module scripts, if the async attribute is present then the * scripts and all their dependencies will be executed in the defer * queue, therefore they will get fetched in parallel to parsing and * evaluated as soon as they are available. * * This attribute allows the elimination of parser-blocking JavaScript * where the browser would have to load and evaluate scripts before * continuing to parse. defer has a similar effect in this case. * * This is a boolean attribute: the presence of a boolean attribute on * an element represents the true value, and the absence of the * attribute represents the false value. */ async?: boolean; /** * Normal script elements pass minimal information to the * window.onerror for scripts which do not pass the standard CORS * checks. To allow error logging for sites which use a separate * domain for static media, use this attribute. See CORS settings * attributes for a more descriptive explanation of its valid * arguments. */ crossorigin?: string; /** * This Boolean attribute is set to indicate to a browser that the * script is meant to be executed after the document has been * parsed, but before firing DOMContentLoaded. * * Scripts with the defer attribute will prevent the DOMContentLoaded * event from firing until the script has loaded and finished * evaluating. */ defer?: boolean; /** * Provides a hint of the relative priority to use when fetching an * external script. */ fetchpriority?: "high" | "low" | "auto"; /** * This attribute contains inline metadata that a user agent can use * to verify that a fetched resource has been delivered free of * unexpected manipulation. See */ integrity?: string; /** * This Boolean attribute is set to indicate that the script should * not be executed in browsers that support ES modules — in effect, * this can be used to serve fallback scripts to older browsers that * do not support modular JavaScript code. */ nomodule?: boolean; /** * A cryptographic nonce (number used once) to allow scripts in a * script-src Content-Security-Policy. The server must generate a * unique nonce value each time it transmits a policy. It is * critical to provide a nonce that cannot be guessed as bypassing a * resource's policy is otherwise trivial. */ nonce?: string; /** * Indicates which referrer to send when fetching the script, or * resources fetched by the script */ referrerpolicy?: | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "scrict-origin-when-cross-origin" | "unsafe-url"; /** * This attribute specifies the URI of an external script; this can * be used as an alternative to embedding a script directly within a * document. */ src?: string; /** * This attribute indicates the type of script represented. The * value of this attribute will be one of the following: */ type?: "module" | "importmap" | string; /** * This attribute explicitly indicates that certain operations * should be blocked on the fetching of the script. The operations * that are to be blocked must be a space-separated list of blocking * attributes listed below. */ blocking?: "render"; } interface HTMLEdit extends HTMLElement { /** * A URI for a resource that explains the change (for example, * meeting minutes). */ cite?: string; /** * This attribute indicates the time and date of the change and must * be a valid date string with an optional time. If the value cannot * be parsed as a date with an optional time string, the element * does not have an associated timestamp. For the format of the * string without a time, see Date strings. The format of the string * if it includes both date and time is covered in Local date and * time strings. */ /** * This attribute indicates the time and date of the change and must * be a valid date string with an optional time. If the value cannot * be parsed as a date with an optional time string, the element * does not have an associated timestamp. For the format of the * string without a time, see Date strings. The format of the string * if it includes both date and time is covered in Local date and * time strings. */ datetime?: string; } export interface HTMLCol extends HTMLVoidElement { /** * This attribute contains a positive integer indicating the number * of consecutive columns the <col> element spans. If not present, * its default value is 1. */ span?: number; } export interface HTMLTd extends HTMLElement { /** * This attribute contains a non-negative integer value that * indicates for how many columns the cell extends. Its default * value is 1. Values higher than 1000 will be considered as * incorrect and will be set to the default value (1). */ colspan?: number; /** * This attribute contains a list of space-separated strings, each * corresponding to the id attribute of the <th> elements that apply * to this element. */ headers?: string; /** * This attribute contains a non-negative integer value that * indicates for how many rows the cell extends. Its default value * is 1; if its value is set to 0, it extends until the end of the * table section (<thead>, <tbody>, <tfoot>, even if implicitly * defined), that the cell belongs to. Values higher than 65534 are * clipped down to 65534. */ rowspan?: number; } export interface HTMLTh extends HTMLElement { /** * This attribute contains a short abbreviated description of the * cell's content. Some user-agents, such as speech readers, may * present this description before the content itself. */ abbr?: string; /** * This attribute contains a non-negative integer value that * indicates for how many columns the cell extends. Its default * value is 1. Values higher than 1000 will be considered as * incorrect and will be set to the default value (1). */ colspan?: number; /** * This attribute contains a list of space-separated strings, each * corresponding to the id attribute of the <th> elements that apply * to this element. */ headers?: string; /** * This attribute contains a non-negative integer value that * indicates for how many rows the cell extends. Its default value * is 1; if its value is set to 0, it extends until the end of the * table section (<thead>, <tbody>, <tfoot>, even if implicitly * defined), that the cell belongs to. Values higher than 65534 are * clipped down to 65534. */ rowspan?: number; /** * This enumerated attribute defines the cells that the header * (defined in the <th>) element relates to. It may have the * following values */ scope?: "row" | "col" | "rowgroup" | "colgroup"; } export interface HTMLButton extends HTMLElement { /** * This Boolean attribute specifies that the button should have * input focus when the page loads. Only one element in a document * can have this attribute. */ autofocus?: boolean; /** * This attribute on a <button> is nonstandard and * Firefox-specific. Unlike other browsers, Firefox persists the * dynamic disabled state of a <button> across page loads. Setting * autocomplete="off" on the button disables this feature; see * Firefox bug 654072. */ autocomplete?: "off"; /** * This Boolean attribute prevents the user from interacting with the button: it cannot be pressed or focused. * * Firefox, unlike other browsers, persists the dynamic disabled * state of a <button> across page loads. To control this feature, use * the autocomplete attribute. */ disabled?: boolean; /** * The <form> element to associate the button with (its form * owner). The value of this attribute must be the id of a <form> in * the same document. (If this attribute is not set, the <button> is * associated with its ancestor <form> element, if any.) * * This attribute lets you associate <button> elements to <form>s * anywhere in the document, not just inside a <form>. It can also * override an ancestor <form> element. */ form?: string; /** * The URL that processes the information submitted by the * button. Overrides the action attribute of the button's form * owner. Does nothing if there is no form owner. */ formaction?: string; /** * If the button is a submit button (it's inside/associated with a * <form> and doesn't have type="button"), specifies how to encode * the form data that is submitted. Possible values: * * - __application/x-www-form-urlencoded__: The default if the attribute * is not used. * - __multipart/form-data__: Used to submit <input> elements with their * type attributes set to file. * - __text/plain__: Specified as a debugging aid; shouldn't be used for * real form submission. * * If this attribute is specified, it overrides the enctype * attribute of the button's form owner. */ formenctype?: | "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain"; /** * If the button is a submit button (it's inside/associated with a * <form> and doesn't have type="button"), this attribute specifies * the HTTP method used to submit the form. Possible values: */ formmethod?: "post" | "POST" | "get" | "GET"; /** * If the button is a submit button, this Boolean attribute * specifies that the form is not to be validated when it is * submitted. If this attribute is specified, it overrides the * novalidate attribute of the button's form owner. * * This attribute is also available on <input type="image"> and <input * type="submit"> elements. */ formnovalidate?: boolean; /** * If the button is a submit button, this attribute is an * author-defined name or standardized, underscore-prefixed keyword * indicating where to display the response from submitting the * form. This is the name of, or keyword for, a browsing context (a * tab, window, or <iframe>). If this attribute is specified, it * overrides the target attribute of the button's form owner. The * following keywords have special meanings: */ formtarget?: "_self" | "_blank" | "_parent" | "_top" | string; /** * The name of the button, submitted as a pair with the button's * value as part of the form data, when that button is used to * submit the form. */ name?: string; /** * Turns a <button> element into a popover control button; takes the * ID of the popover element to control as its value. See the * Popover API landing page for more details. */ popovertarget?: string; /** * Specifies the the action to be performed on a popover element * being controlled by a control <button>. Possible values are: */ popovertargetaction?: "hide" | "show" | "toggle"; /** * The default behavior of the button. */ type?: "submit" | "reset" | "action"; /** * Defines the value associated with the button's name when it's * submitted with the form data. This value is passed to the server * in params when the form is submitted using this button. */ value?: string; } export interface HTMLFieldSet extends HTMLElement { /** * If this Boolean attribute is set, all form controls that are * descendants of the <fieldset>, are disabled, meaning they are not * editable and won't be submitted along with the <form>. They won't * receive any browsing events, like mouse clicks or focus-related * events. By default browsers display such controls grayed * out. Note that form elements inside the <legend> element won't be * disabled. */ disabled?: boolean; /** * This attribute takes the value of the id attribute of a <form> * element you want the <fieldset> to be part of, even if it is not * inside the form. Please note that usage of this is confusing — if * you want the <input> elements inside the <fieldset> to be * associated with the form, you need to use the form attribute * directly on those elements. You can check which elements are * associated with a form via JavaScript, using * HTMLFormElement.elements. */ form?: string; /** * The name associated with the group. */ name?: string; } export interface HTMLForm extends HTMLElement { /** * Space-separated character encodings the server accepts. The * browser uses them in the order in which they are listed. The * default value means the same encoding as the page. (In previous * versions of HTML, character encodings could also be delimited by * commas.) */ "accept-charset"?: string; /** * Indicates whether input elements can by default have their values * automatically completed by the browser. autocomplete attributes * on form elements override it on <form>. */ autocomplete?: "off" | "on"; /** * The name of the form. The value must not be the empty string, and * must be unique among the form elements in the forms collection * that it is in, if any. */ name?: string; /** * Controls the annotations and what kinds of links the form * creates. Annotations include `external`, `nofollow`, `opener`, * `noopener`, and `noreferrer`. Link types include help, prev, next, * search, and license. The rel value is a space-separated list of * these enumerated values. */ rel?: string; /** * The URL that processes the form submission. This value can be * overridd