remove pys-on* and py-on* attributes (#1361)

* remove pys-on* and py-on* attributes

* update changelog

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix eslint

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Madhur Tandon
2023-04-11 18:59:42 +05:30
committed by GitHub
parent f3db6a339c
commit e3602f464b
13 changed files with 29 additions and 97 deletions

View File

@@ -77,3 +77,4 @@ Deprecations and Removals
- The py-config `runtimes` to specify an interpreter has been deprecated. The `interpreters` config should be used instead. ([#1082](https://github.com/pyscript/pyscript/pull/1082))
- The attributes `pys-onClick` and `pys-onKeyDown` have been deprecated, but the warning was only shown in the console. An alert banner will now be shown on the page if the attributes are used. They will be removed in the next release. ([#1084](https://github.com/pyscript/pyscript/pull/1084))
- The pyscript elements `py-button`, `py-inputbox`, `py-box` and `py-title` have now completed their deprecation cycle and have been removed. ([#1084](https://github.com/pyscript/pyscript/pull/1084))
- The attributes `pys-onClick` and `pys-onKeyDown` have been removed. Use `py-click` and `py-keydown` instead ([#1361](https://github.com/pyscript/pyscript/pull/1361))

View File

@@ -5,15 +5,13 @@ PyScript provides a convenient syntax for mapping JavaScript events to PyScript
For example, you can use the following code to connect the click event to a button:
```
<button id="py-click" py-onClick="foo()">Click me</button>
<button id="py-click" py-click="foo()">Click me</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 |

View File

@@ -35,7 +35,7 @@ Display will throw an exception if the target is not clear. E.g. the following c
# from event handlers
display('hello')
</py-script>
<button id="my-button" py-onClick="display_hello()">Click me</button>
<button id="my-button" py-click="display_hello()">Click me</button>
```
Because it's considered unclear if the `hello` string should be displayed underneath the `<py-script>` tag or the `<button>` tag.
@@ -49,7 +49,7 @@ To write compliant code, make sure to specify the target using the `target` para
display('hello', target="helloDiv")
</py-script>
<div id="helloDiv"></div>
<button id="my-button" py-onClick="display_hello()">Click me</button>
<button id="my-button" py-click="display_hello()">Click me</button>
```
#### Using matplotlib with display