Error codesEvents

onDocument or onWindow names an event that never gets there

MARKLESS_GLOBAL_EVENT_UNKNOWNerrorMarkless raises it while it builds your .tsrx files.

The message

MARKLESS_GLOBAL_EVENT_UNKNOWN: <attributeName> on <<tagName>> listens for "<type>" on the <target>, but the <target> never receives a "<type>" event: either no such event exists, or it fires on an element without bubbling up.
onDocument* and onWindow* listen on the <target> itself. An event that does not bubble, such as focus or mouseenter, never reaches it, so the handler would never run.
bubbles
https://markless.dev/errors/MARKLESS_GLOBAL_EVENT_UNKNOWN

Words in angle brackets change from case to case.

Why

onDocument… listens on the document and onWindow… on the window. Some events fire on one element and do not bubble up, such as focus, mouseenter or a video's play, so a listener on the document never hears them. Others exist only on the window, such as resize, or the name is not an event at all.

Fix

The error names the prop to write when there is one: the bubbling form on the same target (onDocumentFocusIn for onDocumentFocus, onDocumentPointerOver for onDocumentPointerEnter), or the same event on the other target (onWindowResize for onDocumentResize). For an event on one element, put an ordinary on… prop on that element.

Before

import { state } from '@markless/core';export function Search() @{	let focused = state(false);	<form onDocumentFocus={() => (focused = true)}>{focused}</form>}

After

<form onDocumentFocusIn={() => (focused = true)}>{focused}</form>
Where Markless raises it

All error codes

Button sounds are from Josh Comeau's Button Sounds library.