312 lines
8.1 KiB
JavaScript
312 lines
8.1 KiB
JavaScript
import {
|
|
boolean,
|
|
overloadedBoolean,
|
|
booleanish,
|
|
number,
|
|
spaceSeparated,
|
|
commaSeparated
|
|
} from './util/types.js'
|
|
import {create} from './util/create.js'
|
|
import {caseInsensitiveTransform} from './util/case-insensitive-transform.js'
|
|
|
|
export const html = create({
|
|
space: 'html',
|
|
attributes: {
|
|
acceptcharset: 'accept-charset',
|
|
classname: 'class',
|
|
htmlfor: 'for',
|
|
httpequiv: 'http-equiv'
|
|
},
|
|
transform: caseInsensitiveTransform,
|
|
mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],
|
|
properties: {
|
|
// Standard Properties.
|
|
abbr: null,
|
|
accept: commaSeparated,
|
|
acceptCharset: spaceSeparated,
|
|
accessKey: spaceSeparated,
|
|
action: null,
|
|
allow: null,
|
|
allowFullScreen: boolean,
|
|
allowPaymentRequest: boolean,
|
|
allowUserMedia: boolean,
|
|
alt: null,
|
|
as: null,
|
|
async: boolean,
|
|
autoCapitalize: null,
|
|
autoComplete: spaceSeparated,
|
|
autoFocus: boolean,
|
|
autoPlay: boolean,
|
|
capture: boolean,
|
|
charSet: null,
|
|
checked: boolean,
|
|
cite: null,
|
|
className: spaceSeparated,
|
|
cols: number,
|
|
colSpan: null,
|
|
content: null,
|
|
contentEditable: booleanish,
|
|
controls: boolean,
|
|
controlsList: spaceSeparated,
|
|
coords: number | commaSeparated,
|
|
crossOrigin: null,
|
|
data: null,
|
|
dateTime: null,
|
|
decoding: null,
|
|
default: boolean,
|
|
defer: boolean,
|
|
dir: null,
|
|
dirName: null,
|
|
disabled: boolean,
|
|
download: overloadedBoolean,
|
|
draggable: booleanish,
|
|
encType: null,
|
|
enterKeyHint: null,
|
|
form: null,
|
|
formAction: null,
|
|
formEncType: null,
|
|
formMethod: null,
|
|
formNoValidate: boolean,
|
|
formTarget: null,
|
|
headers: spaceSeparated,
|
|
height: number,
|
|
hidden: boolean,
|
|
high: number,
|
|
href: null,
|
|
hrefLang: null,
|
|
htmlFor: spaceSeparated,
|
|
httpEquiv: spaceSeparated,
|
|
id: null,
|
|
imageSizes: null,
|
|
imageSrcSet: null,
|
|
inputMode: null,
|
|
integrity: null,
|
|
is: null,
|
|
isMap: boolean,
|
|
itemId: null,
|
|
itemProp: spaceSeparated,
|
|
itemRef: spaceSeparated,
|
|
itemScope: boolean,
|
|
itemType: spaceSeparated,
|
|
kind: null,
|
|
label: null,
|
|
lang: null,
|
|
language: null,
|
|
list: null,
|
|
loading: null,
|
|
loop: boolean,
|
|
low: number,
|
|
manifest: null,
|
|
max: null,
|
|
maxLength: number,
|
|
media: null,
|
|
method: null,
|
|
min: null,
|
|
minLength: number,
|
|
multiple: boolean,
|
|
muted: boolean,
|
|
name: null,
|
|
nonce: null,
|
|
noModule: boolean,
|
|
noValidate: boolean,
|
|
onAbort: null,
|
|
onAfterPrint: null,
|
|
onAuxClick: null,
|
|
onBeforeMatch: null,
|
|
onBeforePrint: null,
|
|
onBeforeUnload: null,
|
|
onBlur: null,
|
|
onCancel: null,
|
|
onCanPlay: null,
|
|
onCanPlayThrough: null,
|
|
onChange: null,
|
|
onClick: null,
|
|
onClose: null,
|
|
onContextLost: null,
|
|
onContextMenu: null,
|
|
onContextRestored: null,
|
|
onCopy: null,
|
|
onCueChange: null,
|
|
onCut: null,
|
|
onDblClick: null,
|
|
onDrag: null,
|
|
onDragEnd: null,
|
|
onDragEnter: null,
|
|
onDragExit: null,
|
|
onDragLeave: null,
|
|
onDragOver: null,
|
|
onDragStart: null,
|
|
onDrop: null,
|
|
onDurationChange: null,
|
|
onEmptied: null,
|
|
onEnded: null,
|
|
onError: null,
|
|
onFocus: null,
|
|
onFormData: null,
|
|
onHashChange: null,
|
|
onInput: null,
|
|
onInvalid: null,
|
|
onKeyDown: null,
|
|
onKeyPress: null,
|
|
onKeyUp: null,
|
|
onLanguageChange: null,
|
|
onLoad: null,
|
|
onLoadedData: null,
|
|
onLoadedMetadata: null,
|
|
onLoadEnd: null,
|
|
onLoadStart: null,
|
|
onMessage: null,
|
|
onMessageError: null,
|
|
onMouseDown: null,
|
|
onMouseEnter: null,
|
|
onMouseLeave: null,
|
|
onMouseMove: null,
|
|
onMouseOut: null,
|
|
onMouseOver: null,
|
|
onMouseUp: null,
|
|
onOffline: null,
|
|
onOnline: null,
|
|
onPageHide: null,
|
|
onPageShow: null,
|
|
onPaste: null,
|
|
onPause: null,
|
|
onPlay: null,
|
|
onPlaying: null,
|
|
onPopState: null,
|
|
onProgress: null,
|
|
onRateChange: null,
|
|
onRejectionHandled: null,
|
|
onReset: null,
|
|
onResize: null,
|
|
onScroll: null,
|
|
onScrollEnd: null,
|
|
onSecurityPolicyViolation: null,
|
|
onSeeked: null,
|
|
onSeeking: null,
|
|
onSelect: null,
|
|
onSlotChange: null,
|
|
onStalled: null,
|
|
onStorage: null,
|
|
onSubmit: null,
|
|
onSuspend: null,
|
|
onTimeUpdate: null,
|
|
onToggle: null,
|
|
onUnhandledRejection: null,
|
|
onUnload: null,
|
|
onVolumeChange: null,
|
|
onWaiting: null,
|
|
onWheel: null,
|
|
open: boolean,
|
|
optimum: number,
|
|
pattern: null,
|
|
ping: spaceSeparated,
|
|
placeholder: null,
|
|
playsInline: boolean,
|
|
poster: null,
|
|
preload: null,
|
|
readOnly: boolean,
|
|
referrerPolicy: null,
|
|
rel: spaceSeparated,
|
|
required: boolean,
|
|
reversed: boolean,
|
|
rows: number,
|
|
rowSpan: number,
|
|
sandbox: spaceSeparated,
|
|
scope: null,
|
|
scoped: boolean,
|
|
seamless: boolean,
|
|
selected: boolean,
|
|
shape: null,
|
|
size: number,
|
|
sizes: null,
|
|
slot: null,
|
|
span: number,
|
|
spellCheck: booleanish,
|
|
src: null,
|
|
srcDoc: null,
|
|
srcLang: null,
|
|
srcSet: null,
|
|
start: number,
|
|
step: null,
|
|
style: null,
|
|
tabIndex: number,
|
|
target: null,
|
|
title: null,
|
|
translate: null,
|
|
type: null,
|
|
typeMustMatch: boolean,
|
|
useMap: null,
|
|
value: booleanish,
|
|
width: number,
|
|
wrap: null,
|
|
|
|
// Legacy.
|
|
// See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis
|
|
align: null, // Several. Use CSS `text-align` instead,
|
|
aLink: null, // `<body>`. Use CSS `a:active {color}` instead
|
|
archive: spaceSeparated, // `<object>`. List of URIs to archives
|
|
axis: null, // `<td>` and `<th>`. Use `scope` on `<th>`
|
|
background: null, // `<body>`. Use CSS `background-image` instead
|
|
bgColor: null, // `<body>` and table elements. Use CSS `background-color` instead
|
|
border: number, // `<table>`. Use CSS `border-width` instead,
|
|
borderColor: null, // `<table>`. Use CSS `border-color` instead,
|
|
bottomMargin: number, // `<body>`
|
|
cellPadding: null, // `<table>`
|
|
cellSpacing: null, // `<table>`
|
|
char: null, // Several table elements. When `align=char`, sets the character to align on
|
|
charOff: null, // Several table elements. When `char`, offsets the alignment
|
|
classId: null, // `<object>`
|
|
clear: null, // `<br>`. Use CSS `clear` instead
|
|
code: null, // `<object>`
|
|
codeBase: null, // `<object>`
|
|
codeType: null, // `<object>`
|
|
color: null, // `<font>` and `<hr>`. Use CSS instead
|
|
compact: boolean, // Lists. Use CSS to reduce space between items instead
|
|
declare: boolean, // `<object>`
|
|
event: null, // `<script>`
|
|
face: null, // `<font>`. Use CSS instead
|
|
frame: null, // `<table>`
|
|
frameBorder: null, // `<iframe>`. Use CSS `border` instead
|
|
hSpace: number, // `<img>` and `<object>`
|
|
leftMargin: number, // `<body>`
|
|
link: null, // `<body>`. Use CSS `a:link {color: *}` instead
|
|
longDesc: null, // `<frame>`, `<iframe>`, and `<img>`. Use an `<a>`
|
|
lowSrc: null, // `<img>`. Use a `<picture>`
|
|
marginHeight: number, // `<body>`
|
|
marginWidth: number, // `<body>`
|
|
noResize: boolean, // `<frame>`
|
|
noHref: boolean, // `<area>`. Use no href instead of an explicit `nohref`
|
|
noShade: boolean, // `<hr>`. Use background-color and height instead of borders
|
|
noWrap: boolean, // `<td>` and `<th>`
|
|
object: null, // `<applet>`
|
|
profile: null, // `<head>`
|
|
prompt: null, // `<isindex>`
|
|
rev: null, // `<link>`
|
|
rightMargin: number, // `<body>`
|
|
rules: null, // `<table>`
|
|
scheme: null, // `<meta>`
|
|
scrolling: booleanish, // `<frame>`. Use overflow in the child context
|
|
standby: null, // `<object>`
|
|
summary: null, // `<table>`
|
|
text: null, // `<body>`. Use CSS `color` instead
|
|
topMargin: number, // `<body>`
|
|
valueType: null, // `<param>`
|
|
version: null, // `<html>`. Use a doctype.
|
|
vAlign: null, // Several. Use CSS `vertical-align` instead
|
|
vLink: null, // `<body>`. Use CSS `a:visited {color}` instead
|
|
vSpace: number, // `<img>` and `<object>`
|
|
|
|
// Non-standard Properties.
|
|
allowTransparency: null,
|
|
autoCorrect: null,
|
|
autoSave: null,
|
|
disablePictureInPicture: boolean,
|
|
disableRemotePlayback: boolean,
|
|
prefix: null,
|
|
property: null,
|
|
results: number,
|
|
security: null,
|
|
unselectable: null
|
|
}
|
|
})
|