Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2021-03

Error attributes to Event: TJSMouseEvent;

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to cbsistem
cbsistem wrote 6 lines
Event: TJSMouseEvent; Event.target['data'] error is not converted correctly Event.targe.getAttribute('data')

Fixed, thanks for pointing it out.

Michael.

Reply by email

cbsistem
to Michael Van Canneyt

my verion of trunk Pas2JS Compiler version 2.1.1 [2021/03/22] for Linux x86_64

//this event is NEVER RUN, even if it is linked Link.onclick: = @
DoLinkClick;
-------------------------------------------------------------------------------------------------------------------
function TDemoForm.DoLinkClick(aEvent: TJSMouseEvent): boolean;
begin
  Router.Push(string(aEvent.target['href']));  // not executed
end;

-----
Cristiano Barbosa

Reply by email

Michael Van Canneyt
to cbsistem
cbsistem wrote 14 lines
my verion of trunk Pas2JS Compiler version 2.1.1 [2021/03/22] for Linux x86_64 //this event is NEVER RUN, even if it is linked Link.onclick: = @ DoLinkClick; ------------------------------------------------------------------------------------------------------------------- function TDemoForm.DoLinkClick(aEvent: TJSMouseEvent): boolean; begin Router.Push(string(aEvent.target['href'])); // not executed end;

It is executed here.

But the logic in that routine was wrong of course, only the part after the # should be used.

To show that it is actually the event that does the routing (which is actually not needed for the <a href=""> tag) I added a preventDefault and some logging.

Michael.

Reply by email