[Pas2js] missing definitions

warleyalex warleyalex at yahoo.com.br
Fri Aug 30 13:41:13 CEST 2019


// Test case

(* Inject some Google fonts via: http://www.google.com/fonts/
  The fonts are hosted at Google and you link them in the HTML header.
  Then, you can use them freely in CSS
*)

procedure InjectFontLink(const url: string);
var
  el: TJSHTMLLinkElement;
begin
  el :=
TJSHTMLLinkElement(TJSHTMLElement(window.document.createElement('link')));
  el.rel := 'stylesheet';
  el._type := 'text/css';
  el.href := url;
 
TJSHTMLElement(window.document.getElementsByTagName('head')[0]).appendChild(el);
end;

InjectFontLink('https://fonts.googleapis.com/css?family=Rancho&effect=shadow-multiple');

(...)
then in you HTML

<div class="font-effect-shadow-multiple">This is a font effect!<div>
-----
There is a minor type at the 'HTMLScriptElement' definition >> type_ :
String; anyway.

type
  TJSHTMLScriptElement = class external name
'HTMLScriptElement'(TJSHTMLElement)
  private
    fsrc: string; external name 'src';
    ftype: string; external name 'type';
    fnoModule: boolean; external name 'noModule';
    fasync: boolean; external name 'async';
    fdefer: boolean; external name 'defer';
    fcrossOrigin: string; external name 'crossOrigin';
    ftext: string; external name 'text';
    fcharset: string; external name 'charset';
    fintegrity: string; external name 'integrity';
    freferrerPolicy: string; external name 'referrerPolicy';
  public
    property src: string read fsrc write fsrc;
    property _type: string read ftype write ftype;
    property noModule: boolean read fnoModule write fnoModule;
    property async: boolean read fasync write fasync;
    property defer: boolean read fdefer write fdefer;
    property crossOrigin: string read fcrossOrigin write fcrossOrigin;
    property text: string read ftext write ftext;
    property charset: string read fcharset write fcharset;
    property integrity: string read fintegrity write fintegrity;
    property referrerPolicy: string read freferrerPolicy write
freferrerPolicy;
  end;


  {A DOMSettableTokenList object is equivalent to a DOMTokenList object
without
  an associated attribute.}
type
  TJSDOMSettableTokenList = class external name 'DOMSettableTokenList'
(TJSDOMTokenList)
  private
    fvalue: TJSDOMString; external name 'value';
  public
    property value: TJSDOMString read fvalue; // readonly
  end;

type
  TJSHTMLLinkElement = class external name 'HTMLLinkElement'(TJSHTMLElement)   
  private
    fhref: string; external name 'href';
    fcrossOrigin: string; external name 'crossOrigin';
    frel: string; external name 'rel';
    fas: string; external name 'as';
    fmedia: string; external name 'media';
    fintegrity: string; external name 'integrity';
    fhreflang: string; external name 'hreflang';
    ftype: string; external name 'type';
    fimageSrcset: string; external name 'imageSrcset';
    fimageSizes: string; external name 'imageSizes';
    freferrerPolicy: string; external name 'referrerPolicy';
    fdisabled: string; external name 'disabled';
    frelList: TJSDOMTokenList; external name 'relList';
    fsizes: TJSDOMSettableTokenList{TJSDOMTokenList}; external name 'sizes';
    fcharset: string; external name 'charset'; // obsolete property
    frev: string; external name 'rev'; // obsolete property
    ftarget: string; external name 'target'; // obsolete property
  public
    property href: string read fhref write fhref;
    property crossOrigin: string read fcrossOrigin write fcrossOrigin;
    property rel: string read frel write frel;
    property _as: string read fas write fas;
    property media: string read fmedia write fmedia;
    property integrity: string read fintegrity write fintegrity;
    property hreflang: string read fhreflang write fhreflang;
    property _type: string read ftype write ftype;
    property imageSrcset: string read fimageSrcset write fimageSrcset;
    property imageSizes: string read fimageSizes write fimageSizes;
    property referrerPolicy: string read freferrerPolicy write
freferrerPolicy;
    property disabled: string read fdisabled write fdisabled;
    property relList: TJSDOMTokenList read frelList;
    property sizes: TJSDOMSettableTokenList{TJSDOMTokenList} read fsizes;
    property charset: string read fcharset write fcharset; // obsolete
property
    property rev: string read frev write frev; // obsolete property
    property target: string read ftarget write ftarget; // obsolete property
  end;          





--
Sent from: http://pas2js.38893.n8.nabble.com/


More information about the Pas2js mailing list