2
0

htmldoc.pp 35 KB

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