# HG changeset patch # User Edouard Tisserant # Date 1657274290 -7200 # Node ID 4ee33be5b8b6f65b900467f7c5f8b53bf020db79 # Parent 770fcb344f505dccbe8cd017d1f2ce550cbc949a SVGHMI: fix js exception because of trying to find already detached elements by id. diff -r 770fcb344f50 -r 4ee33be5b8b6 svghmi/widget_input.ysl2 --- a/svghmi/widget_input.ysl2 Wed Jul 06 10:39:11 2022 +0200 +++ b/svghmi/widget_input.ysl2 Fri Jul 08 11:58:10 2022 +0200 @@ -65,6 +65,8 @@ const "have_edit","string-length($edit_elt)>0"; value "$edit_elt"; + const "action_elements", "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]"; + if "$have_value" | frequency: 5, | dispatch: function(value) { @@ -94,6 +96,9 @@ | }, } + foreach "$action_elements" { + | action_elt_«position()»: id("«@id»"), + } | init: function() { if "$have_edit" { @@ -104,8 +109,8 @@ | this.animate(); } - foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" { - | id("«@id»").onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»"); + foreach "$action_elements" { + | this.action_elt_«position()».onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»"); } if "$have_value" {