flow-typed/environments/html.js JAVASCRIPT 1,711 lines View on github.com → Search inside
1// flow-typed signature: 760aeea3b9b767e808097fe22b68a20f2// flow-typed version: 8584579196/html/flow_>=v0.261.x34/* DataTransfer */56declare class DataTransfer {7  clearData(format?: string): void;8  getData(format: string): string;9  setData(format: string, data: string): void;10  setDragImage(image: Element, x: number, y: number): void;11  dropEffect: string;12  effectAllowed: string;13  files: FileList; // readonly14  items: DataTransferItemList; // readonly15  types: Array<string>; // readonly16}1718declare class DataTransferItemList {19  @@iterator(): Iterator<DataTransferItem>;20  length: number; // readonly21  [index: number]: DataTransferItem;22  add(data: string, type: string): ?DataTransferItem;23  add(data: File): ?DataTransferItem;24  remove(index: number): void;25  clear(): void;26}2728// https://wicg.github.io/file-system-access/#drag-and-drop29declare class DataTransferItem {30  kind: string; // readonly31  type: string; // readonly32  getAsString(_callback: ?(data: string) => mixed): void;33  getAsFile(): ?File;34  /*35   * This is not supported by all browsers, please have a fallback plan for it.36   * For more information, please checkout37   * https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry38   */39  webkitGetAsEntry(): void | (() => any);40  /*41   * Not supported in all browsers42   * For up to date compatibility information, please visit43   * https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/getAsFileSystemHandle44   */45  getAsFileSystemHandle?: () => Promise<?FileSystemHandle>;46}4748declare type DOMStringMap = {[key: string]: string, ...};4950declare class DOMStringList {51  @@iterator(): Iterator<string>;52  +[key: number]: string;53  +length: number;54  item(number): string | null;55  contains(string): boolean;56}5758declare type ElementDefinitionOptions = {|extends?: string|};5960declare interface CustomElementRegistry {61  define(62    name: string,63    ctor: Class<Element>,64    options?: ElementDefinitionOptions65  ): void;66  get(name: string): any;67  whenDefined(name: string): Promise<void>;68}6970// https://www.w3.org/TR/eventsource/71declare class EventSource extends EventTarget {72  constructor(73    url: string,74    configuration?: {withCredentials: boolean, ...}75  ): void;76  +CLOSED: 2;77  +CONNECTING: 0;78  +OPEN: 1;79  +readyState: 0 | 1 | 2;80  +url: string;81  +withCredentials: boolean;82  onerror: () => void;83  onmessage: MessageEventListener;84  onopen: () => void;85  close: () => void;86}8788// https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface89declare class ErrorEvent extends Event {90  constructor(91    type: string,92    eventInitDict?: {93      ...Event$Init,94      message?: string,95      filename?: string,96      lineno?: number,97      colno?: number,98      error?: any,99      ...100    }101  ): void;102  +message: string;103  +filename: string;104  +lineno: number;105  +colno: number;106  +error: any;107}108109// https://html.spec.whatwg.org/multipage/web-messaging.html#broadcasting-to-other-browsing-contexts110declare class BroadcastChannel extends EventTarget {111  name: string;112  onmessage: ?(event: MessageEvent<>) => void;113  onmessageerror: ?(event: MessageEvent<>) => void;114115  constructor(name: string): void;116  postMessage(msg: mixed): void;117  close(): void;118}119120// https://www.w3.org/TR/webstorage/#the-storageevent-interface121declare class StorageEvent extends Event {122  key: ?string;123  oldValue: ?string;124  newValue: ?string;125  url: string;126  storageArea: ?Storage;127}128129// https://www.w3.org/TR/html50/browsers.html#beforeunloadevent130declare class BeforeUnloadEvent extends Event {131  returnValue: string;132}133134type ToggleEvent$Init = {135  ...Event$Init,136  oldState: string,137  newState: string,138  ...139};140141declare class ToggleEvent extends Event {142  constructor(type: ToggleEventTypes, eventInit?: ToggleEvent$Init): void;143  +oldState: string;144  +newState: string;145}146147// TODO: HTMLDocument148type FocusOptions = {preventScroll?: boolean, ...};149150declare class HTMLElement extends Element {151  blur(): void;152  click(): void;153  focus(options?: FocusOptions): void;154  getBoundingClientRect(): DOMRect;155  forceSpellcheck(): void;156157  showPopover(options?: {|source?: HTMLElement|}): void;158  hidePopover(): void;159  togglePopover(160    options?: boolean | {|force?: boolean, source?: HTMLElement|}161  ): boolean;162163  accessKey: string;164  accessKeyLabel: string;165  contentEditable: string;166  contextMenu: ?HTMLMenuElement;167  dataset: DOMStringMap;168  dir: 'ltr' | 'rtl' | 'auto';169  draggable: boolean;170  dropzone: any;171  hidden: boolean;172  inert: boolean;173  isContentEditable: boolean;174  itemProp: any;175  itemScope: boolean;176  itemType: any;177  itemValue: Object;178  lang: string;179  offsetHeight: number;180  offsetLeft: number;181  offsetParent: ?Element;182  offsetTop: number;183  offsetWidth: number;184  onabort: ?Function;185  onblur: ?Function;186  oncancel: ?Function;187  oncanplay: ?Function;188  oncanplaythrough: ?Function;189  onchange: ?Function;190  onclick: ?Function;191  oncontextmenu: ?Function;192  oncuechange: ?Function;193  ondblclick: ?Function;194  ondurationchange: ?Function;195  onemptied: ?Function;196  onended: ?Function;197  onerror: ?Function;198  onfocus: ?Function;199  onfullscreenchange: ?Function;200  onfullscreenerror: ?Function;201  ongotpointercapture: ?Function;202  oninput: ?Function;203  oninvalid: ?Function;204  onkeydown: ?Function;205  onkeypress: ?Function;206  onkeyup: ?Function;207  onload: ?Function;208  onloadeddata: ?Function;209  onloadedmetadata: ?Function;210  onloadstart: ?Function;211  onlostpointercapture: ?Function;212  onmousedown: ?Function;213  onmouseenter: ?Function;214  onmouseleave: ?Function;215  onmousemove: ?Function;216  onmouseout: ?Function;217  onmouseover: ?Function;218  onmouseup: ?Function;219  onmousewheel: ?Function;220  onpause: ?Function;221  onplay: ?Function;222  onplaying: ?Function;223  onpointercancel: ?Function;224  onpointerdown: ?Function;225  onpointerenter: ?Function;226  onpointerleave: ?Function;227  onpointermove: ?Function;228  onpointerout: ?Function;229  onpointerover: ?Function;230  onpointerup: ?Function;231  onprogress: ?Function;232  onratechange: ?Function;233  onreadystatechange: ?Function;234  onreset: ?Function;235  onresize: ?Function;236  onscroll: ?Function;237  onseeked: ?Function;238  onseeking: ?Function;239  onselect: ?Function;240  onshow: ?Function;241  onstalled: ?Function;242  onsubmit: ?Function;243  onsuspend: ?Function;244  ontimeupdate: ?Function;245  ontoggle: ?Function;246  onbeforetoggle: ?Function;247  onvolumechange: ?Function;248  onwaiting: ?Function;249  properties: any;250  spellcheck: boolean;251  style: CSSStyleDeclaration;252  tabIndex: number;253  title: string;254  translate: boolean;255  popover: '' | 'auto' | 'manual' | 'hint';256257  +popoverVisibilityState: 'hidden' | 'showing';258259  +popoverInvoker: HTMLElement | null;260}261262declare class HTMLSlotElement extends HTMLElement {263  name: string;264  assignedNodes(options?: {flatten: boolean, ...}): Node[];265}266267declare class HTMLTableElement extends HTMLElement {268  tagName: 'TABLE';269  caption: HTMLTableCaptionElement | null;270  tHead: HTMLTableSectionElement | null;271  tFoot: HTMLTableSectionElement | null;272  +tBodies: HTMLCollection<HTMLTableSectionElement>;273  +rows: HTMLCollection<HTMLTableRowElement>;274  createTHead(): HTMLTableSectionElement;275  deleteTHead(): void;276  createTFoot(): HTMLTableSectionElement;277  deleteTFoot(): void;278  createCaption(): HTMLTableCaptionElement;279  deleteCaption(): void;280  insertRow(index?: number): HTMLTableRowElement;281  deleteRow(index: number): void;282}283284declare class HTMLTableCaptionElement extends HTMLElement {285  tagName: 'CAPTION';286}287288declare class HTMLTableColElement extends HTMLElement {289  tagName: 'COL' | 'COLGROUP';290  span: number;291}292293declare class HTMLTableSectionElement extends HTMLElement {294  tagName: 'THEAD' | 'TFOOT' | 'TBODY';295  +rows: HTMLCollection<HTMLTableRowElement>;296  insertRow(index?: number): HTMLTableRowElement;297  deleteRow(index: number): void;298}299300declare class HTMLTableCellElement extends HTMLElement {301  tagName: 'TD' | 'TH';302  colSpan: number;303  rowSpan: number;304  +cellIndex: number;305}306307declare class HTMLTableRowElement extends HTMLElement {308  tagName: 'TR';309  align: 'left' | 'right' | 'center';310  +rowIndex: number;311  +sectionRowIndex: number;312  +cells: HTMLCollection<HTMLTableCellElement>;313  deleteCell(index: number): void;314  insertCell(index?: number): HTMLTableCellElement;315}316317declare class HTMLMenuElement extends HTMLElement {318  getCompact(): boolean;319  setCompact(compact: boolean): void;320}321322declare class HTMLBaseElement extends HTMLElement {323  href: string;324  target: string;325}326327declare class HTMLTemplateElement extends HTMLElement {328  content: DocumentFragment;329}330331declare class CanvasGradient {332  addColorStop(offset: number, color: string): void;333}334335declare class CanvasPattern {336  setTransform(matrix: SVGMatrix): void;337}338339declare class ImageBitmap {340  close(): void;341  width: number;342  height: number;343}344345type CanvasFillRule = string;346347type CanvasImageSource =348  | HTMLImageElement349  | HTMLVideoElement350  | HTMLCanvasElement351  | CanvasRenderingContext2D352  | ImageBitmap;353354declare class TextMetrics {355  // x-direction356  width: number;357  actualBoundingBoxLeft: number;358  actualBoundingBoxRight: number;359360  // y-direction361  fontBoundingBoxAscent: number;362  fontBoundingBoxDescent: number;363  actualBoundingBoxAscent: number;364  actualBoundingBoxDescent: number;365  emHeightAscent: number;366  emHeightDescent: number;367  hangingBaseline: number;368  alphabeticBaseline: number;369  ideographicBaseline: number;370}371372declare class CanvasDrawingStyles {373  width: number;374  actualBoundingBoxLeft: number;375  actualBoundingBoxRight: number;376377  // y-direction378  fontBoundingBoxAscent: number;379  fontBoundingBoxDescent: number;380  actualBoundingBoxAscent: number;381  actualBoundingBoxDescent: number;382  emHeightAscent: number;383  emHeightDescent: number;384  hangingBaseline: number;385  alphabeticBaseline: number;386  ideographicBaseline: number;387}388389declare class Path2D {390  constructor(path?: Path2D | string): void;391392  addPath(path: Path2D, transformation?: ?SVGMatrix): void;393  addPathByStrokingPath(394    path: Path2D,395    styles: CanvasDrawingStyles,396    transformation?: ?SVGMatrix397  ): void;398  addText(399    text: string,400    styles: CanvasDrawingStyles,401    transformation: ?SVGMatrix,402    x: number,403    y: number,404    maxWidth?: number405  ): void;406  addPathByStrokingText(407    text: string,408    styles: CanvasDrawingStyles,409    transformation: ?SVGMatrix,410    x: number,411    y: number,412    maxWidth?: number413  ): void;414  addText(415    text: string,416    styles: CanvasDrawingStyles,417    transformation: ?SVGMatrix,418    path: Path2D,419    maxWidth?: number420  ): void;421  addPathByStrokingText(422    text: string,423    styles: CanvasDrawingStyles,424    transformation: ?SVGMatrix,425    path: Path2D,426    maxWidth?: number427  ): void;428429  // CanvasPathMethods430  // shared path API methods431  arc(432    x: number,433    y: number,434    radius: number,435    startAngle: number,436    endAngle: number,437    anticlockwise?: boolean438  ): void;439  arcTo(440    x1: number,441    y1: number,442    x2: number,443    y2: number,444    radius: number,445    _: void,446    _: void447  ): void;448  arcTo(449    x1: number,450    y1: number,451    x2: number,452    y2: number,453    radiusX: number,454    radiusY: number,455    rotation: number456  ): void;457  bezierCurveTo(458    cp1x: number,459    cp1y: number,460    cp2x: number,461    cp2y: number,462    x: number,463    y: number464  ): void;465  closePath(): void;466  ellipse(467    x: number,468    y: number,469    radiusX: number,470    radiusY: number,471    rotation: number,472    startAngle: number,473    endAngle: number,474    anticlockwise?: boolean475  ): void;476  lineTo(x: number, y: number): void;477  moveTo(x: number, y: number): void;478  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;479  rect(x: number, y: number, w: number, h: number): void;480}481482declare class ImageData {483  width: number;484  height: number;485  data: Uint8ClampedArray;486487  // constructor methods are used in Worker where CanvasRenderingContext2D488  //  is unavailable.489  // https://html.spec.whatwg.org/multipage/scripting.html#dom-imagedata490  constructor(data: Uint8ClampedArray, width: number, height: number): void;491  constructor(width: number, height: number): void;492}493494declare class CanvasRenderingContext2D {495  canvas: HTMLCanvasElement;496497  // canvas dimensions498  width: number;499  height: number;500501  // for contexts that aren't directly fixed to a specific canvas502  commit(): void;503504  // state505  save(): void;506  restore(): void;507508  // transformations509  currentTransform: SVGMatrix;510  scale(x: number, y: number): void;511  rotate(angle: number): void;512  translate(x: number, y: number): void;513  transform(514    a: number,515    b: number,516    c: number,517    d: number,518    e: number,519    f: number520  ): void;521  setTransform(522    a: number,523    b: number,524    c: number,525    d: number,526    e: number,527    f: number528  ): void;529  resetTransform(): void;530531  // compositing532  globalAlpha: number;533  globalCompositeOperation: string;534535  // image smoothing536  imageSmoothingEnabled: boolean;537  imageSmoothingQuality: 'low' | 'medium' | 'high';538539  // filters540  filter: string;541542  // colours and styles543  strokeStyle: string | CanvasGradient | CanvasPattern;544  fillStyle: string | CanvasGradient | CanvasPattern;545  createLinearGradient(546    x0: number,547    y0: number,548    x1: number,549    y1: number550  ): CanvasGradient;551  createRadialGradient(552    x0: number,553    y0: number,554    r0: number,555    x1: number,556    y1: number,557    r1: number558  ): CanvasGradient;559  createPattern(image: CanvasImageSource, repetition: ?string): CanvasPattern;560561  // shadows562  shadowOffsetX: number;563  shadowOffsetY: number;564  shadowBlur: number;565  shadowColor: string;566567  // rects568  clearRect(x: number, y: number, w: number, h: number): void;569  fillRect(x: number, y: number, w: number, h: number): void;570  roundRect(571    x: number,572    y: number,573    w: number,574    h: number,575    radii?: number | DOMPointInit | $ReadOnlyArray<number | DOMPointInit>576  ): void;577  strokeRect(x: number, y: number, w: number, h: number): void;578579  // path API580  beginPath(): void;581  fill(fillRule?: CanvasFillRule): void;582  fill(path: Path2D, fillRule?: CanvasFillRule): void;583  stroke(): void;584  stroke(path: Path2D): void;585  drawFocusIfNeeded(element: Element): void;586  drawFocusIfNeeded(path: Path2D, element: Element): void;587  scrollPathIntoView(): void;588  scrollPathIntoView(path: Path2D): void;589  clip(fillRule?: CanvasFillRule): void;590  clip(path: Path2D, fillRule?: CanvasFillRule): void;591  resetClip(): void;592  isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean;593  isPointInPath(594    path: Path2D,595    x: number,596    y: number,597    fillRule?: CanvasFillRule598  ): boolean;599  isPointInStroke(x: number, y: number): boolean;600  isPointInStroke(path: Path2D, x: number, y: number): boolean;601602  // text (see also the CanvasDrawingStyles interface)603  fillText(text: string, x: number, y: number, maxWidth?: number): void;604  strokeText(text: string, x: number, y: number, maxWidth?: number): void;605  measureText(text: string): TextMetrics;606607  // drawing images608  drawImage(image: CanvasImageSource, dx: number, dy: number): void;609  drawImage(610    image: CanvasImageSource,611    dx: number,612    dy: number,613    dw: number,614    dh: number615  ): void;616  drawImage(617    image: CanvasImageSource,618    sx: number,619    sy: number,620    sw: number,621    sh: number,622    dx: number,623    dy: number,624    dw: number,625    dh: number626  ): void;627628  // hit regions629  addHitRegion(options?: HitRegionOptions): void;630  removeHitRegion(id: string): void;631  clearHitRegions(): void;632633  // pixel manipulation634  createImageData(sw: number, sh: number): ImageData;635  createImageData(imagedata: ImageData): ImageData;636  getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;637  putImageData(imagedata: ImageData, dx: number, dy: number): void;638  putImageData(639    imagedata: ImageData,640    dx: number,641    dy: number,642    dirtyX: number,643    dirtyY: number,644    dirtyWidth: number,645    dirtyHeight: number646  ): void;647648  // CanvasDrawingStyles649  // line caps/joins650  lineWidth: number;651  lineCap: string;652  lineJoin: string;653  miterLimit: number;654655  // dashed lines656  setLineDash(segments: Array<number>): void;657  getLineDash(): Array<number>;658  lineDashOffset: number;659660  // text661  font: string;662  textAlign: string;663  textBaseline: string;664  direction: string;665666  // CanvasPathMethods667  // shared path API methods668  closePath(): void;669  moveTo(x: number, y: number): void;670  lineTo(x: number, y: number): void;671  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;672  bezierCurveTo(673    cp1x: number,674    cp1y: number,675    cp2x: number,676    cp2y: number,677    x: number,678    y: number679  ): void;680  arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;681  arcTo(682    x1: number,683    y1: number,684    x2: number,685    y2: number,686    radiusX: number,687    radiusY: number,688    rotation: number689  ): void;690  rect(x: number, y: number, w: number, h: number): void;691  arc(692    x: number,693    y: number,694    radius: number,695    startAngle: number,696    endAngle: number,697    anticlockwise?: boolean698  ): void;699  ellipse(700    x: number,701    y: number,702    radiusX: number,703    radiusY: number,704    rotation: number,705    startAngle: number,706    endAngle: number,707    anticlockwise?: boolean708  ): void;709}710711// http://www.w3.org/TR/html5/scripting-1.html#renderingcontext712type RenderingContext = CanvasRenderingContext2D | WebGLRenderingContext;713714// https://www.w3.org/TR/html5/scripting-1.html#htmlcanvaselement715declare class HTMLCanvasElement extends HTMLElement {716  tagName: 'CANVAS';717  width: number;718  height: number;719  getContext(contextId: '2d', ...args: any): CanvasRenderingContext2D;720  getContext(721    contextId: 'webgl',722    contextAttributes?: Partial<WebGLContextAttributes>723  ): ?WebGLRenderingContext;724  // IE currently only supports "experimental-webgl"725  getContext(726    contextId: 'experimental-webgl',727    contextAttributes?: Partial<WebGLContextAttributes>728  ): ?WebGLRenderingContext;729  getContext(contextId: string, ...args: any): ?RenderingContext; // fallback730  toDataURL(type?: string, ...args: any): string;731  toBlob(callback: (v: File) => void, type?: string, ...args: any): void;732  captureStream(frameRate?: number): CanvasCaptureMediaStream;733}734735// https://html.spec.whatwg.org/multipage/forms.html#the-details-element736declare class HTMLDetailsElement extends HTMLElement {737  tagName: 'DETAILS';738  open: boolean;739}740741declare class HTMLFormElement extends HTMLElement {742  tagName: 'FORM';743  @@iterator(): Iterator<HTMLElement>;744  [index: number | string]: HTMLElement | null;745  acceptCharset: string;746  action: string;747  elements: HTMLCollection<HTMLElement>;748  encoding: string;749  enctype: string;750  length: number;751  method: string;752  name: string;753  rel: string;754  target: string;755756  checkValidity(): boolean;757  reportValidity(): boolean;758  reset(): void;759  submit(): void;760}761762// https://www.w3.org/TR/html5/forms.html#the-fieldset-element763declare class HTMLFieldSetElement extends HTMLElement {764  tagName: 'FIELDSET';765  disabled: boolean;766  elements: HTMLCollection<HTMLElement>; // readonly767  form: HTMLFormElement | null; // readonly768  name: string;769  type: string; // readonly770771  checkValidity(): boolean;772  setCustomValidity(error: string): void;773}774775declare class HTMLLegendElement extends HTMLElement {776  tagName: 'LEGEND';777  form: HTMLFormElement | null; // readonly778}779780declare class HTMLIFrameElement extends HTMLElement {781  tagName: 'IFRAME';782  allowFullScreen: boolean;783  contentDocument: Document;784  contentWindow: any;785  frameBorder: string;786  height: string;787  marginHeight: string;788  marginWidth: string;789  name: string;790  scrolling: string;791  sandbox: DOMTokenList;792  src: string;793  // flowlint unsafe-getters-setters:off794  get srcdoc(): string;795  set srcdoc(value: string | TrustedHTML): void;796  // flowlint unsafe-getters-setters:error797  width: string;798}799800declare class HTMLImageElement extends HTMLElement {801  tagName: 'IMG';802  alt: string;803  complete: boolean; // readonly804  crossOrigin: ?string;805  currentSrc: string; // readonly806  height: number;807  decode(): Promise<void>;808  isMap: boolean;809  naturalHeight: number; // readonly810  naturalWidth: number; // readonly811  sizes: string;812  src: string;813  srcset: string;814  useMap: string;815  width: number;816}817818declare class Image extends HTMLImageElement {819  constructor(width?: number, height?: number): void;820}821822declare class MediaError {823  MEDIA_ERR_ABORTED: number;824  MEDIA_ERR_NETWORK: number;825  MEDIA_ERR_DECODE: number;826  MEDIA_ERR_SRC_NOT_SUPPORTED: number;827  code: number;828  message: ?string;829}830831declare class TimeRanges {832  length: number;833  start(index: number): number;834  end(index: number): number;835}836837declare class Audio extends HTMLAudioElement {838  constructor(URLString?: string): void;839}840841declare class AudioTrack {842  id: string;843  kind: string;844  label: string;845  language: string;846  enabled: boolean;847}848849declare class AudioTrackList extends EventTarget {850  length: number;851  [index: number]: AudioTrack;852853  getTrackById(id: string): ?AudioTrack;854855  onchange: (ev: any) => any;856  onaddtrack: (ev: any) => any;857  onremovetrack: (ev: any) => any;858}859860declare class VideoTrack {861  id: string;862  kind: string;863  label: string;864  language: string;865  selected: boolean;866}867868declare class VideoTrackList extends EventTarget {869  length: number;870  [index: number]: VideoTrack;871  getTrackById(id: string): ?VideoTrack;872  selectedIndex: number;873874  onchange: (ev: any) => any;875  onaddtrack: (ev: any) => any;876  onremovetrack: (ev: any) => any;877}878879declare class TextTrackCue extends EventTarget {880  constructor(startTime: number, endTime: number, text: string): void;881882  track: TextTrack;883  id: string;884  startTime: number;885  endTime: number;886  pauseOnExit: boolean;887  vertical: string;888  snapToLines: boolean;889  lines: number;890  position: number;891  size: number;892  align: string;893  text: string;894895  getCueAsHTML(): Node;896  onenter: (ev: any) => any;897  onexit: (ev: any) => any;898}899900declare class TextTrackCueList {901  @@iterator(): Iterator<TextTrackCue>;902  length: number;903  [index: number]: TextTrackCue;904  getCueById(id: string): ?TextTrackCue;905}906907declare class TextTrack extends EventTarget {908  kind: string;909  label: string;910  language: string;911912  mode: string;913914  cues: TextTrackCueList;915  activeCues: TextTrackCueList;916917  addCue(cue: TextTrackCue): void;918  removeCue(cue: TextTrackCue): void;919920  oncuechange: (ev: any) => any;921}922923declare class TextTrackList extends EventTarget {924  length: number;925  [index: number]: TextTrack;926927  onaddtrack: (ev: any) => any;928  onremovetrack: (ev: any) => any;929}930931declare class HTMLMediaElement extends HTMLElement {932  // error state933  error: ?MediaError;934935  // network state936  src: string;937  srcObject: ?any;938  currentSrc: string;939  crossOrigin: ?string;940  NETWORK_EMPTY: number;941  NETWORK_IDLE: number;942  NETWORK_LOADING: number;943  NETWORK_NO_SOURCE: number;944  networkState: number;945  preload: string;946  buffered: TimeRanges;947  load(): void;948  canPlayType(type: string): string;949950  // ready state951  HAVE_NOTHING: number;952  HAVE_METADATA: number;953  HAVE_CURRENT_DATA: number;954  HAVE_FUTURE_DATA: number;955  HAVE_ENOUGH_DATA: number;956  readyState: number;957  seeking: boolean;958959  // playback state960  currentTime: number;961  duration: number;962  startDate: Date;963  paused: boolean;964  defaultPlaybackRate: number;965  playbackRate: number;966  played: TimeRanges;967  seekable: TimeRanges;968  ended: boolean;969  autoplay: boolean;970  loop: boolean;971  play(): Promise<void>;972  pause(): void;973  fastSeek(): void;974  captureStream(): MediaStream;975976  // media controller977  mediaGroup: string;978  controller: ?any;979980  // controls981  controls: boolean;982  volume: number;983  muted: boolean;984  defaultMuted: boolean;985  controlsList?: DOMTokenList;986987  // tracks988  audioTracks: AudioTrackList;989  videoTracks: VideoTrackList;990  textTracks: TextTrackList;991  addTextTrack(kind: string, label?: string, language?: string): TextTrack;992993  // media keys994  mediaKeys?: ?MediaKeys;995  setMediakeys?: (mediakeys: ?MediaKeys) => Promise<?MediaKeys>;996}997998declare class HTMLAudioElement extends HTMLMediaElement {999  tagName: 'AUDIO';1000}10011002declare class HTMLVideoElement extends HTMLMediaElement {1003  tagName: 'VIDEO';1004  width: number;1005  height: number;1006  videoWidth: number;1007  videoHeight: number;1008  poster: string;1009}10101011declare class HTMLSourceElement extends HTMLElement {1012  tagName: 'SOURCE';1013  src: string;1014  type: string;10151016  //when used with the picture element1017  srcset: string;1018  sizes: string;1019  media: string;1020}10211022declare class ValidityState {1023  badInput: boolean;1024  customError: boolean;1025  patternMismatch: boolean;1026  rangeOverflow: boolean;1027  rangeUnderflow: boolean;1028  stepMismatch: boolean;1029  tooLong: boolean;1030  tooShort: boolean;1031  typeMismatch: boolean;1032  valueMissing: boolean;1033  valid: boolean;1034}10351036// https://w3c.github.io/html/sec-forms.html#dom-selectionapielements-setselectionrange1037type SelectionDirection = 'backward' | 'forward' | 'none';1038type SelectionMode = 'select' | 'start' | 'end' | 'preserve';1039declare class HTMLInputElement extends HTMLElement {1040  tagName: 'INPUT';1041  accept: string;1042  align: string;1043  alt: string;1044  autocomplete: string;1045  autofocus: boolean;1046  border: string;1047  checked: boolean;1048  complete: boolean;1049  defaultChecked: boolean;1050  defaultValue: string;1051  dirname: string;1052  disabled: boolean;1053  dynsrc: string;1054  files: FileList;1055  form: HTMLFormElement | null;1056  formAction: string;1057  formEncType: string;1058  formMethod: string;1059  formNoValidate: boolean;1060  formTarget: string;1061  height: string;1062  hspace: number;1063  indeterminate: boolean;1064  labels: NodeList<HTMLLabelElement>;1065  list: HTMLElement | null;1066  loop: number;1067  lowsrc: string;1068  max: string;1069  maxLength: number;1070  min: string;1071  multiple: boolean;1072  name: string;1073  pattern: string;1074  placeholder: string;1075  readOnly: boolean;1076  required: boolean;1077  selectionDirection: SelectionDirection;1078  selectionEnd: number;1079  selectionStart: number;1080  size: number;1081  src: string;1082  start: string;1083  status: boolean;1084  step: string;1085  type: string;1086  useMap: string;1087  validationMessage: string;1088  validity: ValidityState;1089  value: string;1090  valueAsDate: Date;1091  valueAsNumber: number;1092  vrml: string;1093  vspace: number;1094  width: string;1095  willValidate: boolean;1096  popoverTargetElement: Element | null;1097  popoverTargetAction: 'toggle' | 'show' | 'hide';10981099  checkValidity(): boolean;1100  reportValidity(): boolean;1101  setCustomValidity(error: string): void;1102  createTextRange(): TextRange;1103  select(): void;1104  setRangeText(1105    replacement: string,1106    start?: void,1107    end?: void,1108    selectMode?: void1109  ): void;1110  setRangeText(1111    replacement: string,1112    start: number,1113    end: number,1114    selectMode?: SelectionMode1115  ): void;1116  setSelectionRange(1117    start: number,1118    end: number,1119    direction?: SelectionDirection1120  ): void;1121  showPicker(): void;1122  stepDown(stepDecrement?: number): void;1123  stepUp(stepIncrement?: number): void;1124}11251126declare class HTMLButtonElement extends HTMLElement {1127  tagName: 'BUTTON';1128  autofocus: boolean;1129  disabled: boolean;1130  form: HTMLFormElement | null;1131  labels: NodeList<HTMLLabelElement> | null;1132  name: string;1133  type: string;1134  validationMessage: string;1135  validity: ValidityState;1136  value: string;1137  willValidate: boolean;11381139  checkValidity(): boolean;1140  reportValidity(): boolean;1141  setCustomValidity(error: string): void;1142  popoverTargetElement: Element | null;1143  popoverTargetAction: 'toggle' | 'show' | 'hide';1144}11451146// https://w3c.github.io/html/sec-forms.html#the-textarea-element1147declare class HTMLTextAreaElement extends HTMLElement {1148  tagName: 'TEXTAREA';1149  autofocus: boolean;1150  cols: number;1151  dirName: string;1152  disabled: boolean;1153  form: HTMLFormElement | null;1154  maxLength: number;1155  name: string;1156  placeholder: string;1157  readOnly: boolean;1158  required: boolean;1159  rows: number;1160  wrap: string;11611162  type: string;1163  defaultValue: string;1164  value: string;1165  textLength: number;11661167  willValidate: boolean;1168  validity: ValidityState;1169  validationMessage: string;1170  checkValidity(): boolean;1171  setCustomValidity(error: string): void;11721173  labels: NodeList<HTMLLabelElement>;11741175  select(): void;1176  selectionStart: number;1177  selectionEnd: number;1178  selectionDirection: SelectionDirection;1179  setSelectionRange(1180    start: number,1181    end: number,1182    direction?: SelectionDirection1183  ): void;1184}11851186declare class HTMLSelectElement extends HTMLElement {1187  tagName: 'SELECT';1188  autocomplete: string;1189  autofocus: boolean;1190  disabled: boolean;1191  form: HTMLFormElement | null;1192  labels: NodeList<HTMLLabelElement>;1193  length: number;1194  multiple: boolean;1195  name: string;1196  options: HTMLOptionsCollection;1197  required: boolean;1198  selectedIndex: number;1199  selectedOptions: HTMLCollection<HTMLOptionElement>;1200  size: number;1201  type: string;1202  validationMessage: string;1203  validity: ValidityState;1204  value: string;1205  willValidate: boolean;12061207  add(element: HTMLElement, before?: HTMLElement): void;1208  checkValidity(): boolean;1209  item(index: number): HTMLOptionElement | null;1210  namedItem(name: string): HTMLOptionElement | null;1211  remove(index?: number): void;1212  setCustomValidity(error: string): void;1213}12141215declare class HTMLOptionsCollection extends HTMLCollection<HTMLOptionElement> {1216  selectedIndex: number;1217  add(1218    element: HTMLOptionElement | HTMLOptGroupElement,1219    before?: HTMLElement | number1220  ): void;1221  remove(index: number): void;1222}12231224declare class HTMLOptionElement extends HTMLElement {1225  tagName: 'OPTION';1226  defaultSelected: boolean;1227  disabled: boolean;1228  form: HTMLFormElement | null;1229  index: number;1230  label: string;1231  selected: boolean;1232  text: string;1233  value: string;1234}12351236declare class HTMLOptGroupElement extends HTMLElement {1237  tagName: 'OPTGROUP';1238  disabled: boolean;1239  label: string;1240}12411242declare class HTMLAnchorElement extends HTMLElement {1243  tagName: 'A';1244  charset: string;1245  coords: string;1246  download: string;1247  hash: string;1248  host: string;1249  hostname: string;1250  href: string;1251  hreflang: string;1252  media: string;1253  name: string;1254  origin: string;1255  password: string;1256  pathname: string;1257  port: string;1258  protocol: string;1259  rel: string;1260  rev: string;1261  search: string;1262  shape: string;1263  target: string;1264  text: string;1265  type: string;1266  username: string;1267}12681269// https://w3c.github.io/html/sec-forms.html#the-label-element1270declare class HTMLLabelElement extends HTMLElement {1271  tagName: 'LABEL';1272  form: HTMLFormElement | null;1273  htmlFor: string;1274  control: HTMLElement | null;1275}12761277declare class HTMLLinkElement extends HTMLElement {1278  tagName: 'LINK';1279  crossOrigin: ?('anonymous' | 'use-credentials');1280  href: string;1281  hreflang: string;1282  media: string;1283  rel: string;1284  sizes: DOMTokenList;1285  type: string;1286  as: string;1287}12881289declare class HTMLScriptElement extends HTMLElement {1290  tagName: 'SCRIPT';1291  async: boolean;1292  charset: string;1293  crossOrigin?: string;1294  defer: boolean;1295  // flowlint unsafe-getters-setters:off1296  get src(): string;1297  set src(value: string | TrustedScriptURL): void;1298  get text(): string;1299  set text(value: string | TrustedScript): void;1300  // flowlint unsafe-getters-setters:error1301  type: string;1302}13031304declare class HTMLStyleElement extends HTMLElement {1305  tagName: 'STYLE';1306  disabled: boolean;1307  media: string;1308  scoped: boolean;1309  sheet: ?CSSStyleSheet;1310  type: string;1311}13121313declare class HTMLParagraphElement extends HTMLElement {1314  tagName: 'P';1315  align: 'left' | 'center' | 'right' | 'justify'; // deprecated in HTML 4.011316}13171318declare class HTMLHtmlElement extends HTMLElement {1319  tagName: 'HTML';1320}13211322declare class HTMLBodyElement extends HTMLElement {1323  tagName: 'BODY';1324}13251326declare class HTMLHeadElement extends HTMLElement {1327  tagName: 'HEAD';1328}13291330declare class HTMLDivElement extends HTMLElement {1331  tagName: 'DIV';1332}13331334declare class HTMLSpanElement extends HTMLElement {1335  tagName: 'SPAN';1336}13371338declare class HTMLAppletElement extends HTMLElement {}13391340declare class HTMLHeadingElement extends HTMLElement {1341  tagName: 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6';1342}13431344declare class HTMLHRElement extends HTMLElement {1345  tagName: 'HR';1346}13471348declare class HTMLBRElement extends HTMLElement {1349  tagName: 'BR';1350}13511352declare class HTMLDListElement extends HTMLElement {1353  tagName: 'DL';1354}13551356declare class HTMLAreaElement extends HTMLElement {1357  tagName: 'AREA';1358  alt: string;1359  coords: string;1360  shape: string;1361  target: string;1362  download: string;1363  ping: string;1364  rel: string;1365  relList: DOMTokenList;1366  referrerPolicy: string;1367}13681369declare class HTMLDataElement extends HTMLElement {1370  tagName: 'DATA';1371  value: string;1372}13731374declare class HTMLDataListElement extends HTMLElement {1375  tagName: 'DATALIST';1376  options: HTMLCollection<HTMLOptionElement>;1377}13781379declare class HTMLDialogElement extends HTMLElement {1380  tagName: 'DIALOG';1381  open: boolean;1382  returnValue: string;1383  show(): void;1384  showModal(): void;1385  close(returnValue: ?string): void;1386}13871388declare class HTMLEmbedElement extends HTMLElement {1389  tagName: 'EMBED';1390  src: string;1391  type: string;1392  width: string;1393  height: string;1394  getSVGDocument(): ?Document;1395}13961397declare class HTMLMapElement extends HTMLElement {1398  tagName: 'MAP';1399  areas: HTMLCollection<HTMLAreaElement>;1400  images: HTMLCollection<HTMLImageElement>;1401  name: string;1402}14031404declare class HTMLMeterElement extends HTMLElement {1405  tagName: 'METER';1406  high: number;1407  low: number;1408  max: number;1409  min: number;1410  optimum: number;1411  value: number;1412  labels: NodeList<HTMLLabelElement>;1413}14141415declare class HTMLModElement extends HTMLElement {1416  tagName: 'DEL' | 'INS';1417  cite: string;1418  dateTime: string;1419}14201421declare class HTMLObjectElement extends HTMLElement {1422  tagName: 'OBJECT';1423  contentDocument: ?Document;1424  contentWindow: ?WindowProxy;1425  data: string;1426  form: ?HTMLFormElement;1427  height: string;1428  name: string;1429  type: string;1430  typeMustMatch: boolean;1431  useMap: string;1432  validationMessage: string;1433  validity: ValidityState;1434  width: string;1435  willValidate: boolean;1436  checkValidity(): boolean;1437  getSVGDocument(): ?Document;1438  reportValidity(): boolean;1439  setCustomValidity(error: string): void;1440}14411442declare class HTMLOutputElement extends HTMLElement {1443  defaultValue: string;1444  form: ?HTMLFormElement;1445  htmlFor: DOMTokenList;1446  labels: NodeList<HTMLLabelElement>;1447  name: string;1448  type: string;1449  validationMessage: string;1450  validity: ValidityState;1451  value: string;1452  willValidate: boolean;1453  checkValidity(): boolean;1454  reportValidity(): boolean;1455  setCustomValidity(error: string): void;1456}14571458declare class HTMLParamElement extends HTMLElement {1459  tagName: 'PARAM';1460  name: string;1461  value: string;1462}14631464declare class HTMLProgressElement extends HTMLElement {1465  tagName: 'PROGRESS';1466  labels: NodeList<HTMLLabelElement>;1467  max: number;1468  position: number;1469  value: number;1470}14711472declare class HTMLPictureElement extends HTMLElement {1473  tagName: 'PICTURE';1474}14751476declare class HTMLTimeElement extends HTMLElement {1477  tagName: 'TIME';1478  dateTime: string;1479}14801481declare class HTMLTitleElement extends HTMLElement {1482  tagName: 'TITLE';1483  text: string;1484}14851486declare class HTMLTrackElement extends HTMLElement {1487  tagName: 'TRACK';1488  static NONE: 0;1489  static LOADING: 1;1490  static LOADED: 2;1491  static ERROR: 3;14921493  default: boolean;1494  kind: string;1495  label: string;1496  readyState: 0 | 1 | 2 | 3;1497  src: string;1498  srclang: string;1499  track: TextTrack;1500}15011502declare class HTMLQuoteElement extends HTMLElement {1503  tagName: 'BLOCKQUOTE' | 'Q';1504  cite: string;1505}15061507declare class HTMLOListElement extends HTMLElement {1508  tagName: 'OL';1509  reversed: boolean;1510  start: number;1511  type: string;1512}15131514declare class HTMLUListElement extends HTMLElement {1515  tagName: 'UL';1516}15171518declare class HTMLLIElement extends HTMLElement {1519  tagName: 'LI';1520  value: number;1521}15221523declare class HTMLPreElement extends HTMLElement {1524  tagName: 'PRE';1525}15261527declare class HTMLMetaElement extends HTMLElement {1528  tagName: 'META';1529  content: string;1530  httpEquiv: string;1531  name: string;1532}15331534declare class HTMLUnknownElement extends HTMLElement {}15351536declare class Storage {1537  length: number;1538  getItem(key: string): ?string;1539  setItem(key: string, data: string): void;1540  clear(): void;1541  removeItem(key: string): void;1542  key(index: number): ?string;1543  [name: string]: ?string;1544}15451546/* window */15471548declare type WindowProxy = any;1549declare function alert(message?: any): void;1550declare function prompt(message?: any, value?: any): string;1551declare function close(): void;1552declare function confirm(message?: string): boolean;1553declare function getComputedStyle(1554  elt: Element,1555  pseudoElt?: string1556): CSSStyleDeclaration;1557declare opaque type AnimationFrameID;1558declare function requestAnimationFrame(1559  callback: (timestamp: number) => void1560): AnimationFrameID;1561declare function cancelAnimationFrame(requestId: AnimationFrameID): void;1562declare opaque type IdleCallbackID;1563declare function requestIdleCallback(1564  cb: (deadline: {1565    didTimeout: boolean,1566    timeRemaining: () => number,1567    ...1568  }) => void,1569  opts?: {timeout: number, ...}1570): IdleCallbackID;1571declare function cancelIdleCallback(id: IdleCallbackID): void;1572declare var localStorage: Storage;1573declare var devicePixelRatio: number;1574declare function focus(): void;1575declare function onfocus(ev: Event): any;1576declare function open(1577  url?: string,1578  target?: string,1579  features?: string,1580  replace?: boolean1581): any;1582declare var parent: WindowProxy;1583declare function print(): void;1584declare var self: any;1585declare var sessionStorage: Storage;1586declare var top: WindowProxy;1587declare function getSelection(): Selection | null;1588declare var customElements: CustomElementRegistry;1589declare function scroll(x: number, y: number): void;1590declare function scroll(options: ScrollToOptions): void;1591declare function scrollTo(x: number, y: number): void;1592declare function scrollTo(options: ScrollToOptions): void;1593declare function scrollBy(x: number, y: number): void;1594declare function scrollBy(options: ScrollToOptions): void;15951596type HTMLElementTagNameMap = {1597  a: HTMLAnchorElement,1598  abbr: HTMLElement,1599  address: HTMLElement,1600  area: HTMLAreaElement,1601  article: HTMLElement,1602  aside: HTMLElement,1603  audio: HTMLAudioElement,1604  b: HTMLElement,1605  base: HTMLBaseElement,1606  bdi: HTMLElement,1607  bdo: HTMLElement,1608  blockquote: HTMLQuoteElement,1609  body: HTMLBodyElement,1610  br: HTMLBRElement,1611  button: HTMLButtonElement,1612  canvas: HTMLCanvasElement,1613  caption: HTMLTableCaptionElement,1614  cite: HTMLElement,1615  code: HTMLElement,1616  col: HTMLTableColElement,1617  colgroup: HTMLTableColElement,1618  data: HTMLDataElement,1619  datalist: HTMLDataListElement,1620  dd: HTMLElement,1621  del: HTMLModElement,1622  details: HTMLDetailsElement,1623  dfn: HTMLElement,1624  dialog: HTMLDialogElement,1625  div: HTMLDivElement,1626  dl: HTMLDListElement,1627  dt: HTMLElement,1628  em: HTMLElement,1629  embed: HTMLEmbedElement,1630  fieldset: HTMLFieldSetElement,1631  figcaption: HTMLElement,1632  figure: HTMLElement,1633  footer: HTMLElement,1634  form: HTMLFormElement,1635  h1: HTMLHeadingElement,1636  h2: HTMLHeadingElement,1637  h3: HTMLHeadingElement,1638  h4: HTMLHeadingElement,1639  h5: HTMLHeadingElement,1640  h6: HTMLHeadingElement,1641  head: HTMLHeadElement,1642  header: HTMLElement,1643  hgroup: HTMLElement,1644  hr: HTMLHRElement,1645  html: HTMLHtmlElement,1646  i: HTMLElement,1647  iframe: HTMLIFrameElement,1648  img: HTMLImageElement,1649  input: HTMLInputElement,1650  ins: HTMLModElement,1651  kbd: HTMLElement,1652  label: HTMLLabelElement,1653  legend: HTMLLegendElement,1654  li: HTMLLIElement,1655  link: HTMLLinkElement,1656  main: HTMLElement,1657  map: HTMLMapElement,1658  mark: HTMLElement,1659  menu: HTMLMenuElement,1660  meta: HTMLMetaElement,1661  meter: HTMLMeterElement,1662  nav: HTMLElement,1663  noscript: HTMLElement,1664  object: HTMLObjectElement,1665  ol: HTMLOListElement,1666  optgroup: HTMLOptGroupElement,1667  option: HTMLOptionElement,1668  output: HTMLOutputElement,1669  p: HTMLParagraphElement,1670  picture: HTMLPictureElement,1671  pre: HTMLPreElement,1672  progress: HTMLProgressElement,1673  q: HTMLQuoteElement,1674  rp: HTMLElement,1675  rt: HTMLElement,1676  ruby: HTMLElement,1677  s: HTMLElement,1678  samp: HTMLElement,1679  script: HTMLScriptElement,1680  search: HTMLElement,1681  section: HTMLElement,1682  select: HTMLSelectElement,1683  slot: HTMLSlotElement,1684  small: HTMLElement,1685  source: HTMLSourceElement,1686  span: HTMLSpanElement,1687  strong: HTMLElement,1688  style: HTMLStyleElement,1689  sub: HTMLElement,1690  summary: HTMLElement,1691  sup: HTMLElement,1692  table: HTMLTableElement,1693  tbody: HTMLTableSectionElement,1694  td: HTMLTableCellElement,1695  template: HTMLTemplateElement,1696  textarea: HTMLTextAreaElement,1697  tfoot: HTMLTableSectionElement,1698  th: HTMLTableCellElement,1699  thead: HTMLTableSectionElement,1700  time: HTMLTimeElement,1701  title: HTMLTitleElement,1702  tr: HTMLTableRowElement,1703  track: HTMLTrackElement,1704  u: HTMLElement,1705  ul: HTMLUListElement,1706  var: HTMLElement,1707  video: HTMLVideoElement,1708  wbr: HTMLElement,1709  [string]: Element,1710};

Code quality findings 8

Ensure try blocks have corresponding catch or finally blocks
info correctness try-without-catch
declare interface CustomElementRegistry {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
declare var localStorage: Storage;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
declare var devicePixelRatio: number;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
declare var parent: WindowProxy;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
declare var self: any;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
declare var sessionStorage: Storage;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
declare var top: WindowProxy;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
declare var customElements: CustomElementRegistry;

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.