mirror of
https://github.com/pyscript/pyscript.git
synced 2026-05-20 12:00:18 -04:00
Fix typo in py-events attributes handling (#1458)
This commit is contained in:
committed by
GitHub
parent
a2dabee0e9
commit
73e0271c23
@@ -130,14 +130,14 @@ export function make_PyScript(interpreter: InterpreterClient, app: PyScriptApp)
|
||||
for (const { type, target, attributeName, addedNodes } of records) {
|
||||
if (type === 'attributes') {
|
||||
// consider only py-* attributes
|
||||
if (type.startsWith('py-')) {
|
||||
if (attributeName.startsWith('py-')) {
|
||||
// if the attribute is currently present
|
||||
if ((target as Element).hasAttribute(attributeName)) {
|
||||
// handle the element
|
||||
addPyScriptEventListener(
|
||||
getInterpreter(target as Element),
|
||||
target as Element,
|
||||
type.slice(3),
|
||||
attributeName.slice(3),
|
||||
);
|
||||
} else {
|
||||
// remove the listener because the element should not answer
|
||||
@@ -145,7 +145,7 @@ export function make_PyScript(interpreter: InterpreterClient, app: PyScriptApp)
|
||||
|
||||
// Note: this is *NOT* a misused-promise, this is how async events work.
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
target.removeEventListener(type.slice(3), pyScriptListener);
|
||||
target.removeEventListener(attributeName.slice(3), pyScriptListener);
|
||||
}
|
||||
}
|
||||
// skip further loop on empty addedNodes
|
||||
|
||||
Reference in New Issue
Block a user