diff --git a/docs/changelog.md b/docs/changelog.md index 9b16e347..7e59ae71 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -27,6 +27,7 @@ Documentation - Fixed 'Direct usage of document is deprecated' warning in the getting started guide. ([#1052](https://github.com/pyscript/pyscript/pull/1052)) - Added reference documentation for the `py-splashscreen` plugin ([#1138](https://github.com/pyscript/pyscript/pull/1138)) - Adds doc for installing tests ([#1156](https://github.com/pyscript/pyscript/pull/1156)) +- Adds docs for custom Pyscript attributes (`py-*`) that allow you to add event listeners to an element ([#1125](https://github.com/pyscript/pyscript/pull/1125)) Deprecations and Removals ------------------------- diff --git a/docs/reference/API/attr_to_event.md b/docs/reference/API/attr_to_event.md new file mode 100644 index 00000000..5f026c38 --- /dev/null +++ b/docs/reference/API/attr_to_event.md @@ -0,0 +1,87 @@ +# List of PyScript Attributes to Events: + +PyScript provides a convenient syntax for mapping JavaScript events to PyScript events, making it easy to connect events to HTML tags. + +For example, you can use the following code to connect the click event to a button: + +``` + +``` + +Here is a list of all the available event mappings: + +| PyScript Event Name | DOM Event Name | +|-------------------|----------------| +| py-onClick | click | +| py-onKeyDown | keydown | +| py-afterprint | afterprint | +| py-beforeprint | beforeprint | +| py-beforeunload | beforeunload | +| py-error | error | +| py-hashchange | hashchange | +| py-load | load | +| py-message | message | +| py-offline | offline | +| py-online | online | +| py-pagehide | pagehide | +| py-pageshow | pageshow | +| py-popstate | popstate | +| py-resize | resize | +| py-storage | storage | +| py-unload | unload | +| py-blur | blur | +| py-change | change | +| py-contextmenu | contextmenu | +| py-focus | focus | +| py-input | input | +| py-invalid | invalid | +| py-reset | reset | +| py-search | search | +| py-select | select | +| py-submit | submit | +| py-keydown | keydown | +| py-keypress | keypress | +| py-keyup | keyup | +| py-click | click | +| py-dblclick | dblclick | +| py-mousedown | mousedown | +| py-mousemove | mousemove | +| py-mouseout | mouseout | +| py-mouseover | mouseover | +| py-mouseup | mouseup | +| py-mousewheel | mousewheel | +| py-wheel | wheel | +| py-drag | drag | +| py-dragend | dragend | +| py-dragenter | dragenter | +| py-dragleave | dragleave | +| py-dragover | dragover | +| py-dragstart | dragstart | +| py-drop | drop | +| py-scroll | scroll | +| py-copy | copy | +| py-cut | cut | +| py-paste | paste | +| py-abort | abort | +| py-canplay | canplay | +| py-canplaythrough | canplaythrough | +| py-cuechange | cuechange | +| py-durationchange | durationchange | +| py-emptied | emptied | +| py-ended | ended | +| py-loadeddata | loadeddata | +| py-loadedmetadata | loadedmetadata | +| py-loadstart | loadstart | +| py-pause | pause | +| py-play | play | +| py-playing | playing | +| py-progress | progress | +| py-ratechange | ratechange | +| py-seeked | seeked | +| py-seeking | seeking | +| py-stalled | stalled | +| py-suspend | suspend | +| py-timeupdate | timeupdate | +| py-volumechange | volumechange | +| py-waiting | waiting | +| py-toggle | toggle |