[Pas2js] move property style to TJSElement :: feature request

Michael Van Canneyt michael at freepascal.org
Fri Nov 2 17:42:00 CET 2018



On Fri, 2 Nov 2018, warleyalex via Pas2js wrote:

> Sorry for this feature request.
>
>    property Handle: TJSHTMLElement read FHandle write FHandle; 
>
>    I forgot I can cast the variable to TJSElement
>    TJSElement(FHandle) := document.createElement('div');

Or
   FHandle := TJSHTMLElement(document.createElement('div'));

Or better yet, create a function

   function CreateHTMLElement(aTag : String) : TJSHTMLElement;

   begin
     Result:=TJSHTMLElement(document.createElement(aTag));
   end;

And use only that:

FHandle:=CreateHTMLElement('div');

Most likely, one day "inline" will appear and there should be no performance penalty.

Michael.



More information about the Pas2js mailing list