htmldoc.pp 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1998 by Michael Van Canneyt, member of
  5. the Free Pascal development team
  6. Implementation of a HTMLdocument class,
  7. following the W3 recommendation.
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. unit htmldoc;
  15. interface
  16. Uses Sysutils, // Uppercase
  17. Classes, // TList and the like
  18. DOM; // Naturally...
  19. { ---------------------------------------------------------------------
  20. Forward Class definitions
  21. ---------------------------------------------------------------------}
  22. Type
  23. THTMLCollection = Class;
  24. THTMLDocument = Class;
  25. THTMLElement = Class;
  26. THTMLHtmlElement = Class;
  27. THTMLHeadElement = Class;
  28. THTMLLinkElement = Class;
  29. THTMLTitleElement = Class;
  30. THTMLMetaElement = Class;
  31. THTMLBaseElement = Class;
  32. THTMLIsIndexElement = Class;
  33. THTMLStyleElement = Class;
  34. THTMLBodyElement = Class;
  35. THTMLFormElement = Class;
  36. THTMLTableSectionElement = Class;
  37. { ---------------------------------------------------------------------
  38. Miscellaneous objects
  39. ---------------------------------------------------------------------}
  40. // HTMLCollection
  41. THTMLCollection = Class
  42. Private
  43. Flist : TList;
  44. Function GetLength : longword;
  45. Public
  46. Constructor Create;
  47. Destructor Destroy; Override;
  48. Function Item(Index : longword) : TDOMNode;
  49. Function NamedItem(Name : DomString) : TDOMNode;
  50. Property Length : LongWord Read GetLength;
  51. end;
  52. { ---------------------------------------------------------------------
  53. THTMLDocument class
  54. ---------------------------------------------------------------------}
  55. THTMLDocument = Class(TDOMDocument)
  56. Private
  57. FTitle,
  58. FReferrer,
  59. FDomain,
  60. FCookie,
  61. FURL : DOMString;
  62. FBody : THTMLElement;
  63. FImages,
  64. FApplets,
  65. FLinks,
  66. FForms,
  67. Fanchors : THTMLCollection;
  68. Public
  69. Constructor Create; Override;
  70. Destructor Destroy; Override;
  71. Procedure Open;
  72. Procedure Close;
  73. Procedure Write (TheText : DOMString);
  74. Procedure Writeln (TheText : DOMString);
  75. Function GetElementById (Id :longword) : TDOMElement;
  76. Function GetElementByName (Name : DOMString) : TDOMNodeList;
  77. Property Title : DOMString Read FTitle Write FTitle;
  78. Property Referrer : DOMString Read FReferrer;
  79. Property Domain : DOMString Read FDomain;
  80. Property URL : DOMString Read FURL;
  81. Property Body : THTMLElement Read FBody;
  82. Property Images : THTMLCollection Read Fimages;
  83. Property Applets : THTMLCollection Read FApplets;
  84. Property Links : THTMLCollection Read FLinks;
  85. Property Forms : THTMLCollection Read FForms;
  86. Property Anchors : THTMLCollection Read Fanchors;
  87. Property Cookie : DOMString Read FCookie;
  88. end;
  89. { ---------------------------------------------------------------------
  90. THTMLElement class
  91. ---------------------------------------------------------------------}
  92. THTMLElement = Class(TDOMElement)
  93. Private
  94. FID,
  95. FTitle,
  96. FLang,
  97. FDir,
  98. FHTMLClassname : DOMString;
  99. Public
  100. Property ID : DOMString Read FID Write FID;
  101. Property Title : DOMString Read FTitle Write FTitle;
  102. Property Lang : DOMString Read FLang Write FLang;
  103. Property Dir : DOMString Read FDir Write FDir;
  104. Property HTMLClassName : DOMString Read FHTMLClassName Write FHTMLClassName;
  105. end;
  106. { ---------------------------------------------------------------------
  107. THTMLElement descendent classes
  108. ---------------------------------------------------------------------}
  109. THTMLHtmlElement = Class(THTMLElement)
  110. Private
  111. FVersion : DOMString;
  112. Public
  113. Property Version : DOMString Read FVersion Write FVersion;
  114. end;
  115. THTMLHeadElement = Class(THTMLElement)
  116. Private
  117. FProfile : DOMString;
  118. Public
  119. Property Profile : DOMString Read FProfile Write FProfile;
  120. end;
  121. THTMLLinkElement = Class(THTMLElement)
  122. Private
  123. FDisabled : Boolean;
  124. FCharset,
  125. FHREF,
  126. FHREFLang,
  127. FMedia,
  128. FRel,
  129. FREV,
  130. FTarget,
  131. FHTMLType : DOMString;
  132. Public
  133. Property Disabled : Boolean Read FDisabled Write FDisabled;
  134. Property Charset : DOMString Read FCharset Write FCharset;
  135. Property HREF : DOMString Read FHREF Write FHREF;
  136. Property HREFLang : DOMString Read FHREFLang Write FHREFLang;
  137. Property Media : DOMString Read FMEdia Write FMedia;
  138. Property Rel : DOMString READ FRel Write FRel;
  139. Property Target : DOMString Read FTarget Write FTarget;
  140. Property HTMLType : DOMString Read FHTMLType Write FHTMLtype;
  141. end;
  142. THTMLTitleElement = Class(THTMLElement)
  143. Private
  144. FHTMLtext : DOMString;
  145. Public
  146. Property HTMLText : DOMString Read FHTMLText Write FHTMLtext;
  147. end;
  148. THTMLMetaElement = Class(THTMLElement)
  149. Private
  150. FContent,
  151. FhttpEquiv,
  152. FName,
  153. FScheme : DOMString;
  154. Public
  155. Property Content : DOMString Read FContent Write FContent;
  156. Property HttpEquiv : DOMString Read FHTTPEquiv Write FHTTPEquiv;
  157. Property Name : DOMString Read FName Write FName;
  158. Property Scheme : DOMString Read FScheme Write FScheme;
  159. end;
  160. THTMLBaseElement = Class(TDOMElement)
  161. Private
  162. FHref,
  163. FTarget : DOMString;
  164. Public
  165. Property HRef : DOMString Read FHref Write FHRef;
  166. Property Target : DOMstring Read FTarget Write FTarget;
  167. end;
  168. THTMLIsIndexElement = Class(THTMLElement)
  169. Private
  170. FForm : THTMLFormElement;
  171. FPrompt : DomString;
  172. Public
  173. Property Form : THTMLFormElement Read FForm;
  174. Property Prompt : DOMString Read FPrompt Write FPrompt;
  175. end;
  176. THTMLStyleElement = Class(THTMLElement)
  177. Private
  178. FDisabled : Boolean;
  179. FMEdia,
  180. FHTMLtype : DOMString;
  181. Public
  182. Property Disabled : Boolean Read FDisabled Write FDisabled;
  183. Property HTMLtype : DOMString Read FHTMLType Write FHTMLtype;
  184. end;
  185. THTMLBodyElement = Class(THTMLElement)
  186. Private
  187. Falink,
  188. Fbackground,
  189. Fbgcolor,
  190. flink,
  191. fhtmltext,
  192. fvlink : DOMString;
  193. Public
  194. Property alink : DOMString Read falink write falink;
  195. Property background : DOMString Read Fbackground write FBackground;
  196. Property bgcolor : DOMString Read fbgcolor write fbgcolor;
  197. Property link : DOMString Read Flink Write flink;
  198. Property htmltext : DOMString read fhtmltext Write fhtmltext;
  199. Property vlink : DOMString Read fvLink Write fvLink ;
  200. end;
  201. THTMLAnchorElement = Class(THTMLElement)
  202. Private
  203. FaccessKey : DOMString;
  204. Fcharset : DOMString;
  205. Fcoords : DOMString;
  206. Fhref : DOMString;
  207. Fhreflang : DOMString;
  208. Fname : DOMString;
  209. Frel : DOMString;
  210. Frev : DOMString;
  211. Fshape : DOMString;
  212. FtabIndex : longint;
  213. Ftarget : DOMString;
  214. Ftype : DOMString;
  215. Public
  216. Procedure blur;
  217. Procedure focus;
  218. Property accessKey : DOMString Read FaccessKey Write FaccessKey;
  219. Property charset : DOMString Read Fcharset Write Fcharset;
  220. Property coords : DOMString Read Fcoords Write Fcoords;
  221. Property href : DOMString Read Fhref Write Fhref;
  222. Property hreflang : DOMString Read Fhreflang Write Fhreflang;
  223. Property name : DOMString Read Fname Write Fname;
  224. Property rel : DOMString Read Frel Write Frel;
  225. Property rev : DOMString Read Frev Write Frev;
  226. Property shape : DOMString Read Fshape Write Fshape;
  227. Property tabIndex : longint Read FtabIndex Write FtabIndex;
  228. Property target : DOMString Read Ftarget Write Ftarget;
  229. Property htmltype : DOMString Read Ftype Write Ftype;
  230. End;
  231. THTMLAppletElement = Class(THTMLElement)
  232. Private
  233. Falign : DOMString;
  234. Falt : DOMString;
  235. Farchive : DOMString;
  236. Fcode : DOMString;
  237. FcodeBase : DOMString;
  238. Fheight : DOMString;
  239. Fhspace : DOMString;
  240. Fname : DOMString;
  241. Fobject : DOMString;
  242. Fvspace : DOMString;
  243. Fwidth : DOMString;
  244. Public
  245. Property align : DOMString Read Falign Write Falign;
  246. Property alt : DOMString Read Falt Write Falt;
  247. Property archive : DOMString Read Farchive Write Farchive;
  248. Property code : DOMString Read Fcode Write Fcode;
  249. Property codeBase : DOMString Read FcodeBase Write FcodeBase;
  250. Property height : DOMString Read Fheight Write Fheight;
  251. Property hspace : DOMString Read Fhspace Write Fhspace;
  252. Property name : DOMString Read Fname Write Fname;
  253. Property htmlobject : DOMString Read Fobject Write Fobject;
  254. Property vspace : DOMString Read Fvspace Write Fvspace;
  255. Property width : DOMString Read Fwidth Write Fwidth;
  256. End;
  257. THTMLAreaElement = Class(THTMLElement)
  258. Private
  259. FaccessKey : DOMString;
  260. Falt : DOMString;
  261. Fcoords : DOMString;
  262. Fhref : DOMString;
  263. FnoHref : boolean;
  264. Fshape : DOMString;
  265. FtabIndex : longint;
  266. Ftarget : DOMString;
  267. Public
  268. Property accessKey : DOMString Read FaccessKey Write FaccessKey;
  269. Property alt : DOMString Read Falt Write Falt;
  270. Property coords : DOMString Read Fcoords Write Fcoords;
  271. Property href : DOMString Read Fhref Write Fhref;
  272. Property noHref : boolean Read FnoHref Write FnoHref;
  273. Property shape : DOMString Read Fshape Write Fshape;
  274. Property tabIndex : longint Read FtabIndex Write FtabIndex;
  275. Property target : DOMString Read Ftarget Write Ftarget;
  276. End;
  277. THTMLBaseFontElement = Class(THTMLElement)
  278. Private
  279. Fcolor : DOMString;
  280. Fface : DOMString;
  281. Fsize : DOMString;
  282. Public
  283. Property color : DOMString Read Fcolor Write Fcolor;
  284. Property face : DOMString Read Fface Write Fface;
  285. Property size : DOMString Read Fsize Write Fsize;
  286. End;
  287. THTMLBlockquoteElement = Class(THTMLElement)
  288. Private
  289. Fcite : DOMString;
  290. Public
  291. Property cite : DOMString Read Fcite Write Fcite;
  292. End;
  293. THTMLBRElement = Class(THTMLElement)
  294. Private
  295. Fclear : DOMString;
  296. Public
  297. Property clear : DOMString Read Fclear Write Fclear;
  298. End;
  299. THTMLButtonElement = Class(THTMLElement)
  300. Private
  301. Fform : THTMLFormElement;
  302. FaccessKey : DOMString;
  303. Fdisabled : boolean;
  304. Fname : DOMString;
  305. FtabIndex : longint;
  306. Ftype : DOMString;
  307. Fvalue : DOMString;
  308. Public
  309. Property form : THTMLFormElement Read Fform;
  310. Property accessKey : DOMString Read FaccessKey Write FaccessKey;
  311. Property disabled : boolean Read Fdisabled Write Fdisabled;
  312. Property name : DOMString Read Fname Write Fname;
  313. Property tabIndex : longint Read FtabIndex Write FtabIndex;
  314. Property htmltype : DOMString Read Ftype;
  315. Property value : DOMString Read Fvalue Write Fvalue;
  316. End;
  317. THTMLDirectoryElement = Class(THTMLElement)
  318. Private
  319. Fcompact : boolean;
  320. Public
  321. Property compact : boolean Read Fcompact Write Fcompact;
  322. End;
  323. THTMLDivElement = Class(THTMLElement)
  324. Private
  325. Falign : DOMString;
  326. Public
  327. Property align : DOMString Read Falign Write Falign;
  328. End;
  329. THTMLDListElement = Class(THTMLElement)
  330. Private
  331. Fcompact : boolean;
  332. Public
  333. Property compact : boolean Read Fcompact Write Fcompact;
  334. End;
  335. THTMLFieldSetElement = Class(THTMLElement)
  336. Private
  337. Fform : THTMLFormElement;
  338. Public
  339. Property form : THTMLFormElement Read Fform;
  340. End;
  341. THTMLFontElement = Class(THTMLElement)
  342. Private
  343. Fcolor : DOMString;
  344. Fface : DOMString;
  345. Fsize : DOMString;
  346. Public
  347. Property color : DOMString Read Fcolor Write Fcolor;
  348. Property face : DOMString Read Fface Write Fface;
  349. Property size : DOMString Read Fsize Write Fsize;
  350. End;
  351. THTMLFormElement = Class(THTMLElement)
  352. Private
  353. Felements : THTMLCollection;
  354. Flength : longint;
  355. Fname : DOMString;
  356. FacceptCharset : DOMString;
  357. Faction : DOMString;
  358. Fenctype : DOMString;
  359. Fmethod : DOMString;
  360. Ftarget : DOMString;
  361. Public
  362. Constructor Create(AOwner : TDOMDocument);override;
  363. Destructor Destroy;override;
  364. Procedure submit;
  365. Procedure reset;
  366. Property elements : THTMLCollection Read Felements;
  367. Property length : longint Read Flength;
  368. Property name : DOMString Read Fname Write Fname;
  369. Property acceptCharset : DOMString Read FacceptCharset Write FacceptCharset;
  370. Property action : DOMString Read Faction Write Faction;
  371. Property enctype : DOMString Read Fenctype Write Fenctype;
  372. Property method : DOMString Read Fmethod Write Fmethod;
  373. Property target : DOMString Read Ftarget Write Ftarget;
  374. End;
  375. THTMLFrameElement = Class(THTMLElement)
  376. Private
  377. FframeBorder : DOMString;
  378. FlongDesc : DOMString;
  379. FmarginHeight : DOMString;
  380. FmarginWidth : DOMString;
  381. Fname : DOMString;
  382. FnoResize : boolean;
  383. Fscrolling : DOMString;
  384. Fsrc : DOMString;
  385. Public
  386. Property frameBorder : DOMString Read FframeBorder Write FframeBorder;
  387. Property longDesc : DOMString Read FlongDesc Write FlongDesc;
  388. Property marginHeight : DOMString Read FmarginHeight Write FmarginHeight;
  389. Property marginWidth : DOMString Read FmarginWidth Write FmarginWidth;
  390. Property name : DOMString Read Fname Write Fname;
  391. Property noResize : boolean Read FnoResize Write FnoResize;
  392. Property scrolling : DOMString Read Fscrolling Write Fscrolling;
  393. Property src : DOMString Read Fsrc Write Fsrc;
  394. End;
  395. THTMLFrameSetElement = Class(THTMLElement)
  396. Private
  397. Fcols : DOMString;
  398. Frows : DOMString;
  399. Public
  400. Property cols : DOMString Read Fcols Write Fcols;
  401. Property rows : DOMString Read Frows Write Frows;
  402. End;
  403. THTMLHeadingElement = Class(THTMLElement)
  404. Private
  405. Falign : DOMString;
  406. Public
  407. Property align : DOMString Read Falign Write Falign;
  408. End;
  409. THTMLHRElement = Class(THTMLElement)
  410. Private
  411. Falign : DOMString;
  412. FnoShade : boolean;
  413. Fsize : DOMString;
  414. Fwidth : DOMString;
  415. Public
  416. Property align : DOMString Read Falign Write Falign;
  417. Property noShade : boolean Read FnoShade Write FnoShade;
  418. Property size : DOMString Read Fsize Write Fsize;
  419. Property width : DOMString Read Fwidth Write Fwidth;
  420. End;
  421. THTMLIFrameElement = Class(THTMLElement)
  422. Private
  423. Falign : DOMString;
  424. FframeBorder : DOMString;
  425. Fheight : DOMString;
  426. FlongDesc : DOMString;
  427. FmarginHeight : DOMString;
  428. FmarginWidth : DOMString;
  429. Fname : DOMString;
  430. Fscrolling : DOMString;
  431. Fsrc : DOMString;
  432. Fwidth : DOMString;
  433. Public
  434. Property align : DOMString Read Falign Write Falign;
  435. Property frameBorder : DOMString Read FframeBorder Write FframeBorder;
  436. Property height : DOMString Read Fheight Write Fheight;
  437. Property longDesc : DOMString Read FlongDesc Write FlongDesc;
  438. Property marginHeight : DOMString Read FmarginHeight Write FmarginHeight;
  439. Property marginWidth : DOMString Read FmarginWidth Write FmarginWidth;
  440. Property name : DOMString Read Fname Write Fname;
  441. Property scrolling : DOMString Read Fscrolling Write Fscrolling;
  442. Property src : DOMString Read Fsrc Write Fsrc;
  443. Property width : DOMString Read Fwidth Write Fwidth;
  444. End;
  445. THTMLImageElement = Class(THTMLElement)
  446. Private
  447. FlowSrc : DOMString;
  448. Fname : DOMString;
  449. Falign : DOMString;
  450. Falt : DOMString;
  451. Fborder : DOMString;
  452. Fheight : DOMString;
  453. Fhspace : DOMString;
  454. FisMap : boolean;
  455. FlongDesc : DOMString;
  456. Fsrc : DOMString;
  457. FuseMap : DOMString;
  458. Fvspace : DOMString;
  459. Fwidth : DOMString;
  460. Public
  461. Property lowSrc : DOMString Read FlowSrc Write FlowSrc;
  462. Property name : DOMString Read Fname Write Fname;
  463. Property align : DOMString Read Falign Write Falign;
  464. Property alt : DOMString Read Falt Write Falt;
  465. Property border : DOMString Read Fborder Write Fborder;
  466. Property height : DOMString Read Fheight Write Fheight;
  467. Property hspace : DOMString Read Fhspace Write Fhspace;
  468. Property isMap : boolean Read FisMap Write FisMap;
  469. Property longDesc : DOMString Read FlongDesc Write FlongDesc;
  470. Property src : DOMString Read Fsrc Write Fsrc;
  471. Property useMap : DOMString Read FuseMap Write FuseMap;
  472. Property vspace : DOMString Read Fvspace Write Fvspace;
  473. Property width : DOMString Read Fwidth Write Fwidth;
  474. End;
  475. THTMLInputElement = Class(THTMLElement)
  476. Private
  477. FdefaultValue : DOMString;
  478. FdefaultChecked : boolean;
  479. Fform : THTMLFormElement;
  480. Faccept : DOMString;
  481. FaccessKey : DOMString;
  482. Falign : DOMString;
  483. Falt : DOMString;
  484. Fchecked : boolean;
  485. Fdisabled : boolean;
  486. FmaxLength : longint;
  487. Fname : DOMString;
  488. FreadOnly : boolean;
  489. Fsize : DOMString;
  490. Fsrc : DOMString;
  491. FtabIndex : longint;
  492. Ftype : DOMString;
  493. FuseMap : DOMString;
  494. Fvalue : DOMString;
  495. Public
  496. Procedure blur;
  497. Procedure focus;
  498. Procedure select;
  499. Procedure click;
  500. Property defaultValue : DOMString Read FdefaultValue Write FdefaultValue;
  501. Property defaultChecked : boolean Read FdefaultChecked Write FdefaultChecked;
  502. Property form : THTMLFormElement Read Fform;
  503. Property accept : DOMString Read Faccept Write Faccept;
  504. Property accessKey : DOMString Read FaccessKey Write FaccessKey;
  505. Property align : DOMString Read Falign Write Falign;
  506. Property alt : DOMString Read Falt Write Falt;
  507. Property checked : boolean Read Fchecked Write Fchecked;
  508. Property disabled : boolean Read Fdisabled Write Fdisabled;
  509. Property maxLength : longint Read FmaxLength Write FmaxLength;
  510. Property name : DOMString Read Fname Write Fname;
  511. Property readOnly : boolean Read FreadOnly Write FreadOnly;
  512. Property size : DOMString Read Fsize Write Fsize;
  513. Property src : DOMString Read Fsrc Write Fsrc;
  514. Property tabIndex : longint Read FtabIndex Write FtabIndex;
  515. Property htmltype : DOMString Read Ftype;
  516. Property useMap : DOMString Read FuseMap Write FuseMap;
  517. Property value : DOMString Read Fvalue Write Fvalue;
  518. End;
  519. THTMLLabelElement = Class(THTMLElement)
  520. Private
  521. Fform : THTMLFormElement;
  522. FaccessKey : DOMString;
  523. FhtmlFor : DOMString;
  524. Public
  525. Property form : THTMLFormElement Read Fform;
  526. Property accessKey : DOMString Read FaccessKey Write FaccessKey;
  527. Property htmlFor : DOMString Read FhtmlFor Write FhtmlFor;
  528. End;
  529. THTMLLegendElement = Class(THTMLElement)
  530. Private
  531. Fform : THTMLFormElement;
  532. FaccessKey : DOMString;
  533. Falign : DOMString;
  534. Public
  535. Property form : THTMLFormElement Read Fform;
  536. Property accessKey : DOMString Read FaccessKey Write FaccessKey;
  537. Property align : DOMString Read Falign Write Falign;
  538. End;
  539. THTMLLIElement = Class(THTMLElement)
  540. Private
  541. Ftype : DOMString;
  542. Fvalue : longint;
  543. Public
  544. Property htmltype : DOMString Read Ftype Write Ftype;
  545. Property value : longint Read Fvalue Write Fvalue;
  546. End;
  547. THTMLMapElement = Class(THTMLElement)
  548. Private
  549. Fareas : THTMLCollection;
  550. Fname : DOMString;
  551. Public
  552. Property areas : THTMLCollection Read Fareas;
  553. Property name : DOMString Read Fname Write Fname;
  554. End;
  555. THTMLMenuElement = Class(THTMLElement)
  556. Private
  557. Fcompact : boolean;
  558. Public
  559. Property compact : boolean Read Fcompact Write Fcompact;
  560. End;
  561. THTMLModElement = Class(THTMLElement)
  562. Private
  563. Fcite : DOMString;
  564. FdateTime : DOMString;
  565. Public
  566. Property cite : DOMString Read Fcite Write Fcite;
  567. Property dateTime : DOMString Read FdateTime Write FdateTime;
  568. End;
  569. THTMLObjectElement = Class(THTMLElement)
  570. Private
  571. Fform : THTMLFormElement;
  572. Fcode : DOMString;
  573. Falign : DOMString;
  574. Farchive : DOMString;
  575. Fborder : DOMString;
  576. FcodeBase : DOMString;
  577. FcodeType : DOMString;
  578. Fdata : DOMString;
  579. Fdeclare : boolean;
  580. Fheight : DOMString;
  581. Fhspace : DOMString;
  582. Fname : DOMString;
  583. Fstandby : DOMString;
  584. FtabIndex : longint;
  585. Ftype : DOMString;
  586. FuseMap : DOMString;
  587. Fvspace : DOMString;
  588. Fwidth : DOMString;
  589. Public
  590. Property form : THTMLFormElement Read Fform;
  591. Property code : DOMString Read Fcode Write Fcode;
  592. Property align : DOMString Read Falign Write Falign;
  593. Property archive : DOMString Read Farchive Write Farchive;
  594. Property border : DOMString Read Fborder Write Fborder;
  595. Property codeBase : DOMString Read FcodeBase Write FcodeBase;
  596. Property codeType : DOMString Read FcodeType Write FcodeType;
  597. Property data : DOMString Read Fdata Write Fdata;
  598. Property declare : boolean Read Fdeclare Write Fdeclare;
  599. Property height : DOMString Read Fheight Write Fheight;
  600. Property hspace : DOMString Read Fhspace Write Fhspace;
  601. Property name : DOMString Read Fname Write Fname;
  602. Property standby : DOMString Read Fstandby Write Fstandby;
  603. Property tabIndex : longint Read FtabIndex Write FtabIndex;
  604. Property htmltype : DOMString Read Ftype Write Ftype;
  605. Property useMap : DOMString Read FuseMap Write FuseMap;
  606. Property vspace : DOMString Read Fvspace Write Fvspace;
  607. Property width : DOMString Read Fwidth Write Fwidth;
  608. End;
  609. THTMLOListElement = Class(THTMLElement)
  610. Private
  611. Fcompact : boolean;
  612. Fstart : longint;
  613. Ftype : DOMString;
  614. Public
  615. Property compact : boolean Read Fcompact Write Fcompact;
  616. Property start : longint Read Fstart Write Fstart;
  617. Property htmltype : DOMString Read Ftype Write Ftype;
  618. End;
  619. THTMLOptGroupElement = Class(THTMLElement)
  620. Private
  621. Fdisabled : boolean;
  622. Flabel : DOMString;
  623. Public
  624. Property disabled : boolean Read Fdisabled Write Fdisabled;
  625. Property htmllabel : DOMString Read Flabel Write Flabel;
  626. End;
  627. THTMLOptionElement = Class(THTMLElement)
  628. Private
  629. Fform : THTMLFormElement;
  630. FdefaultSelected : boolean;
  631. Ftext : DOMString;
  632. Findex : longint;
  633. Fdisabled : boolean;
  634. Flabel : DOMString;
  635. Fselected : boolean;
  636. Fvalue : DOMString;
  637. Public
  638. Property form : THTMLFormElement Read Fform;
  639. Property defaultSelected : boolean Read FdefaultSelected Write FdefaultSelected;
  640. Property htmltext : DOMString Read Ftext;
  641. Property index : longint Read Findex Write Findex;
  642. Property disabled : boolean Read Fdisabled Write Fdisabled;
  643. Property htmllabel : DOMString Read Flabel Write Flabel;
  644. Property selected : boolean Read Fselected;
  645. Property value : DOMString Read Fvalue Write Fvalue;
  646. End;
  647. THTMLParagraphElement = Class(THTMLElement)
  648. Private
  649. Falign : DOMString;
  650. Public
  651. Property align : DOMString Read Falign Write Falign;
  652. End;
  653. THTMLParamElement = Class(THTMLElement)
  654. Private
  655. Fname : DOMString;
  656. Ftype : DOMString;
  657. Fvalue : DOMString;
  658. FvalueType : DOMString;
  659. Public
  660. Property name : DOMString Read Fname Write Fname;
  661. Property htmltype : DOMString Read Ftype Write Ftype;
  662. Property value : DOMString Read Fvalue Write Fvalue;
  663. Property valueType : DOMString Read FvalueType Write FvalueType;
  664. End;
  665. THTMLPreElement = Class(THTMLElement)
  666. Private
  667. Fwidth : longint;
  668. Public
  669. Property width : longint Read Fwidth Write Fwidth;
  670. End;
  671. THTMLQuoteElement = Class(THTMLElement)
  672. Private
  673. Fcite : DOMString;
  674. Public
  675. Property cite : DOMString Read Fcite Write Fcite;
  676. End;
  677. THTMLScriptElement = Class(THTMLElement)
  678. Private
  679. Ftext : DOMString;
  680. FhtmlFor : DOMString;
  681. Fevent : DOMString;
  682. Fcharset : DOMString;
  683. Fdefer : boolean;
  684. Fsrc : DOMString;
  685. Ftype : DOMString;
  686. Public
  687. Property htmltext : DOMString Read Ftext Write Ftext;
  688. Property htmlFor : DOMString Read FhtmlFor Write FhtmlFor;
  689. Property event : DOMString Read Fevent Write Fevent;
  690. Property charset : DOMString Read Fcharset Write Fcharset;
  691. Property defer : boolean Read Fdefer Write Fdefer;
  692. Property src : DOMString Read Fsrc Write Fsrc;
  693. Property htmltype : DOMString Read Ftype Write Ftype;
  694. End;
  695. THTMLSelectElement = Class(THTMLElement)
  696. Private
  697. Ftype : DOMString;
  698. FselectedIndex : longint;
  699. Fvalue : DOMString;
  700. Flength : longint;
  701. Fform : THTMLFormElement;
  702. Foptions : THTMLCollection;
  703. Fdisabled : boolean;
  704. Fmultiple : boolean;
  705. Fname : DOMString;
  706. Fsize : longint;
  707. FtabIndex : longint;
  708. Public
  709. Procedure add;
  710. Procedure remove;
  711. Procedure blur;
  712. Procedure focus;
  713. Property htmltype : DOMString Read Ftype;
  714. Property selectedIndex : longint Read FselectedIndex Write FselectedIndex;
  715. Property value : DOMString Read Fvalue Write Fvalue;
  716. Property length : longint Read Flength;
  717. Property form : THTMLFormElement Read Fform;
  718. Property options : THTMLCollection Read Foptions;
  719. Property disabled : boolean Read Fdisabled Write Fdisabled;
  720. Property multiple : boolean Read Fmultiple Write Fmultiple;
  721. Property name : DOMString Read Fname Write Fname;
  722. Property size : longint Read Fsize Write Fsize;
  723. Property tabIndex : longint Read FtabIndex Write FtabIndex;
  724. End;
  725. THTMLTableCaptionElement = Class(THTMLElement)
  726. Private
  727. Falign : DOMString;
  728. Public
  729. Property align : DOMString Read Falign Write Falign;
  730. End;
  731. THTMLTableCellElement = Class(THTMLElement)
  732. Private
  733. FcellIndex : longint;
  734. Fabbr : DOMString;
  735. Falign : DOMString;
  736. Faxis : DOMString;
  737. FbgColor : DOMString;
  738. Fch : DOMString;
  739. FchOff : DOMString;
  740. FcolSpan : longint;
  741. Fheaders : DOMString;
  742. Fheight : DOMString;
  743. FnoWrap : boolean;
  744. FrowSpan : longint;
  745. Fscope : DOMString;
  746. FvAlign : DOMString;
  747. Fwidth : DOMString;
  748. Public
  749. Property cellIndex : longint Read FcellIndex Write FcellIndex;
  750. Property abbr : DOMString Read Fabbr Write Fabbr;
  751. Property align : DOMString Read Falign Write Falign;
  752. Property axis : DOMString Read Faxis Write Faxis;
  753. Property bgColor : DOMString Read FbgColor Write FbgColor;
  754. Property ch : DOMString Read Fch Write Fch;
  755. Property chOff : DOMString Read FchOff Write FchOff;
  756. Property colSpan : longint Read FcolSpan Write FcolSpan;
  757. Property headers : DOMString Read Fheaders Write Fheaders;
  758. Property height : DOMString Read Fheight Write Fheight;
  759. Property noWrap : boolean Read FnoWrap Write FnoWrap;
  760. Property rowSpan : longint Read FrowSpan Write FrowSpan;
  761. Property scope : DOMString Read Fscope Write Fscope;
  762. Property vAlign : DOMString Read FvAlign Write FvAlign;
  763. Property width : DOMString Read Fwidth Write Fwidth;
  764. End;
  765. THTMLTableColElement = Class(THTMLElement)
  766. Private
  767. Falign : DOMString;
  768. Fch : DOMString;
  769. FchOff : DOMString;
  770. Fspan : longint;
  771. FvAlign : DOMString;
  772. Fwidth : DOMString;
  773. Public
  774. Property align : DOMString Read Falign Write Falign;
  775. Property ch : DOMString Read Fch Write Fch;
  776. Property chOff : DOMString Read FchOff Write FchOff;
  777. Property span : longint Read Fspan Write Fspan;
  778. Property vAlign : DOMString Read FvAlign Write FvAlign;
  779. Property width : DOMString Read Fwidth Write Fwidth;
  780. End;
  781. THTMLTableElement = Class(THTMLElement)
  782. Private
  783. Fcaption : THTMLTableCaptionElement;
  784. FtHead : THTMLTableSectionElement;
  785. FtFoot : THTMLTableSectionElement;
  786. Frows : THTMLCollection;
  787. FtBodies : THTMLCollection;
  788. Falign : DOMString;
  789. FbgColor : DOMString;
  790. Fborder : DOMString;
  791. FcellPadding : DOMString;
  792. FcellSpacing : DOMString;
  793. Fframe : DOMString;
  794. Frules : DOMString;
  795. Fsummary : DOMString;
  796. Fwidth : DOMString;
  797. Public
  798. Function createTHead : THTMLElement;
  799. Procedure deleteTHead;
  800. Function createTFoot : THTMLElement;
  801. Procedure deleteTFoot;
  802. Function createCaption : THTMLElement;
  803. Procedure deleteCaption;
  804. Function insertRow : THTMLElement;
  805. Procedure deleteRow;
  806. Property caption : THTMLTableCaptionElement Read Fcaption Write Fcaption;
  807. Property tHead : THTMLTableSectionElement Read FtHead Write FtHead;
  808. Property tFoot : THTMLTableSectionElement Read FtFoot Write FtFoot;
  809. Property rows : THTMLCollection Read Frows;
  810. Property tBodies : THTMLCollection Read FtBodies;
  811. Property align : DOMString Read Falign Write Falign;
  812. Property bgColor : DOMString Read FbgColor Write FbgColor;
  813. Property border : DOMString Read Fborder Write Fborder;
  814. Property cellPadding : DOMString Read FcellPadding Write FcellPadding;
  815. Property cellSpacing : DOMString Read FcellSpacing Write FcellSpacing;
  816. Property frame : DOMString Read Fframe Write Fframe;
  817. Property rules : DOMString Read Frules Write Frules;
  818. Property summary : DOMString Read Fsummary Write Fsummary;
  819. Property width : DOMString Read Fwidth Write Fwidth;
  820. End;
  821. THTMLTableRowElement = Class(THTMLElement)
  822. Private
  823. FrowIndex : longint;
  824. FsectionRowIndex : longint;
  825. Fcells : THTMLCollection;
  826. Falign : DOMString;
  827. FbgColor : DOMString;
  828. Fch : DOMString;
  829. FchOff : DOMString;
  830. FvAlign : DOMString;
  831. Public
  832. Function insertCell : THTMLElement;
  833. Procedure deleteCell;
  834. Property rowIndex : longint Read FrowIndex Write FrowIndex;
  835. Property sectionRowIndex : longint Read FsectionRowIndex Write FsectionRowIndex;
  836. Property cells : THTMLCollection Read Fcells Write Fcells;
  837. Property align : DOMString Read Falign Write Falign;
  838. Property bgColor : DOMString Read FbgColor Write FbgColor;
  839. Property ch : DOMString Read Fch Write Fch;
  840. Property chOff : DOMString Read FchOff Write FchOff;
  841. Property vAlign : DOMString Read FvAlign Write FvAlign;
  842. End;
  843. THTMLTableSectionElement = Class(THTMLElement)
  844. Private
  845. Falign : DOMString;
  846. Fch : DOMString;
  847. FchOff : DOMString;
  848. FvAlign : DOMString;
  849. Frows : THTMLCollection;
  850. Public
  851. Function insertRow : THTMLElement;
  852. Procedure deleteRow;
  853. Property align : DOMString Read Falign Write Falign;
  854. Property ch : DOMString Read Fch Write Fch;
  855. Property chOff : DOMString Read FchOff Write FchOff;
  856. Property vAlign : DOMString Read FvAlign Write FvAlign;
  857. Property rows : THTMLCollection Read Frows;
  858. End;
  859. THTMLTextAreaElement = Class(THTMLElement)
  860. Private
  861. FdefaultValue : DOMString;
  862. Fform : THTMLFormElement;
  863. FaccessKey : DOMString;
  864. Fcols : longint;
  865. Fdisabled : boolean;
  866. Fname : DOMString;
  867. FreadOnly : boolean;
  868. Frows : longint;
  869. FtabIndex : longint;
  870. Ftype : DOMString;
  871. Fvalue : DOMString;
  872. Public
  873. Procedure blur;
  874. Procedure focus;
  875. Procedure select;
  876. Property defaultValue : DOMString Read FdefaultValue Write FdefaultValue;
  877. Property form : THTMLFormElement Read Fform;
  878. Property accessKey : DOMString Read FaccessKey Write FaccessKey;
  879. Property cols : longint Read Fcols Write Fcols;
  880. Property disabled : boolean Read Fdisabled Write Fdisabled;
  881. Property name : DOMString Read Fname Write Fname;
  882. Property readOnly : boolean Read FreadOnly Write FreadOnly;
  883. Property rows : longint Read Frows Write Frows;
  884. Property tabIndex : longint Read FtabIndex Write FtabIndex;
  885. Property htmltype : DOMString Read Ftype;
  886. Property value : DOMString Read Fvalue Write Fvalue;
  887. End;
  888. THTMLUListElement = Class(THTMLElement)
  889. Private
  890. Fcompact : boolean;
  891. Ftype : DOMString;
  892. Public
  893. Property compact : boolean Read Fcompact Write Fcompact;
  894. Property htmltype : DOMString Read Ftype Write Ftype;
  895. End;
  896. implementation
  897. { ---------------------------------------------------------------------
  898. THTMLCollection
  899. ---------------------------------------------------------------------}
  900. Constructor THTMLCollection.Create;
  901. begin
  902. FList := TList.Create;
  903. end;
  904. Destructor THTMLCollection.Destroy;
  905. begin
  906. FList.Free;
  907. Inherited Destroy;
  908. end;
  909. Function THTMLCollection.GetLength : LongWord;
  910. begin
  911. Result:=FList.Count;
  912. end;
  913. Function THTMLCollection.Item(Index : longword) : TDOMNode;
  914. begin
  915. If (Index<0) or (Index>Flist.Count-1) then
  916. Result:=Nil
  917. else
  918. Result:=TDOMNode(Flist[Index]);
  919. end;
  920. Function THTMLCollection.NamedItem(Name : DomString) : TDOMNode;
  921. Var I : longword;
  922. begin
  923. Name:=UpperCase(Name);
  924. // linear search, since the list is not ordered.
  925. // W3 says nothing about ordering; maybe we can implement it ?
  926. For i:=0 to FList.Count-1 do
  927. If UpperCase(TDomNode(FList[i]).NodeName)=Name then
  928. begin
  929. Result:=TDomNode(Flist[I]);
  930. Exit;
  931. end;
  932. Result:=Nil;
  933. end;
  934. { ---------------------------------------------------------------------
  935. THTMLDocument class
  936. ---------------------------------------------------------------------}
  937. Constructor THTMLDocument.Create;
  938. begin
  939. Inherited Create;
  940. end;
  941. Destructor THTMLDocument.Destroy;
  942. begin
  943. Inherited Destroy;
  944. end;
  945. Procedure THTMLDocument.Open;
  946. begin
  947. end;
  948. Procedure THTMLDocument.Close;
  949. begin
  950. end;
  951. Procedure THTMLDocument.Write (TheText : DOMString);
  952. begin
  953. end;
  954. Procedure THTMLDocument.Writeln (TheText : DOMString);
  955. begin
  956. end;
  957. Function THTMLDocument.GetElementById (Id :longword) : TDOMElement;
  958. begin
  959. end;
  960. Function THTMLDocument.GetElementByName (Name : DOMString) : TDOMNodeList;
  961. begin
  962. end;
  963. Constructor THTMLFormElement.Create(AOwner : TDOMDocument);
  964. begin
  965. Inherited Create(AOWner);
  966. FElements:=THTMLCollection.Create;
  967. end;
  968. Destructor THTMLFormElement.Destroy;
  969. begin
  970. FElements.Free;
  971. Inherited Destroy;
  972. end;
  973. Procedure THTMLFormElement.Submit;
  974. begin
  975. end;
  976. Procedure THTMLFormElement.Reset;
  977. begin
  978. end;
  979. // Created From file htmlanchorelement.xml
  980. Procedure THTMLAnchorElement.blur;
  981. Begin
  982. End;
  983. Procedure THTMLAnchorElement.focus;
  984. Begin
  985. End;
  986. Procedure THTMLInputElement.blur;
  987. Begin
  988. End;
  989. Procedure THTMLInputElement.focus;
  990. Begin
  991. End;
  992. Procedure THTMLInputElement.select;
  993. Begin
  994. End;
  995. Procedure THTMLInputElement.click;
  996. Begin
  997. End;
  998. Procedure THTMLSelectElement.add;
  999. Begin
  1000. End;
  1001. Procedure THTMLSelectElement.remove;
  1002. Begin
  1003. End;
  1004. Procedure THTMLSelectElement.blur;
  1005. Begin
  1006. End;
  1007. Procedure THTMLSelectElement.focus;
  1008. Begin
  1009. End;
  1010. Function THTMLTableElement.createTHead : THTMLElement;
  1011. Begin
  1012. End;
  1013. Procedure THTMLTableElement.deleteTHead;
  1014. Begin
  1015. End;
  1016. Function THTMLTableElement.createTFoot : THTMLElement;
  1017. Begin
  1018. End;
  1019. Procedure THTMLTableElement.deleteTFoot;
  1020. Begin
  1021. End;
  1022. Function THTMLTableElement.createCaption : THTMLElement;
  1023. Begin
  1024. End;
  1025. Procedure THTMLTableElement.deleteCaption;
  1026. Begin
  1027. End;
  1028. Function THTMLTableElement.insertRow : THTMLElement;
  1029. Begin
  1030. End;
  1031. Procedure THTMLTableElement.deleteRow;
  1032. Begin
  1033. End;
  1034. // Created From file htmltablerowelement.xml
  1035. Function THTMLTableRowElement.insertCell : THTMLElement;
  1036. Begin
  1037. End;
  1038. Procedure THTMLTableRowElement.deleteCell;
  1039. Begin
  1040. End;
  1041. // Created From file htmltablesectionelement.xml
  1042. Function THTMLTableSectionElement.insertRow : THTMLElement;
  1043. Begin
  1044. End;
  1045. Procedure THTMLTableSectionElement.deleteRow;
  1046. Begin
  1047. End;
  1048. // Created From file htmltextareaelement.xml
  1049. Procedure THTMLTextAreaElement.blur;
  1050. Begin
  1051. End;
  1052. Procedure THTMLTextAreaElement.focus;
  1053. Begin
  1054. End;
  1055. Procedure THTMLTextAreaElement.select;
  1056. Begin
  1057. End;
  1058. end.