dom_html.pp 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635
  1. {
  2. This file is part of the Free Component Library
  3. Implementation of DOM HTML interfaces
  4. Copyright (c) 2002 by
  5. Areca Systems GmbH / Sebastian Guenther, [email protected]
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$mode objfpc}
  13. {$H+}
  14. unit DOM_HTML;
  15. interface
  16. uses DOM, htmldefs, xmlutils, SysUtils;
  17. type
  18. THTMLDocument = class;
  19. THTMLFormElement = class;
  20. THTMLTableCaptionElement = class;
  21. THTMLTableSectionElement = class;
  22. TFilterProc = function(aNode: TDOMNode): TFilterResult;
  23. // Tests cast Collection <-> OptionsCollection in arbitrary way...
  24. THTMLCollection = class(TDOMNodeList)
  25. protected
  26. FFilterProc: TFilterProc;
  27. function NodeFilter(aNode: TDOMNode): TFilterResult; override;
  28. public
  29. constructor Create(aNode: TDOMNode; Proc: TFilterProc);
  30. function NamedItem(const Index: DOMString): TDOMNode;
  31. end;
  32. // differs from HTMLCollection in that Length *may* be writable.
  33. // for now, let's pretend it's not...
  34. THTMLOptionsCollection = class(THTMLCollection)
  35. end;
  36. THTMLElement = class(TDOMElement)
  37. private
  38. function GetStrAttr(idx: THTMLAttributeTag): DOMString;
  39. procedure SetStrAttr(idx: THTMLAttributeTag; const value: DOMString);
  40. function GetIntAttr(idx: THTMLAttributeTag): Integer;
  41. procedure SetIntAttr(idx: THTMLAttributeTag; value: Integer);
  42. function GetUIntAttr(idx: THTMLAttributeTag): Cardinal;
  43. procedure SetUIntAttr(idx: THTMLAttributeTag; value: Cardinal);
  44. function GetBoolAttr(idx: THTMLAttributeTag): Boolean;
  45. procedure SetBoolAttr(idx: THTMLAttributeTag; value: Boolean);
  46. protected
  47. function GetForm: THTMLFormElement;
  48. public
  49. property ID: DOMString index atid read GetStrAttr write SetStrAttr;
  50. property Title: DOMString index attitle read GetStrAttr write SetStrAttr;
  51. property Lang: DOMString index atlang read GetStrAttr write SetStrAttr;
  52. property Dir: DOMString index atdir read GetStrAttr write SetStrAttr;
  53. property ClassName: DOMString index atclass read GetStrAttr write SetStrAttr;
  54. end;
  55. THTMLHtmlElement = class(THTMLElement)
  56. public
  57. property Version: DOMString index atversion read GetStrAttr write SetStrAttr;
  58. end;
  59. THTMLHeadElement = class(THTMLElement)
  60. public
  61. property Profile: DOMString index atprofile read GetStrAttr write SetStrAttr;
  62. end;
  63. THTMLLinkElement = class(THTMLElement)
  64. public
  65. property Disabled: Boolean index atdisabled read GetBoolAttr write SetBoolAttr;
  66. property Charset: DOMString index atcharset read GetStrAttr write SetStrAttr;
  67. property HRef: DOMString index athref read GetStrAttr write SetStrAttr;
  68. property HRefLang: DOMString index athreflang read GetStrAttr write SetStrAttr;
  69. property Media: DOMString index atmedia read GetStrAttr write SetStrAttr;
  70. property Rel: DOMString index atrel read GetStrAttr write SetStrAttr;
  71. property Rev: DOMString index atrev read GetStrAttr write SetStrAttr;
  72. property Target: DOMString index attarget read GetStrAttr write SetStrAttr;
  73. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr;
  74. end;
  75. THTMLTitleElement = class(THTMLElement)
  76. public
  77. property Text: DOMString read GetTextContent write SetTextContent;
  78. end;
  79. THTMLMetaElement = class(THTMLElement)
  80. public
  81. property Content: DOMString index atcontent read GetStrAttr write SetStrAttr;
  82. property HTTPEquiv: DOMString index athttpequiv read GetStrAttr write SetStrAttr;
  83. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  84. property Scheme: DOMString index atscheme read GetStrAttr write SetStrAttr;
  85. end;
  86. THTMLBaseElement = class(THTMLElement)
  87. public
  88. property HRef: DOMString index athref read GetStrAttr write SetStrAttr;
  89. property Target: DOMString index attarget read GetStrAttr write SetStrAttr;
  90. end;
  91. THTMLIsIndexElement = class(THTMLElement)
  92. public
  93. property Form: THTMLFormElement read GetForm;
  94. property Prompt: DOMString index atprompt read GetStrAttr write SetStrAttr; // 4.01 deprecated
  95. end;
  96. THTMLStyleElement = class(THTMLElement)
  97. public
  98. property Disabled: Boolean index atdisabled read GetBoolAttr write SetBoolAttr;
  99. property Media: DOMString index atmedia read GetStrAttr write SetStrAttr;
  100. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr;
  101. end;
  102. THTMLBodyElement = class(THTMLElement)
  103. public
  104. property ALink: DOMString index atalink read GetStrAttr write SetStrAttr;
  105. property Background: DOMString index atbackground read GetStrAttr write SetStrAttr;
  106. property BgColor: DOMString index atbgcolor read GetStrAttr write SetStrAttr;
  107. property Link: DOMString index atlink read GetStrAttr write SetStrAttr;
  108. property Text: DOMString index attext read GetStrAttr write SetStrAttr;
  109. property VLink: DOMString index atvlink read GetStrAttr write SetStrAttr;
  110. end;
  111. THTMLFormElement = class(THTMLElement)
  112. private
  113. function GetElements: THTMLCollection;
  114. function GetLength: Integer;
  115. public
  116. property Elements: THTMLCollection read GetElements;
  117. property Length: Integer read GetLength;
  118. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  119. property AcceptCharset: DOMString index atacceptcharset read GetStrAttr write SetStrAttr;
  120. property Action: DOMString index ataction read GetStrAttr write SetStrAttr;
  121. property EncType: DOMString index atenctype read GetStrAttr write SetStrAttr;
  122. property Method: DOMString index atmethod read GetStrAttr write SetStrAttr;
  123. property Target: DOMString index attarget read GetStrAttr write SetStrAttr;
  124. procedure Submit;
  125. procedure Reset;
  126. end;
  127. THTMLSelectElement = class(THTMLElement)
  128. private
  129. FSelectedIndex: Integer;
  130. function GetType: DOMString;
  131. function GetValue: DOMString;
  132. procedure SetValue(const value: DOMString);
  133. function GetOptions: THTMLOptionsCollection;
  134. function GetLength: Cardinal;
  135. procedure SetLength(aValue: Cardinal);
  136. public
  137. property HTMLType: DOMString read GetType;
  138. property SelectedIndex: Integer read FSelectedIndex write FSelectedIndex;
  139. property Value: DOMString read GetValue write SetValue;
  140. // maps to Options.Length
  141. property Length: Cardinal read GetLength write SetLength;
  142. property Form: THTMLFormElement read GetForm;
  143. property Options: THTMLOptionsCollection read GetOptions;
  144. property Disabled: Boolean index atdisabled read GetBoolAttr write SetBoolAttr;
  145. property Multiple: Boolean index atmultiple read GetBoolAttr write SetBoolAttr;
  146. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  147. property Size: Integer index atsize read GetIntAttr write SetIntAttr;
  148. property TabIndex: Integer index attabindex read GetIntAttr write SetIntAttr;
  149. procedure Add(Element, Before: THTMLElement);
  150. procedure Remove(Index: Integer);
  151. procedure Blur;
  152. procedure Focus;
  153. end;
  154. THTMLOptGroupElement = class(THTMLElement)
  155. public
  156. property Disabled: Boolean index atdisabled read GetBoolAttr write SetBoolAttr;
  157. property GroupLabel: DOMString index atlabel read GetStrAttr write SetStrAttr;
  158. end;
  159. THTMLOptionElement = class(THTMLElement)
  160. private
  161. function GetIndex: Integer;
  162. public
  163. property Form: THTMLFormElement read GetForm;
  164. property DefaultSelected: Boolean index atselected read GetBoolAttr write SetBoolAttr;
  165. property Text: DOMString read GetTextContent;
  166. property Index: Integer read GetIndex;
  167. property Disabled: Boolean index atdisabled read GetBoolAttr write SetBoolAttr;
  168. // TODO: name? was 'label'
  169. property OptionLabel: DOMString index atlabel read GetStrAttr write SetStrAttr;
  170. // TODO: GUI state, must not be mapped to attribute
  171. property Selected: Boolean index atselected read GetBoolAttr write SetBoolAttr;
  172. property Value: DOMString index atvalue read GetStrAttr write SetStrAttr;
  173. end;
  174. THTMLInputElement = class(THTMLElement)
  175. private
  176. FChecked: Boolean; // !!! TEMP
  177. public
  178. property DefaultValue: DOMString index atvalue read GetStrAttr write SetStrAttr;
  179. property DefaultChecked: Boolean index atchecked read GetBoolAttr write SetBoolAttr;
  180. property Form: THTMLFormElement read GetForm;
  181. property Accept: DOMString index ataccept read GetStrAttr write SetStrAttr;
  182. property AccessKey: DOMString index ataccesskey read GetStrAttr write SetStrAttr;
  183. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  184. property Alt: DOMString index atalt read GetStrAttr write SetStrAttr;
  185. // TODO: GUI state, not mapped to attribute
  186. property Checked: Boolean read FChecked write FChecked;
  187. property Disabled: Boolean index atdisabled read GetBoolAttr write SetBoolAttr;
  188. property MaxLength: Integer index atmaxlength read GetIntAttr write SetIntAttr;
  189. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  190. property ReadOnly: Boolean index atreadonly read GetBoolAttr write SetBoolAttr;
  191. property Size: Cardinal index atsize read GetUIntAttr write SetUIntAttr;
  192. property Src: DOMString index atsrc read GetStrAttr write SetStrAttr;
  193. property TabIndex: Integer index attabindex read GetIntAttr write SetIntAttr;
  194. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr;
  195. property UseMap: DOMString index atusemap read GetStrAttr write SetStrAttr;
  196. // TODO: GUI state, not mapped to attribute
  197. property Value: DOMString index atvalue read GetStrAttr write SetStrAttr;
  198. procedure Blur;
  199. procedure Focus;
  200. procedure Select;
  201. procedure Click;
  202. end;
  203. THTMLTextAreaElement = class(THTMLElement)
  204. private
  205. function GetType: DOMString;
  206. public
  207. property DefaultValue: DOMString read GetTextContent write SetTextContent;
  208. property Form: THTMLFormElement read GetForm;
  209. property AccessKey: DOMString index ataccesskey read GetStrAttr write SetStrAttr;
  210. property Cols: Integer index atcols read GetIntAttr write SetIntAttr;
  211. property Disabled: Boolean index atdisabled read GetBoolAttr write SetBoolAttr;
  212. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  213. property ReadOnly: Boolean index atreadonly read GetBoolAttr write SetBoolAttr;
  214. property Rows: Integer index atrows read GetIntAttr write SetIntAttr;
  215. property TabIndex: Integer index attabindex read GetIntAttr write SetIntAttr;
  216. property HTMLType: DOMString read GetType;
  217. // TODO: GUI state, not mapped to attribute
  218. property Value: DOMString read GetTextContent write SetTextContent;
  219. procedure Blur;
  220. procedure Focus;
  221. procedure Select;
  222. end;
  223. THTMLButtonElement = class(THTMLElement)
  224. public
  225. property Form: THTMLFormElement read GetForm;
  226. property AccessKey: DOMString index ataccesskey read GetStrAttr write SetStrAttr;
  227. property Disabled: Boolean index atdisabled read GetBoolAttr write SetBoolAttr;
  228. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  229. property TabIndex: Integer index attabindex read GetIntAttr write SetIntAttr;
  230. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr;
  231. property Value: DOMString index atvalue read GetStrAttr write SetStrAttr;
  232. end;
  233. THTMLLabelElement = class(THTMLElement)
  234. public
  235. property Form: THTMLFormElement read GetForm;
  236. property AccessKey: DOMString index ataccesskey read GetStrAttr write SetStrAttr;
  237. property HtmlFor: DOMString index atfor read GetStrAttr write SetStrAttr;
  238. end;
  239. THTMLFieldSetElement = class(THTMLElement)
  240. public
  241. property Form: THTMLFormElement read GetForm;
  242. end;
  243. THTMLLegendElement = class(THTMLElement)
  244. public
  245. property Form: THTMLFormElement read GetForm;
  246. property AccessKey: DOMString index ataccesskey read GetStrAttr write SetStrAttr;
  247. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  248. end;
  249. THTMLUListElement = class(THTMLElement)
  250. public
  251. property Compact: Boolean index atcompact read GetBoolAttr write SetBoolAttr; // 4.01 deprecated
  252. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr;
  253. end;
  254. THTMLOListElement = class(THTMLElement)
  255. public
  256. property Compact: Boolean index atcompact read GetBoolAttr write SetBoolAttr; // 4.01 deprecated
  257. property Start: Integer index atstart read GetIntAttr write SetIntAttr; // 4.01 deprecated
  258. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr; // 4.01 deprecated
  259. end;
  260. THTMLDListElement = class(THTMLElement)
  261. public
  262. property Compact: Boolean index atcompact read GetBoolAttr write SetBoolAttr; // 4.01 deprecated
  263. end;
  264. THTMLDirectoryElement = class(THTMLElement) // 4.01 deprecated
  265. public
  266. property Compact: Boolean index atcompact read GetBoolAttr write SetBoolAttr;
  267. end;
  268. THTMLMenuElement = class(THTMLElement) // 4.01 deprecated
  269. public
  270. property Compact: Boolean index atcompact read GetBoolAttr write SetBoolAttr;
  271. end;
  272. THTMLLIElement = class(THTMLElement)
  273. public
  274. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr; // 4.01 deprecated
  275. property Value: Integer index atvalue read GetIntAttr write SetIntAttr; // 4.01 deprecated
  276. end;
  277. THTMLDivElement = class(THTMLElement)
  278. public
  279. property Align: DOMString index atalign read GetStrAttr write SetStrAttr; // 4.01 deprecated
  280. end;
  281. THTMLParagraphElement = class(THTMLElement)
  282. public
  283. property Align: DOMString index atalign read GetStrAttr write SetStrAttr; // 4.01 deprecated
  284. end;
  285. THTMLHeadingElement = class(THTMLElement)
  286. public
  287. property Align: DOMString index atalign read GetStrAttr write SetStrAttr; // 4.01 deprecated
  288. end;
  289. THTMLQuoteElement = class(THTMLElement)
  290. public
  291. property Cite: DOMString index atcite read GetStrAttr write SetStrAttr;
  292. end;
  293. THTMLPreElement = class(THTMLElement)
  294. public
  295. property Width: Integer index atwidth read GetIntAttr write SetIntAttr; // 4.01 deprecated
  296. end;
  297. THTMLBRElement = class(THTMLElement)
  298. public
  299. property Clear: DOMString index atclear read GetStrAttr write SetStrAttr; // 4.01 deprecated
  300. end;
  301. // yep, BaseFont.size is integer, but Font.size is a String
  302. THTMLBaseFontElement = class(THTMLElement) // 4.01 deprecated
  303. public
  304. property Color: DOMString index atcolor read GetStrAttr write SetStrAttr; // 4.01 deprecated
  305. property Face: DOMString index atface read GetStrAttr write SetStrAttr; // 4.01 deprecated
  306. property Size: Integer index atsize read GetIntAttr write SetIntAttr; // 4.01 deprecated
  307. end;
  308. THTMLFontElement = class(THTMLElement) // 4.01 deprecated
  309. public
  310. property Color: DOMString index atcolor read GetStrAttr write SetStrAttr;
  311. property Face: DOMString index atface read GetStrAttr write SetStrAttr;
  312. property Size: DOMString index atsize read GetStrAttr write SetStrAttr;
  313. end;
  314. THTMLHRElement = class(THTMLElement)
  315. public
  316. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  317. property NoShade: Boolean index atnoshade read GetBoolAttr write SetBoolAttr; // 4.01 deprecated
  318. property Size: DOMString index atsize read GetStrAttr write SetStrAttr;
  319. property Width: DOMString index atwidth read GetStrAttr write SetStrAttr;
  320. end;
  321. THTMLModElement = class(THTMLElement)
  322. public
  323. property Cite: DOMString index atcite read GetStrAttr write SetStrAttr;
  324. property DateTime: DOMString index atdatetime read GetStrAttr write SetStrAttr;
  325. end;
  326. THTMLAnchorElement = class(THTMLElement)
  327. public
  328. property AccessKey: DOMString index ataccesskey read GetStrAttr write SetStrAttr;
  329. property Charset: DOMString index atcharset read GetStrAttr write SetStrAttr;
  330. property Coords: DOMString index atcoords read GetStrAttr write SetStrAttr;
  331. property HRef: DOMString index athref read GetStrAttr write SetStrAttr;
  332. property HRefLang: DOMString index athreflang read GetStrAttr write SetStrAttr;
  333. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  334. property Rel: DOMString index atrel read GetStrAttr write SetStrAttr;
  335. property Rev: DOMString index atrev read GetStrAttr write SetStrAttr;
  336. property Shape: DOMString index atshape read GetStrAttr write SetStrAttr;
  337. property TabIndex: Integer index attabindex read GetIntAttr write SetIntAttr;
  338. property Target: DOMString index attarget read GetStrAttr write SetStrAttr;
  339. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr;
  340. procedure Blur;
  341. procedure Focus;
  342. end;
  343. THTMLImageElement = class(THTMLElement)
  344. public
  345. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  346. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  347. property Alt: DOMString index atalt read GetStrAttr write SetStrAttr;
  348. property Border: DOMString index atborder read GetStrAttr write SetStrAttr;
  349. property Height: Integer index atheight read GetIntAttr write SetIntAttr;
  350. property HSpace: Integer index athspace read GetIntAttr write SetIntAttr; // 4.01 deprecated
  351. property IsMap: Boolean index atismap read GetBoolAttr write SetBoolAttr;
  352. property LongDesc: DOMString index atlongdesc read GetStrAttr write SetStrAttr;
  353. property Src: DOMString index atsrc read GetStrAttr write SetStrAttr;
  354. property UseMap: DOMString index atusemap read GetStrAttr write SetStrAttr;
  355. property VSpace: Integer index atvspace read GetIntAttr write SetIntAttr; // 4.01 deprecated
  356. property Width: Integer index atwidth read GetIntAttr write SetIntAttr;
  357. end;
  358. THTMLObjectElement = class(THTMLElement)
  359. private
  360. function GetContentDocument: TDOMDocument;
  361. public
  362. property Form: THTMLFormElement read GetForm;
  363. property Code: DOMString index atcode read GetStrAttr write SetStrAttr; // 4.01 deprecated
  364. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  365. property Archive: DOMString index atarchive read GetStrAttr write SetStrAttr;
  366. property Border: DOMString index atborder read GetStrAttr write SetStrAttr;
  367. property CodeBase: DOMString index atcodebase read GetStrAttr write SetStrAttr;
  368. property CodeType: DOMString index atcodetype read GetStrAttr write SetStrAttr;
  369. property Data: DOMString index atdata read GetStrAttr write SetStrAttr;
  370. property Declare: Boolean index atdeclare read GetBoolAttr write SetBoolAttr;
  371. property Height: DOMString index atheight read GetStrAttr write SetStrAttr;
  372. property HSpace: Integer index athspace read GetIntAttr write SetIntAttr; // 4.01 deprecated
  373. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  374. property StandBy: DOMString index atstandby read GetStrAttr write SetStrAttr;
  375. property TabIndex: Integer index attabindex read GetIntAttr write SetIntAttr;
  376. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr;
  377. property UseMap: DOMString index atusemap read GetStrAttr write SetStrAttr;
  378. property VSpace: Integer index atvspace read GetIntAttr write SetIntAttr; // 4.01 deprecated
  379. property Width: DOMString index atwidth read GetStrAttr write SetStrAttr;
  380. property ContentDocument: TDOMDocument read GetContentDocument;
  381. end;
  382. THTMLParamElement = class(THTMLElement)
  383. public
  384. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  385. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr;
  386. property Value: DOMString index atvalue read GetStrAttr write SetStrAttr;
  387. property ValueType: DOMString index atvaluetype read GetStrAttr write SetStrAttr;
  388. end;
  389. THTMLAppletElement = class(THTMLElement)
  390. public
  391. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  392. property Alt: DOMString index atalt read GetStrAttr write SetStrAttr;
  393. property Archive: DOMString index atarchive read GetStrAttr write SetStrAttr;
  394. property Code: DOMString index atcode read GetStrAttr write SetStrAttr; // 4.01 deprecated
  395. property CodeBase: DOMString index atcodebase read GetStrAttr write SetStrAttr;
  396. property Height: DOMString index atheight read GetStrAttr write SetStrAttr;
  397. property HSpace: Integer index athspace read GetIntAttr write SetIntAttr; // 4.01 deprecated
  398. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  399. property AppletObject: DOMString index atobject read GetStrAttr write SetStrAttr;
  400. property VSpace: Integer index atvspace read GetIntAttr write SetIntAttr; // 4.01 deprecated
  401. property Width: DOMString index atwidth read GetStrAttr write SetStrAttr;
  402. end;
  403. THTMLMapElement = class(THTMLElement)
  404. private
  405. function GetAreas: THTMLCollection;
  406. public
  407. property Areas: THTMLCollection read GetAreas;
  408. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  409. end;
  410. THTMLAreaElement = class(THTMLElement)
  411. public
  412. property AccessKey: DOMString index ataccesskey read GetStrAttr write SetStrAttr;
  413. property Alt: DOMString index atalt read GetStrAttr write SetStrAttr;
  414. property Coords: DOMString index atcoords read GetStrAttr write SetStrAttr;
  415. property HRef: DOMString index athref read GetStrAttr write SetStrAttr;
  416. property NoHRef: Boolean index atnohref read GetBoolAttr write SetBoolAttr;
  417. property Shape: DOMString index atshape read GetStrAttr write SetStrAttr;
  418. property TabIndex: Integer index attabindex read GetIntAttr write SetIntAttr;
  419. property Target: DOMString index attarget read GetStrAttr write SetStrAttr;
  420. end;
  421. THTMLScriptElement = class(THTMLElement)
  422. private
  423. function GetEvent: DOMString;
  424. procedure SetEvent(const Value: DOMString);
  425. public
  426. property Text: DOMString read GetTextContent write SetTextContent;
  427. property HtmlFor: DOMString index atfor read GetStrAttr write SetStrAttr;
  428. { reserved for future use }
  429. property Event: DOMString read GetEvent write SetEvent;
  430. property Charset: DOMString index atcharset read GetStrAttr write SetStrAttr;
  431. property Defer: Boolean index atdefer read GetBoolAttr write SetBoolAttr;
  432. property Src: DOMString index atsrc read GetStrAttr write SetStrAttr;
  433. property HTMLType: DOMString index attype read GetStrAttr write SetStrAttr;
  434. end;
  435. THTMLTableElement = class(THTMLElement)
  436. private
  437. function GetRows: THTMLCollection;
  438. function GetBodies: THTMLCollection;
  439. function GetCaption: THTMLTableCaptionElement;
  440. procedure SetCaption(value: THTMLTableCaptionElement);
  441. function GetHead: THTMLTableSectionElement;
  442. procedure SetHead(value: THTMLTableSectionElement);
  443. function GetFoot: THTMLTableSectionElement;
  444. procedure SetFoot(value: THTMLTableSectionElement);
  445. public
  446. property Caption: THTMLTableCaptionElement read GetCaption write SetCaption;
  447. property THead: THTMLTableSectionElement read GetHead write SetHead;
  448. property TFoot: THTMLTableSectionElement read GetFoot write SetFoot;
  449. property Rows: THTMLCollection read GetRows;
  450. property TBodies: THTMLCollection read GetBodies;
  451. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  452. property BgColor: DOMString index atbgcolor read GetStrAttr write SetStrAttr; // 4.01 deprecated
  453. property Border: DOMString index atborder read GetStrAttr write SetStrAttr;
  454. property CellPadding: DOMString index atcellpadding read GetStrAttr write SetStrAttr;
  455. property CellSpacing: DOMString index atcellspacing read GetStrAttr write SetStrAttr;
  456. property Frame: DOMString index atframe read GetStrAttr write SetStrAttr;
  457. property Rules: DOMString index atrules read GetStrAttr write SetStrAttr;
  458. property Summary: DOMString index atsummary read GetStrAttr write SetStrAttr;
  459. property Width: DOMString index atwidth read GetStrAttr write SetStrAttr;
  460. function CreateTHead: THTMLElement;
  461. procedure DeleteTHead;
  462. function CreateTFoot: THTMLElement;
  463. procedure DeleteTFoot;
  464. function CreateCaption: THTMLElement;
  465. procedure DeleteCaption;
  466. function InsertRow(Index: Integer): THTMLElement;
  467. procedure DeleteRow(Index: Integer);
  468. end;
  469. THTMLTableCaptionElement = class(THTMLElement)
  470. public
  471. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  472. end;
  473. THTMLTableColElement = class(THTMLElement)
  474. public
  475. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  476. property Ch: DOMString index atchar read GetStrAttr write SetStrAttr;
  477. property ChOff: DOMString index atcharoff read GetStrAttr write SetStrAttr;
  478. property Span: Integer index atspan read GetIntAttr write SetIntAttr;
  479. property VAlign: DOMString index atvalign read GetStrAttr write SetStrAttr;
  480. property Width: DOMString index atwidth read GetStrAttr write SetStrAttr;
  481. end;
  482. THTMLTableSectionElement = class(THTMLElement)
  483. private
  484. function GetRows: THTMLCollection;
  485. public
  486. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  487. property Ch: DOMString index atchar read GetStrAttr write SetStrAttr;
  488. property ChOff: DOMString index atcharoff read GetStrAttr write SetStrAttr;
  489. property VAlign: DOMString index atvalign read GetStrAttr write SetStrAttr;
  490. property Rows: THTMLCollection read GetRows;
  491. function InsertRow(Index: Integer): THTMLElement;
  492. procedure DeleteRow(Index: Integer);
  493. end;
  494. THTMLTableRowElement = class(THTMLElement)
  495. private
  496. function GetRowIndex: Integer;
  497. function GetSectionRowIndex: Integer;
  498. function GetCells: THTMLCollection;
  499. public
  500. property RowIndex: Integer read GetRowIndex;
  501. property SectionRowIndex: Integer read GetSectionRowIndex;
  502. property Cells: THTMLCollection read GetCells;
  503. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  504. property BgColor: DOMString index atbgcolor read GetStrAttr write SetStrAttr; // 4.01 deprecated
  505. property Ch: DOMString index atchar read GetStrAttr write SetStrAttr;
  506. property ChOff: DOMString index atcharoff read GetStrAttr write SetStrAttr;
  507. property VAlign: DOMString index atvalign read GetStrAttr write SetStrAttr;
  508. function InsertCell(Index: Integer): THTMLElement;
  509. procedure DeleteCell(Index: Integer);
  510. end;
  511. THTMLTableCellElement = class(THTMLElement)
  512. private
  513. function GetCellIndex: Integer;
  514. public
  515. property CellIndex: Integer read GetCellIndex;
  516. property Abbr: DOMString index atabbr read GetStrAttr write SetStrAttr;
  517. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  518. property Axis: DOMString index ataxis read GetStrAttr write SetStrAttr;
  519. property BgColor: DOMString index atbgcolor read GetStrAttr write SetStrAttr; // 4.01 deprecated
  520. property Ch: DOMString index atchar read GetStrAttr write SetStrAttr;
  521. property ChOff: DOMString index atcharoff read GetStrAttr write SetStrAttr;
  522. property ColSpan: Integer index atcolspan read GetIntAttr write SetIntAttr;
  523. property Headers: DOMString index atheaders read GetStrAttr write SetStrAttr;
  524. property Height: DOMString index atheight read GetStrAttr write SetStrAttr;
  525. property NoWrap: Boolean index atnowrap read GetBoolAttr write SetBoolAttr; // 4.01 deprecated
  526. property RowSpan: Integer index atrowspan read GetIntAttr write SetIntAttr;
  527. property Scope: DOMString index atscope read GetStrAttr write SetStrAttr;
  528. property VAlign: DOMString index atvalign read GetStrAttr write SetStrAttr;
  529. property Width: DOMString index atwidth read GetStrAttr write SetStrAttr;
  530. end;
  531. THTMLFrameSetElement = class(THTMLElement)
  532. public
  533. property Cols: DOMString index atcols read GetStrAttr write SetStrAttr;
  534. property Rows: DOMString index atrows read GetStrAttr write SetStrAttr;
  535. end;
  536. THTMLFrameElement = class(THTMLElement)
  537. private
  538. FContentDocument: TDOMDocument; // !!! TEMP
  539. public
  540. property FrameBorder: DOMString index atframeborder read GetStrAttr write SetStrAttr;
  541. property LongDesc: DOMString index atlongdesc read GetStrAttr write SetStrAttr;
  542. property MarginHeight: DOMString index atmarginheight read GetStrAttr write SetStrAttr;
  543. property MarginWidth: DOMString index atmarginwidth read GetStrAttr write SetStrAttr;
  544. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  545. property NoResize: Boolean index atnoresize read GetBoolAttr write SetBoolAttr;
  546. property Scrolling: DOMString index atscrolling read GetStrAttr write SetStrAttr;
  547. property Src: DOMString index atsrc read GetStrAttr write SetStrAttr;
  548. property ContentDocument: TDOMDocument read FContentDocument;
  549. end;
  550. THTMLIFrameElement = class(THTMLElement)
  551. private
  552. FContentDocument: TDOMDocument; // !!! TEMP
  553. public
  554. property Align: DOMString index atalign read GetStrAttr write SetStrAttr;
  555. property FrameBorder: DOMString index atframeborder read GetStrAttr write SetStrAttr;
  556. property Height: DOMString index atheight read GetStrAttr write SetStrAttr;
  557. property LongDesc: DOMString index atlongdesc read GetStrAttr write SetStrAttr;
  558. property MarginHeight: DOMString index atmarginheight read GetStrAttr write SetStrAttr;
  559. property MarginWidth: DOMString index atmarginwidth read GetStrAttr write SetStrAttr;
  560. property Name: DOMString index atname read GetStrAttr write SetStrAttr;
  561. property Scrolling: DOMString index atscrolling read GetStrAttr write SetStrAttr;
  562. property Src: DOMString index atsrc read GetStrAttr write SetStrAttr;
  563. property Width: DOMString index atwidth read GetStrAttr write SetStrAttr;
  564. property ContentDocument: TDOMDocument read FContentDocument;
  565. end;
  566. THTMLDocument = class(TXMLDocument)
  567. private
  568. function GetTitle: DOMString;
  569. procedure SetTitle(const Value: DOMString);
  570. function GetBody: THTMLElement;
  571. procedure SetBody(value: THTMLElement);
  572. function GetAnchors: THTMLCollection;
  573. function GetApplets: THTMLCollection;
  574. function GetCookie: DOMString;
  575. procedure SetCookie(const Value: DOMString);
  576. function GetDomain: DOMString;
  577. function GetForms: THTMLCollection;
  578. function GetImages: THTMLCollection;
  579. function GetLinks: THTMLCollection;
  580. function GetReferrer: DOMString;
  581. public
  582. property Title: DOMString read GetTitle write SetTitle;
  583. property Referrer: DOMString read GetReferrer;
  584. property Domain: DOMString read GetDomain;
  585. property URL: DOMString read FURI;
  586. property Body: THTMLElement read GetBody write SetBody;
  587. property Images: THTMLCollection read GetImages;
  588. property Applets: THTMLCollection read GetApplets;
  589. property Links: THTMLCollection read GetLinks;
  590. property Forms: THTMLCollection read GetForms;
  591. property Anchors: THTMLCollection read GetAnchors;
  592. property Cookie: DOMString read GetCookie write SetCookie;
  593. procedure Open;
  594. procedure Close;
  595. procedure Write(const AText: DOMString);
  596. procedure WriteLn(const AText: DOMString);
  597. function GetElementsByName(const ElementName: DOMString): TDOMNodeList;
  598. function HashForName(const aName: DOMString): PHashItem;
  599. // Helper functions (not in DOM standard):
  600. function CreateElement(const tagName: DOMString): THTMLElement;
  601. function CreateSubElement: THTMLElement;
  602. function CreateSupElement: THTMLElement;
  603. function CreateSpanElement: THTMLElement;
  604. function CreateBDOElement: THTMLElement;
  605. function CreateTTElement: THTMLElement;
  606. function CreateIElement: THTMLElement;
  607. function CreateBElement: THTMLElement;
  608. function CreateUElement: THTMLElement;
  609. function CreateSElement: THTMLElement;
  610. function CreateStrikeElement: THTMLElement;
  611. function CreateBigElement: THTMLElement;
  612. function CreateSmallElement: THTMLElement;
  613. function CreateEmElement: THTMLElement;
  614. function CreateStrongElement: THTMLElement;
  615. function CreateDfnElement: THTMLElement;
  616. function CreateCodeElement: THTMLElement;
  617. function CreateSampElement: THTMLElement;
  618. function CreateKbdElement: THTMLElement;
  619. function CreateVarElement: THTMLElement;
  620. function CreateCiteElement: THTMLElement;
  621. function CreateAcronymElement: THTMLElement;
  622. function CreateAbbrElement: THTMLElement;
  623. function CreateDDElement: THTMLElement;
  624. function CreateDTElement: THTMLElement;
  625. function CreateNoFramesElement: THTMLElement;
  626. function CreateNoScriptElement: THTMLElement;
  627. function CreateAddressElement: THTMLElement;
  628. function CreateCenterElement: THTMLElement;
  629. function CreateHtmlElement: THTMLHtmlElement;
  630. function CreateHeadElement: THTMLHeadElement;
  631. function CreateLinkElement: THTMLLinkElement;
  632. { function CreateTitleElement: THTMLTitleElement;
  633. function CreateMetaElement: THTMLMetaElement;
  634. function CreateBaseElement: THTMLBaseElement;
  635. function CreateIsIndexElement: THTMLIsIndexElement;
  636. function CreateStyleElement: THTMLStyleElement;}
  637. function CreateBodyElement: THTMLBodyElement;
  638. { function CreateFormElement: THTMLFormElement;
  639. function CreateSelectElement: THTMLSelectElement;
  640. function CreateOptGroupElement: THTMLOptGroupElement;
  641. function CreateOptionElement: THTMLOptionElement;
  642. function CreateInputElement: THTMLInputElement;
  643. function CreateTextAreaElement: THTMLTextAreaElement;
  644. function CreateButtonElement: THTMLButtonElement;
  645. function CreateLabelElement: THTMLLabelElement;
  646. function CreateFieldSetElement: THTMLFieldSetElement;
  647. function CreateLegendElement: THTMLLegendElement;}
  648. function CreateUListElement: THTMLUListElement;
  649. function CreateOListElement: THTMLOListElement;
  650. function CreateDListElement: THTMLDListElement;
  651. { function CreateDirectoryElement: THTMLDirectoryElement;
  652. function CreateMenuElement: THTMLMenuElement;}
  653. function CreateLIElement: THTMLLIElement;
  654. { function CreateDivElement: THTMLDivElement;}
  655. function CreateParagraphElement: THTMLParagraphElement;
  656. { function CreateHeadingElement: THTMLHeadingElement;
  657. function CreateQuoteElement: THTMLQuoteElement;
  658. function CreatePreElement: THTMLPreElement;
  659. function CreateBRElement: THTMLBreElement;
  660. function CreateBaseFontElement: THTMLBaseFontElement;
  661. function CreateFontElement: THTMFontLElement;
  662. function CreateHRElement: THTMLHREElement;
  663. function CreateModElement: THTMLModElement;
  664. function CreateAnchorElement: THTMLAnchorElement;
  665. function CreateImageElement: THTMLImageElement;
  666. function CreateObjectElement: THTMLObjectElement;
  667. function CreateParamElement: THTMLParamElement;
  668. function CreateAppletElement: THTMLAppletElement;
  669. function CreateMapElement: THTMLMapElement;
  670. function CreateAreaElement: THTMLAreaElement;
  671. function CreateScriptElement: THTMLScriptElement;
  672. function CreateTableElement: THTMLTableElement;
  673. function CreateTableCaptionElement: THTMLTableCaptionElement;
  674. function CreateTableColElement: THTMLTableColElement;
  675. function CreateTableSectionElement: THTMLTableSectionElement;
  676. function CreateTableRowElement: THTMLTableRowElement;
  677. function CreateTableCellElement: THTMLTableCellElement;
  678. function CreateFrameSetElement: THTMLFrameSetElement;
  679. function CreateFrameElement: THTMLFrameElement;
  680. function CreateIFrameElement: THTMLIFrameElement;}
  681. end;
  682. implementation
  683. { THTMLCollection }
  684. constructor THTMLCollection.Create(aNode: TDOMNode; Proc: TFilterProc);
  685. begin
  686. inherited Create(aNode);
  687. FFilterProc := Proc;
  688. end;
  689. function THTMLCollection.NodeFilter(aNode: TDOMNode): TFilterResult;
  690. begin
  691. Result := FFilterProc(aNode);
  692. end;
  693. function THTMLCollection.NamedItem(const Index: DOMString): TDOMNode;
  694. var
  695. I: Cardinal;
  696. begin
  697. // Finds node with matching 'id' attribute
  698. for I := 0 to Length-1 do
  699. begin
  700. // TODO: could be improved when we're able to build ID table for HTML docs.
  701. Result := GetItem(I);
  702. if (Result.NodeType = ELEMENT_NODE) and (TDOMElement(Result)['id'] = Index) then
  703. Exit;
  704. end;
  705. // HTML4.01: additionally search for a node with matching 'name' attr
  706. Result := nil;
  707. end;
  708. { THTMLElement }
  709. function THTMLElement.GetForm: THTMLFormElement;
  710. var
  711. r: TDOMNode;
  712. begin
  713. // TODO: rewrite properly
  714. r := ParentNode;
  715. while Assigned(r) and (r.NodeName <> 'form') do
  716. r := r.ParentNode;
  717. result := THTMLFormElement(r);
  718. end;
  719. function THTMLElement.GetStrAttr(idx: THTMLAttributeTag): DOMString;
  720. begin
  721. // TODO: values of attributes that are value lists must be returned in lowercase
  722. result := GetAttribute(HTMLAttributeTag[idx]);
  723. end;
  724. procedure THTMLElement.SetStrAttr(idx: THTMLAttributeTag; const Value: DOMString);
  725. begin
  726. SetAttribute(HTMLAttributeTag[idx], Value);
  727. end;
  728. function THTMLElement.GetIntAttr(idx: THTMLAttributeTag): Integer;
  729. begin
  730. if not TryStrToInt(GetAttribute(HTMLAttributeTag[idx]), result) then
  731. result := 0;
  732. end;
  733. procedure THTMLElement.SetIntAttr(idx: THTMLAttributeTag; value: Integer);
  734. begin
  735. SetAttribute(HTMLAttributeTag[idx], IntToStr(value));
  736. end;
  737. function THTMLElement.GetUIntAttr(idx: THTMLAttributeTag): Cardinal;
  738. var
  739. tmp: DOMString;
  740. code: word;
  741. begin
  742. tmp := GetAttribute(HTMLAttributeTag[idx]);
  743. val(tmp, result, code);
  744. if code <> 0 then
  745. result := 0;
  746. end;
  747. procedure THTMLElement.SetUIntAttr(idx: THTMLAttributeTag; value: Cardinal);
  748. begin
  749. SetAttribute(HTMLAttributeTag[idx], IntToStr(value));
  750. end;
  751. function THTMLElement.GetBoolAttr(idx: THTMLAttributeTag): Boolean;
  752. begin
  753. // attribute value is irrelevant?
  754. result := HasAttribute(HTMLAttributeTag[idx]);
  755. end;
  756. procedure THTMLElement.SetBoolAttr(idx: THTMLAttributeTag; value: Boolean);
  757. begin
  758. if value then
  759. SetAttribute(HTMLAttributeTag[idx], HTMLAttributeTag[idx])
  760. else
  761. RemoveAttribute(HTMLAttributeTag[idx]);
  762. end;
  763. { THTMLTableElement }
  764. function TableRowFilter(aNode: TDOMNode): TFilterResult;
  765. begin
  766. if (aNode.NodeType = ELEMENT_NODE) and (aNode.NodeName = 'tr') then
  767. Result := frNorecurseTrue
  768. else
  769. Result := frFalse;
  770. end;
  771. function TableBodyFilter(aNode: TDOMNode): TFilterResult;
  772. begin
  773. if (aNode.NodeType = ELEMENT_NODE) and (aNode.NodeName = 'tbody') then
  774. Result := frNorecurseTrue
  775. else
  776. Result := frFalse;
  777. end;
  778. function THTMLTableElement.GetRows: THTMLCollection;
  779. begin
  780. result := THTMLCollection.Create(Self, @TableRowFilter);
  781. end;
  782. function THTMLTableElement.GetBodies: THTMLCollection;
  783. begin
  784. result := THTMLCollection.Create(Self, @TableBodyFilter);
  785. end;
  786. function THTMLTableElement.GetCaption: THTMLTableCaptionElement;
  787. var
  788. child: TDOMNode;
  789. begin
  790. child := FirstChild;
  791. while Assigned(child) do
  792. begin
  793. if child.NodeName = 'caption' then
  794. Break;
  795. child := child.NextSibling;
  796. end;
  797. result := THTMLTableCaptionElement(child);
  798. end;
  799. procedure THTMLTableElement.SetCaption(value: THTMLTableCaptionElement);
  800. begin
  801. // TODO: implement
  802. end;
  803. function THTMLTableElement.GetHead: THTMLTableSectionElement;
  804. var
  805. child: TDOMNode;
  806. begin
  807. child := FirstChild;
  808. while Assigned(child) do
  809. begin
  810. if child.NodeName = 'thead' then
  811. Break;
  812. child := child.NextSibling;
  813. end;
  814. result := THTMLTableSectionElement(child);
  815. end;
  816. procedure THTMLTableElement.SetHead(value: THTMLTableSectionElement);
  817. begin
  818. // TODO: implement
  819. end;
  820. function THTMLTableElement.GetFoot: THTMLTableSectionElement;
  821. var
  822. child: TDOMNode;
  823. begin
  824. child := FirstChild;
  825. while Assigned(child) do
  826. begin
  827. if child.NodeName = 'tfoot' then
  828. Break;
  829. child := child.NextSibling;
  830. end;
  831. result := THTMLTableSectionElement(child);
  832. end;
  833. procedure THTMLTableElement.SetFoot(value: THTMLTableSectionElement);
  834. begin
  835. // TODO: implement
  836. end;
  837. function THTMLTableElement.CreateTHead: THTMLElement;
  838. begin
  839. Result := GetHead;
  840. if Assigned(Result) then
  841. Exit;
  842. Result := THTMLTableSectionElement.Create(OwnerDocument);
  843. Result.FNSI.QName := THTMLDocument(OwnerDocument).HashForName('thead');
  844. AppendChild(Result);
  845. end;
  846. procedure THTMLTableElement.DeleteTHead;
  847. var
  848. node: TDOMNode;
  849. begin
  850. node := GetHead;
  851. if Assigned(node) then
  852. RemoveChild(node);
  853. end;
  854. function THTMLTableElement.CreateTFoot: THTMLElement;
  855. begin
  856. Result := GetFoot;
  857. if Assigned(Result) then
  858. Exit;
  859. Result := THTMLTableSectionElement.Create(OwnerDocument);
  860. Result.FNSI.QName := THTMLDocument(OwnerDocument).HashForName('tfoot');
  861. AppendChild(Result);
  862. end;
  863. procedure THTMLTableElement.DeleteTFoot;
  864. var
  865. node: TDOMNode;
  866. begin
  867. node := GetFoot;
  868. if Assigned(node) then
  869. RemoveChild(node);
  870. end;
  871. function THTMLTableElement.CreateCaption: THTMLElement;
  872. begin
  873. Result := GetCaption;
  874. if Assigned(Result) then
  875. Exit;
  876. Result := THTMLTableCaptionElement.Create(OwnerDocument);
  877. Result.FNSI.QName := THTMLDocument(OwnerDocument).HashForName('caption');
  878. AppendChild(Result);
  879. end;
  880. procedure THTMLTableElement.DeleteCaption;
  881. var
  882. node: TDOMNode;
  883. begin
  884. node := GetCaption;
  885. if Assigned(node) then
  886. RemoveChild(node);
  887. end;
  888. function THTMLTableElement.InsertRow(Index: Integer): THTMLElement;
  889. begin
  890. { Insert a new empty row in the table. The new row is inserted immediately
  891. before and in the same section as the current indexth row in the table.
  892. If index is -1 or equal to the number of rows, the new row is appended.
  893. In addition, when the table is empty the row is inserted into a TBODY which
  894. is created and inserted into the table. }
  895. Result := nil;
  896. end;
  897. procedure THTMLTableElement.DeleteRow(Index: Integer);
  898. begin
  899. end;
  900. { THTMLTableSectionElement }
  901. function THTMLTableSectionElement.GetRows: THTMLCollection;
  902. begin
  903. result := THTMLCollection.Create(Self, @TableRowFilter);
  904. end;
  905. function THTMLTableSectionElement.InsertRow(Index: Integer): THTMLElement;
  906. var
  907. row: TDOMNode;
  908. begin
  909. with GetRows do
  910. try
  911. if (Index < -1) or (Index > Integer(Length)) then
  912. raise EDOMIndexSize.Create('HTMLTableSectionElement.InsertRow');
  913. row := GetItem(LongWord(Index)); // may be nil
  914. Result := THTMLTableRowElement.Create(OwnerDocument);
  915. Result.FNSI.QName := THTMLDocument(OwnerDocument).HashForName('tr');
  916. InsertBefore(Result, row);
  917. finally
  918. Free;
  919. end;
  920. end;
  921. procedure THTMLTableSectionElement.DeleteRow(Index: Integer);
  922. var
  923. row: TDOMNode;
  924. begin
  925. with GetRows do
  926. try
  927. if Index = -1 then
  928. Index := Length-1;
  929. row := GetItem(LongWord(Index));
  930. if row = nil then
  931. raise EDOMIndexSize.Create('HTMLTableSectionElement.DeleteRow');
  932. RemoveChild(row);
  933. finally
  934. Free;
  935. end;
  936. end;
  937. { THTMLDocument }
  938. function THTMLDocument.GetTitle: DOMString;
  939. var
  940. Node: TDOMNode;
  941. begin
  942. Result := '';
  943. if not Assigned(DocumentElement) then
  944. exit;
  945. Node := DocumentElement.FirstChild;
  946. while Assigned(Node) and (Node.NodeName <> 'head') do
  947. Node := Node.NextSibling;
  948. if not Assigned(Node) then
  949. exit;
  950. Node := Node.FirstChild;
  951. while Assigned(Node) and (Node.NodeName <> 'title') do
  952. Node := Node.NextSibling;
  953. if not Assigned(Node) then
  954. exit;
  955. Node := Node.FirstChild;
  956. if Assigned(Node) and (Node.NodeType = TEXT_NODE) then
  957. Result := Node.NodeValue;
  958. end;
  959. procedure THTMLDocument.SetTitle(const Value: DOMString);
  960. var
  961. Node: TDOMNode;
  962. TitleEl: TDOMElement;
  963. begin
  964. if not Assigned(DocumentElement) then
  965. AppendChild(CreateHtmlElement);
  966. Node := DocumentElement.FirstChild;
  967. while Assigned(Node) and (Node.NodeName <> 'head') do
  968. Node := Node.NextSibling;
  969. if not Assigned(Node) then
  970. begin
  971. Node := CreateHeadElement;
  972. DocumentElement.InsertBefore(Node, DocumentElement.FirstChild);
  973. end;
  974. TitleEl := TDOMElement(Node.FirstChild);
  975. while Assigned(TitleEl) and (TitleEl.NodeName <> 'title') do
  976. TitleEl := TDOMElement(TitleEl.NextSibling);
  977. if not Assigned(TitleEl) then
  978. begin
  979. TitleEl := CreateElement('title');
  980. Node.AppendChild(TitleEl);
  981. end;
  982. while Assigned(TitleEl.FirstChild) do
  983. TitleEl.RemoveChild(TitleEl.FirstChild);
  984. TitleEl.AppendChild(CreateTextNode(Value));
  985. end;
  986. function THTMLDocument.GetBody: THTMLElement;
  987. var
  988. Node: TDOMNode;
  989. begin
  990. if not Assigned(DocumentElement) then
  991. AppendChild(CreateHtmlElement);
  992. Node := DocumentElement.FirstChild;
  993. while Assigned(Node) and (Node.NodeName <> 'body') do
  994. Node := Node.NextSibling;
  995. if not Assigned(Node) then
  996. begin
  997. Node := CreateBodyElement;
  998. DocumentElement.AppendChild(Node);
  999. end;
  1000. result := THTMLElement(Node);
  1001. end;
  1002. procedure THTMLDocument.SetBody(value: THTMLElement);
  1003. begin
  1004. end;
  1005. function DocImageFilter(aNode: TDOMNode): TFilterResult;
  1006. begin
  1007. if (aNode.NodeType = ELEMENT_NODE) and (aNode.NodeName = 'img') then
  1008. Result := frNorecurseTrue
  1009. else
  1010. Result := frFalse;
  1011. end;
  1012. function DocFormFilter(aNode: TDOMNode): TFilterResult;
  1013. begin
  1014. if (aNode.NodeType = ELEMENT_NODE) and (aNode.NodeName = 'form') then
  1015. Result := frTrue
  1016. else
  1017. Result := frFalse;
  1018. end;
  1019. function DocAnchorFilter(aNode: TDOMNode): TFilterResult;
  1020. begin
  1021. if (aNode.NodeType = ELEMENT_NODE) and (aNode.NodeName = 'a') and
  1022. TDOMElement(aNode).HasAttribute('name') then
  1023. Result := frTrue
  1024. else
  1025. Result := frFalse;
  1026. end;
  1027. function DocAppletFilter(aNode: TDOMNode): TFilterResult;
  1028. begin
  1029. if (aNode.NodeType = ELEMENT_NODE) and ((aNode.NodeName = 'applet') or
  1030. (aNode.NodeName = 'object')) then
  1031. Result := frTrue
  1032. else
  1033. Result := frFalse;
  1034. end;
  1035. function DocLinksFilter(aNode: TDOMNode): TFilterResult;
  1036. begin
  1037. if (aNode.NodeType = ELEMENT_NODE) and ((aNode.NodeName = 'area') or
  1038. ((aNode.NodeName = 'a') and TDOMElement(aNode).HasAttribute('href'))) then
  1039. Result := frTrue
  1040. else
  1041. Result := frFalse;
  1042. end;
  1043. type
  1044. TByNameNodeList = class(TDOMNodeList)
  1045. protected
  1046. FFilter: DOMString;
  1047. function NodeFilter(aNode: TDOMNode): TFilterResult; override;
  1048. public
  1049. constructor Create(aNode: TDOMNode; const aFilter: DOMString);
  1050. end;
  1051. constructor TByNameNodeList.Create(aNode: TDOMNode; const aFilter: DOMString);
  1052. begin
  1053. inherited Create(aNode);
  1054. FFilter := aFilter;
  1055. end;
  1056. function TByNameNodeList.NodeFilter(aNode: TDOMNode): TFilterResult;
  1057. begin
  1058. if (aNode.NodeType = ELEMENT_NODE) and (TDOMElement(aNode)['name'] = FFilter) then
  1059. Result := frTrue
  1060. else
  1061. Result := frFalse;
  1062. end;
  1063. function THTMLDocument.GetAnchors: THTMLCollection;
  1064. begin
  1065. Result := THTMLCollection.Create(Self, @DocAnchorFilter);
  1066. end;
  1067. function THTMLDocument.GetApplets: THTMLCollection;
  1068. begin
  1069. Result := THTMLCollection.Create(Self, @DocAppletFilter);
  1070. end;
  1071. function THTMLDocument.GetForms: THTMLCollection;
  1072. begin
  1073. Result := THTMLCollection.Create(Self, @DocFormFilter);
  1074. end;
  1075. function THTMLDocument.GetImages: THTMLCollection;
  1076. begin
  1077. Result := THTMLCollection.Create(Self, @DocImageFilter);
  1078. end;
  1079. function THTMLDocument.GetLinks: THTMLCollection;
  1080. begin
  1081. Result := THTMLCollection.Create(Self, @DocLinksFilter);
  1082. end;
  1083. function THTMLDocument.GetDomain: DOMString;
  1084. begin
  1085. Result := '';
  1086. end;
  1087. function THTMLDocument.GetReferrer: DOMString;
  1088. begin
  1089. Result := '';
  1090. end;
  1091. function THTMLDocument.GetCookie: DOMString;
  1092. begin
  1093. Result := '';
  1094. end;
  1095. procedure THTMLDocument.SetCookie(const Value: DOMString);
  1096. begin
  1097. end;
  1098. procedure THTMLDocument.Open;
  1099. begin
  1100. end;
  1101. procedure THTMLDocument.Close;
  1102. begin
  1103. end;
  1104. procedure THTMLDocument.Write(const AText: DOMString);
  1105. begin
  1106. end;
  1107. procedure THTMLDocument.WriteLn(const AText: DOMString);
  1108. begin
  1109. end;
  1110. function THTMLDocument.GetElementsByName(const ElementName: DOMString): TDOMNodeList;
  1111. begin
  1112. Result := TByNameNodeList.Create(Self, ElementName);
  1113. end;
  1114. function THTMLDocument.CreateElement(const tagName: DOMString): THTMLElement;
  1115. begin
  1116. Result := THTMLElement.Create(Self);
  1117. Result.FNSI.QName := FNames.FindOrAdd(DOMPChar(tagName), Length(tagName));
  1118. end;
  1119. function THTMLDocument.HashForName(const aName: DOMString): PHashItem;
  1120. begin
  1121. Result := FNames.FindOrAdd(DOMPChar(aName), Length(aName));
  1122. end;
  1123. function THTMLDocument.CreateSubElement: THTMLElement; begin Result := CreateElement('sub') end;
  1124. function THTMLDocument.CreateSupElement: THTMLElement; begin Result := CreateElement('sup') end;
  1125. function THTMLDocument.CreateSpanElement: THTMLElement; begin Result := CreateElement('span') end;
  1126. function THTMLDocument.CreateBDOElement: THTMLElement; begin Result := CreateElement('bdo') end;
  1127. function THTMLDocument.CreateTTElement: THTMLElement; begin Result := CreateElement('tt') end;
  1128. function THTMLDocument.CreateIElement: THTMLElement; begin Result := CreateElement('i') end;
  1129. function THTMLDocument.CreateBElement: THTMLElement; begin Result := CreateElement('b') end;
  1130. function THTMLDocument.CreateUElement: THTMLElement; begin Result := CreateElement('u') end;
  1131. function THTMLDocument.CreateSElement: THTMLElement; begin Result := CreateElement('s') end;
  1132. function THTMLDocument.CreateStrikeElement: THTMLElement; begin Result := CreateElement('strike') end;
  1133. function THTMLDocument.CreateBigElement: THTMLElement; begin Result := CreateElement('big') end;
  1134. function THTMLDocument.CreateSmallElement: THTMLElement; begin Result := CreateElement('small') end;
  1135. function THTMLDocument.CreateEmElement: THTMLElement; begin Result := CreateElement('em') end;
  1136. function THTMLDocument.CreateStrongElement: THTMLElement; begin Result := CreateElement('strong') end;
  1137. function THTMLDocument.CreateDfnElement: THTMLElement; begin Result := CreateElement('dfn') end;
  1138. function THTMLDocument.CreateCodeElement: THTMLElement; begin Result := CreateElement('code') end;
  1139. function THTMLDocument.CreateSampElement: THTMLElement; begin Result := CreateElement('samp') end;
  1140. function THTMLDocument.CreateKbdElement: THTMLElement; begin Result := CreateElement('kbd') end;
  1141. function THTMLDocument.CreateVarElement: THTMLElement; begin Result := CreateElement('var') end;
  1142. function THTMLDocument.CreateCiteElement: THTMLElement; begin Result := CreateElement('cite') end;
  1143. function THTMLDocument.CreateAcronymElement: THTMLElement; begin Result := CreateElement('acronym') end;
  1144. function THTMLDocument.CreateAbbrElement: THTMLElement; begin Result := CreateElement('abbr') end;
  1145. function THTMLDocument.CreateDDElement: THTMLElement; begin Result := CreateElement('dd') end;
  1146. function THTMLDocument.CreateDTElement: THTMLElement; begin Result := CreateElement('dt') end;
  1147. function THTMLDocument.CreateNoFramesElement: THTMLElement; begin Result := CreateElement('noframes') end;
  1148. function THTMLDocument.CreateNoScriptElement: THTMLElement; begin Result := CreateElement('noscript') end;
  1149. function THTMLDocument.CreateAddressElement: THTMLElement; begin Result := CreateElement('address') end;
  1150. function THTMLDocument.CreateCenterElement: THTMLElement; begin Result := CreateElement('center') end;
  1151. function THTMLDocument.CreateHtmlElement: THTMLHtmlElement;
  1152. begin
  1153. Result := THTMLHtmlElement.Create(Self);
  1154. Result.FNSI.QName := HashForName('html');
  1155. end;
  1156. function THTMLDocument.CreateHeadElement: THTMLHeadElement;
  1157. begin
  1158. Result := THTMLHeadElement.Create(Self);
  1159. Result.FNSI.QName := HashForName('head');
  1160. end;
  1161. function THTMLDocument.CreateLinkElement: THTMLLinkElement;
  1162. begin
  1163. Result := THTMLLinkElement.Create(Self);
  1164. Result.FNSI.QName := HashForName('a');
  1165. end;
  1166. function THTMLDocument.CreateBodyElement: THTMLBodyElement;
  1167. begin
  1168. Result := THTMLBodyElement.Create(Self);
  1169. Result.FNSI.QName := HashForName('body');
  1170. end;
  1171. function THTMLDocument.CreateUListElement: THTMLUListElement;
  1172. begin
  1173. Result := THTMLUListElement.Create(Self);
  1174. Result.FNSI.QName := HashForName('ul');
  1175. end;
  1176. function THTMLDocument.CreateOListElement: THTMLOListElement;
  1177. begin
  1178. Result := THTMLOListElement.Create(Self);
  1179. Result.FNSI.QName := HashForName('ol');
  1180. end;
  1181. function THTMLDocument.CreateDListElement: THTMLDListElement;
  1182. begin
  1183. Result := THTMLDListElement.Create(Self);
  1184. Result.FNSI.QName := HashForName('dl');
  1185. end;
  1186. function THTMLDocument.CreateLIElement: THTMLLIElement;
  1187. begin
  1188. Result := THTMLLIElement.Create(Self);
  1189. Result.FNSI.QName := HashForName('li');
  1190. end;
  1191. //...
  1192. function THTMLDocument.CreateParagraphElement: THTMLParagraphElement;
  1193. begin
  1194. Result := THTMLParagraphElement.Create(Self);
  1195. Result.FNSI.QName := HashForName('p');
  1196. end;
  1197. { THTMLFormElement }
  1198. function FormElementsFilter(aNode: TDOMNode): TFilterResult;
  1199. begin
  1200. if (aNode.NodeType = ELEMENT_NODE) and ((aNode.NodeName = 'input') or
  1201. (aNode.NodeName = 'select') or (aNode.NodeName = 'textarea') or
  1202. (aNode.NodeName = 'label') or (aNode.NodeName = 'button')) then
  1203. Result := frTrue
  1204. else
  1205. Result := frFalse;
  1206. end;
  1207. function THTMLFormElement.GetElements: THTMLCollection;
  1208. begin
  1209. result := THTMLCollection.Create(Self, @FormElementsFilter);
  1210. end;
  1211. function THTMLFormElement.GetLength: Integer;
  1212. begin
  1213. with GetElements do
  1214. try
  1215. Result := Length;
  1216. finally
  1217. Free;
  1218. end;
  1219. end;
  1220. procedure THTMLFormElement.Submit;
  1221. begin
  1222. end;
  1223. procedure THTMLFormElement.Reset;
  1224. begin
  1225. end;
  1226. { THTMLMapElement }
  1227. function MapAreasFilter(aNode: TDOMNode): TFilterResult;
  1228. begin
  1229. if (aNode.NodeType = ELEMENT_NODE) and (aNode.NodeName = 'area') then
  1230. Result := frTrue
  1231. else
  1232. Result := frFalse;
  1233. end;
  1234. function THTMLMapElement.GetAreas: THTMLCollection;
  1235. begin
  1236. result := THTMLCollection.Create(Self, @MapAreasFilter);
  1237. end;
  1238. { THTMLSelectElement }
  1239. function SelectOptionFilter(aNode: TDOMNode): TFilterResult;
  1240. begin
  1241. if (aNode.NodeType = ELEMENT_NODE) and (aNode.NodeName = 'option') then
  1242. Result := frTrue
  1243. else
  1244. Result := frFalse;
  1245. end;
  1246. function THTMLSelectElement.GetType: DOMString;
  1247. begin
  1248. if HasAttribute(HTMLAttributeTag[atmultiple]) then
  1249. result := 'select-multiple'
  1250. else
  1251. result := 'select-one';
  1252. end;
  1253. function THTMLSelectElement.GetValue: DOMString;
  1254. begin
  1255. result := '';
  1256. end;
  1257. procedure THTMLSelectElement.SetValue(const value: DOMString);
  1258. begin
  1259. end;
  1260. function THTMLSelectElement.GetOptions: THTMLOptionsCollection;
  1261. begin
  1262. result := THTMLOptionsCollection.Create(Self, @SelectOptionFilter);
  1263. end;
  1264. procedure THTMLSelectElement.Add(Element, Before: THTMLElement);
  1265. begin
  1266. end;
  1267. procedure THTMLSelectElement.Remove(Index: Integer);
  1268. begin
  1269. end;
  1270. procedure THTMLSelectElement.Blur;
  1271. begin
  1272. end;
  1273. procedure THTMLSelectElement.Focus;
  1274. begin
  1275. end;
  1276. function THTMLSelectElement.GetLength: Cardinal;
  1277. begin
  1278. with GetOptions do
  1279. try
  1280. Result := Length;
  1281. finally
  1282. Free;
  1283. end;
  1284. end;
  1285. procedure THTMLSelectElement.SetLength(aValue: Cardinal);
  1286. begin
  1287. raise EDOMNotSupported.Create('HTMLSelectElement.SetLength');
  1288. end;
  1289. { THTMLTableRowElement }
  1290. function RowCellsFilter(aNode: TDOMNode): TFilterResult;
  1291. begin
  1292. if (aNode.NodeType = ELEMENT_NODE) and
  1293. ((aNode.NodeName = 'td') or (aNode.NodeName = 'th')) then
  1294. Result := frNorecurseTrue
  1295. else
  1296. Result := frFalse;
  1297. end;
  1298. function THTMLTableRowElement.GetCells: THTMLCollection;
  1299. begin
  1300. result := THTMLCollection.Create(Self, @RowCellsFilter);
  1301. end;
  1302. function THTMLTableRowElement.GetRowIndex: Integer;
  1303. begin
  1304. { result := SectionRowIndex;
  1305. if parent is 'tbody' then inc(result, table.head.rowcount);
  1306. if parent is 'tfoot' then inc(result, table.bodies.rowcount);
  1307. // what about multiple bodies?
  1308. }
  1309. result := -1;
  1310. end;
  1311. function THTMLTableRowElement.GetSectionRowIndex: Integer;
  1312. var
  1313. node: TDOMNode;
  1314. begin
  1315. result := 0;
  1316. node := PreviousSibling;
  1317. while Assigned(node) do
  1318. begin
  1319. // TODO: should we also check whether the name is same?
  1320. if node.NodeType = ELEMENT_NODE then
  1321. Inc(result);
  1322. node := node.PreviousSibling;
  1323. end;
  1324. end;
  1325. function THTMLTableRowElement.InsertCell(Index: Integer): THTMLElement;
  1326. var
  1327. cell: TDOMNode;
  1328. begin
  1329. with GetCells do
  1330. try
  1331. if (Index < -1) or (Index > Integer(Length)) then
  1332. raise EDOMIndexSize.Create('HTMLTableRowElement.InsertCell');
  1333. cell := GetItem(LongWord(Index)); // may be nil
  1334. Result := THTMLTableCellElement.Create(OwnerDocument);
  1335. Result.FNSI.QName := THTMLDocument(OwnerDocument).HashForName('td');
  1336. InsertBefore(Result, cell);
  1337. finally
  1338. Free;
  1339. end;
  1340. end;
  1341. procedure THTMLTableRowElement.DeleteCell(Index: Integer);
  1342. var
  1343. cell: TDOMNode;
  1344. begin
  1345. with GetCells do
  1346. try
  1347. if Index = -1 then
  1348. Index := Length-1;
  1349. cell := GetItem(LongWord(Index));
  1350. if cell = nil then
  1351. raise EDOMIndexSize.Create('HTMLTableRowElement.DeleteCell');
  1352. RemoveChild(cell);
  1353. finally
  1354. Free;
  1355. end;
  1356. end;
  1357. { THTMLTableCellElement }
  1358. function THTMLTableCellElement.GetCellIndex: Integer;
  1359. var
  1360. node: TDOMNode;
  1361. begin
  1362. result := 0;
  1363. node := PreviousSibling;
  1364. while Assigned(node) do
  1365. begin
  1366. // TODO: should we also check whether the name is same?
  1367. if node.NodeType = ELEMENT_NODE then
  1368. Inc(result);
  1369. node := node.PreviousSibling;
  1370. end;
  1371. end;
  1372. { THTMLOptionElement }
  1373. // TODO: probably should account for possible OPTGROUP elements (no tests)
  1374. function THTMLOptionElement.GetIndex: Integer;
  1375. var
  1376. node: TDOMNode;
  1377. begin
  1378. result := 0;
  1379. node := PreviousSibling;
  1380. while Assigned(node) do
  1381. begin
  1382. // TODO: should we also check whether the name is same?
  1383. if node.NodeType = ELEMENT_NODE then
  1384. Inc(result);
  1385. node := node.PreviousSibling;
  1386. end;
  1387. end;
  1388. { THTMLTextAreaElement }
  1389. function THTMLTextAreaElement.GetType: DOMString;
  1390. begin
  1391. result := 'textarea';
  1392. end;
  1393. procedure THTMLTextAreaElement.Blur;
  1394. begin
  1395. end;
  1396. procedure THTMLTextAreaElement.Focus;
  1397. begin
  1398. end;
  1399. procedure THTMLTextAreaElement.Select;
  1400. begin
  1401. end;
  1402. { THTMLInputElement }
  1403. procedure THTMLInputElement.Blur;
  1404. begin
  1405. end;
  1406. procedure THTMLInputElement.Focus;
  1407. begin
  1408. end;
  1409. procedure THTMLInputElement.Select;
  1410. begin
  1411. end;
  1412. procedure THTMLInputElement.Click;
  1413. begin
  1414. end;
  1415. { THTMLAnchorElement }
  1416. procedure THTMLAnchorElement.Blur;
  1417. begin
  1418. end;
  1419. procedure THTMLAnchorElement.Focus;
  1420. begin
  1421. end;
  1422. { THTMLObjectElement }
  1423. function THTMLObjectElement.GetContentDocument: TDOMDocument;
  1424. begin
  1425. result := nil;
  1426. end;
  1427. { THTMLScriptElement }
  1428. function THTMLScriptElement.GetEvent: DOMString;
  1429. begin
  1430. Result := '';
  1431. end;
  1432. procedure THTMLScriptElement.SetEvent(const Value: DOMString);
  1433. begin
  1434. end;
  1435. end.