Reviewed by Eric.
[WebKit-https.git] / WebCore / bindings / js / kjs_html.cpp
1 // -*- c-basic-offset: 4 -*-
2 /*
3  *  This file is part of the KDE libraries
4  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
5  *  Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6  *
7  *  This library is free software; you can redistribute it and/or
8  *  modify it under the terms of the GNU Lesser General Public
9  *  License as published by the Free Software Foundation; either
10  *  version 2 of the License, or (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public
18  *  License along with this library; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include "config.h"
23 #include "kjs_html.h"
24
25 #include "DocLoader.h"
26 #include "EventNames.h"
27 #include "Frame.h"
28 #include "HTMLBaseFontElement.h"
29 #include "HTMLButtonElement.h"
30 #include "HTMLDocument.h"
31 #include "HTMLFieldSetElement.h"
32 #include "HTMLFormElement.h"
33 #include "HTMLIsIndexElement.h"
34 #include "HTMLLabelElement.h"
35 #include "HTMLLegendElement.h"
36 #include "HTMLOptGroupElement.h"
37 #include "HTMLOptionElement.h"
38 #include "HTMLOptionsCollection.h"
39 #include "HTMLSelectElement.h"
40 #include "HTMLTextAreaElement.h"
41 #include "NameNodeList.h"
42 #include "RenderLayer.h"
43 #include "Text.h"
44 #include "css_ruleimpl.h"
45 #include "dom2_eventsimpl.h"
46 #include "html_baseimpl.h"
47 #include "html_blockimpl.h"
48 #include "html_headimpl.h"
49 #include "html_imageimpl.h"
50 #include "html_inlineimpl.h"
51 #include "html_listimpl.h"
52 #include "html_objectimpl.h"
53 #include "html_tableimpl.h"
54 #include "kjs_css.h"
55 #include "kjs_events.h"
56 #include "kjs_proxy.h"
57 #include "kjs_window.h"
58
59 #include "kjs_html.lut.h"
60
61 using namespace WebCore;
62 using namespace HTMLNames;
63 using namespace EventNames;
64
65 namespace KJS {
66
67 class HTMLElementFunction : public InternalFunctionImp {
68 public:
69   HTMLElementFunction(ExecState *exec, int i, int len, const Identifier& name);
70   virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List&args);
71 private:
72   int id;
73 };
74
75 KJS_IMPLEMENT_PROTOFUNC(HTMLDocFunction)
76
77 JSValue *HTMLDocFunction::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
78 {
79   if (!thisObj->inherits(&JSHTMLDocument::info))
80     return throwError(exec, TypeError);
81   HTMLDocument &doc = *static_cast<HTMLDocument *>(static_cast<JSHTMLDocument *>(thisObj)->impl());
82
83   switch (id) {
84   case JSHTMLDocument::Clear: // even IE doesn't support that one...
85     //doc.clear(); // TODO
86     return jsUndefined();
87   case JSHTMLDocument::Open:
88     // For compatibility with other browsers, pass open calls with more than 2 parameters to the window.
89     if (args.size() > 2) {
90       Frame *frame = doc.frame();
91       if (frame) {
92         Window *window = Window::retrieveWindow(frame);
93         if (window) {
94           JSObject *functionObject = window->get(exec, "open")->getObject();
95           if (!functionObject || !functionObject->implementsCall())
96             return throwError(exec, TypeError);
97           return functionObject->call(exec, window, args);
98         }
99       }
100       return jsUndefined();
101     }
102     // In the case of two parameters or fewer, do a normal document open.
103     doc.open();
104     return jsUndefined();
105   case JSHTMLDocument::Close:
106     doc.close();
107     return jsUndefined();
108   case JSHTMLDocument::Write:
109   case JSHTMLDocument::WriteLn: {
110     // DOM only specifies single string argument, but NS & IE allow multiple
111     // or no arguments
112     String str = "";
113     for (int i = 0; i < args.size(); i++)
114       str += args[i]->toString(exec);
115     if (id == JSHTMLDocument::WriteLn)
116       str += "\n";
117     doc.write(str);
118     return jsUndefined();
119   }
120   case JSHTMLDocument::GetElementsByName:
121     return toJS(exec, doc.getElementsByName(args[0]->toString(exec)).get());
122   case JSHTMLDocument::CaptureEvents:
123   case JSHTMLDocument::ReleaseEvents:
124     // Do nothing for now. These are NS-specific legacy calls.
125     break;
126   }
127
128   return jsUndefined();
129 }
130
131 // FIXME: functions should be in the prototype
132 const ClassInfo JSHTMLDocument::info =
133   { "HTMLDocument", &JSDocument::info, &HTMLDocumentTable, 0 };
134 /* Source for HTMLDocumentTable. Use "make hashtables" to regenerate.
135 @begin HTMLDocumentTable 30
136   title                 JSHTMLDocument::Title             DontDelete
137   referrer              JSHTMLDocument::Referrer          DontDelete|ReadOnly
138   domain                JSHTMLDocument::Domain            DontDelete
139   URL                   JSHTMLDocument::URL               DontDelete|ReadOnly
140   body                  JSHTMLDocument::Body              DontDelete
141   location              JSHTMLDocument::Location          DontDelete
142   cookie                JSHTMLDocument::Cookie            DontDelete
143   images                JSHTMLDocument::Images            DontDelete|ReadOnly
144   embeds                JSHTMLDocument::Embeds            DontDelete|ReadOnly
145   plugins               JSHTMLDocument::Embeds            DontDelete|ReadOnly
146   applets               JSHTMLDocument::Applets           DontDelete|ReadOnly
147   links                 JSHTMLDocument::Links             DontDelete|ReadOnly
148   forms                 JSHTMLDocument::Forms             DontDelete|ReadOnly
149   anchors               JSHTMLDocument::Anchors           DontDelete|ReadOnly
150   scripts               JSHTMLDocument::Scripts           DontDelete|ReadOnly
151   all                   JSHTMLDocument::All               
152   clear                 JSHTMLDocument::Clear             DontDelete|Function 0
153   open                  JSHTMLDocument::Open              DontDelete|Function 0
154   close                 JSHTMLDocument::Close             DontDelete|Function 0
155   write                 JSHTMLDocument::Write             DontDelete|Function 1
156   writeln               JSHTMLDocument::WriteLn           DontDelete|Function 1
157   getElementsByName     JSHTMLDocument::GetElementsByName DontDelete|Function 1
158   captureEvents         JSHTMLDocument::CaptureEvents     DontDelete|Function 0
159   releaseEvents         JSHTMLDocument::ReleaseEvents     DontDelete|Function 0
160   bgColor               JSHTMLDocument::BgColor           DontDelete
161   fgColor               JSHTMLDocument::FgColor           DontDelete
162   alinkColor            JSHTMLDocument::AlinkColor        DontDelete
163   linkColor             JSHTMLDocument::LinkColor         DontDelete
164   vlinkColor            JSHTMLDocument::VlinkColor        DontDelete
165   lastModified          JSHTMLDocument::LastModified      DontDelete|ReadOnly
166   height                JSHTMLDocument::Height            DontDelete|ReadOnly
167   width                 JSHTMLDocument::Width             DontDelete|ReadOnly
168   dir                   JSHTMLDocument::Dir               DontDelete
169   designMode            JSHTMLDocument::DesignMode        DontDelete
170 #potentially obsolete array properties
171 # layers
172 # plugins
173 # tags
174 #potentially obsolete properties
175 # embeds
176 # ids
177 @end
178 */
179
180 JSHTMLDocument::JSHTMLDocument(ExecState *exec, HTMLDocument *d)
181   : JSDocument(exec, d)
182 {
183 }
184
185 JSValue *JSHTMLDocument::namedItemGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
186 {
187   JSHTMLDocument *thisObj = static_cast<JSHTMLDocument *>(slot.slotBase());
188   HTMLDocument &doc = *static_cast<HTMLDocument *>(thisObj->impl());
189
190   String name = propertyName;
191   RefPtr<WebCore::HTMLCollection> collection = doc.documentNamedItems(name);
192
193   if (collection->length() == 1) {
194     WebCore::Node* node = collection->firstItem();
195     Frame *frame;
196     if (node->hasTagName(iframeTag) && (frame = static_cast<WebCore::HTMLIFrameElement *>(node)->contentFrame()))
197       return Window::retrieve(frame);
198     return toJS(exec, node);
199   }
200
201   return getHTMLCollection(exec, collection.get());
202 }
203
204 JSValue *JSHTMLDocument::getValueProperty(ExecState *exec, int token) const
205 {
206   HTMLDocument &doc = *static_cast<HTMLDocument *>(impl());
207
208   FrameView *view = doc.view();
209   Frame *frame = doc.frame();
210
211   HTMLElement *body = doc.body();
212   HTMLBodyElement *bodyElement = (body && body->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement *>(body) : 0;
213     
214   switch (token) {
215   case Title:
216     return jsString(doc.title());
217   case Referrer:
218     return jsString(doc.referrer());
219   case Domain:
220     return jsString(doc.domain());
221   case URL:
222     return jsString(doc.URL());
223   case Body:
224     return toJS(exec, body);
225   case Location:
226     if (Window* win = Window::retrieveWindow(frame))
227       return win->location();
228     return jsUndefined();
229   case Cookie:
230     return jsString(doc.cookie());
231   case Images:
232     return getHTMLCollection(exec, doc.images().get());
233   case Embeds:
234     return getHTMLCollection(exec, doc.embeds().get());
235   case Applets:
236     return getHTMLCollection(exec, doc.applets().get());
237   case Links:
238     return getHTMLCollection(exec, doc.links().get());
239   case Forms:
240     return getHTMLCollection(exec, doc.forms().get());
241   case Anchors:
242     return getHTMLCollection(exec, doc.anchors().get());
243   case Scripts: // TODO (IE-specific)
244     {
245       // To be implemented. Meanwhile, return an object with a length property set to 0
246       JSObject *obj = new JSObject;
247       obj->put(exec, lengthPropertyName, jsNumber(0));
248       return obj;
249     }
250   case All:
251     // If "all" has been overwritten, return the overwritten value
252     if (JSValue *v = getDirect("all"))
253       return v;
254     else
255       return getAllHTMLCollection(exec, doc.all().get());
256   case BgColor:
257     if (!bodyElement)
258       return jsUndefined();
259     return jsString(bodyElement->bgColor());
260   case FgColor:
261     if (!bodyElement)
262       return jsUndefined();
263     return jsString(bodyElement->text());
264   case AlinkColor:
265     if (!bodyElement)
266       return jsUndefined();
267     return jsString(bodyElement->aLink());
268   case LinkColor:
269     if (!bodyElement)
270       return jsUndefined();
271     return jsString(bodyElement->link());
272   case VlinkColor:
273     if (!bodyElement)
274       return jsUndefined();
275     return jsString(bodyElement->vLink());
276   case LastModified:
277     return jsString(doc.lastModified());
278   case Height:
279     return jsNumber(view ? view->contentsHeight() : 0);
280   case Width:
281     return jsNumber(view ? view->contentsWidth() : 0);
282   case Dir:
283     if (!bodyElement)
284       return jsUndefined();
285     return jsString(bodyElement->dir());
286   case DesignMode:
287     return jsString(doc.inDesignMode() ? "on" : "off");
288   default:
289     assert(0);
290     return jsUndefined();
291   }
292 }
293
294 bool JSHTMLDocument::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
295 {
296   HTMLDocument &doc = *static_cast<HTMLDocument *>(impl());
297
298   String name = propertyName;
299   if (doc.hasNamedItem(name) || doc.hasDocExtraNamedItem(name)) {
300     slot.setCustom(this, namedItemGetter);
301     return true;
302   }
303
304   const HashEntry* entry = Lookup::findEntry(&HTMLDocumentTable, propertyName);
305   if (entry) {
306     if (entry->attr & Function)
307       slot.setStaticEntry(this, entry, staticFunctionGetter<HTMLDocFunction>);
308     else 
309       slot.setStaticEntry(this, entry, staticValueGetter<JSHTMLDocument>);
310     return true;
311   }
312
313   return JSDocument::getOwnPropertySlot(exec, propertyName, slot);
314 }
315
316 void JSHTMLDocument::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr)
317 {
318     lookupPut<JSHTMLDocument, JSDocument>(exec, propertyName, value, attr, &HTMLDocumentTable, this);
319 }
320
321 void JSHTMLDocument::putValueProperty(ExecState *exec, int token, JSValue *value, int /*attr*/)
322 {
323   DOMExceptionTranslator exception(exec);
324   HTMLDocument &doc = *static_cast<HTMLDocument *>(impl());
325   HTMLElement *body = doc.body();
326   HTMLBodyElement *bodyElement = (body && body->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement *>(body) : 0;
327
328   switch (token) {
329   case Title:
330     doc.setTitle(value->toString(exec));
331     break;
332   case Body:
333     doc.setBody(toHTMLElement(value), exception);
334     break;
335   case Domain: // not part of the DOM
336     doc.setDomain(value->toString(exec));
337     break;
338   case Cookie:
339     doc.setCookie(value->toString(exec));
340     break;
341   case Location: {
342     Frame *frame = doc.frame();
343     if (frame)
344     {
345       DeprecatedString str = value->toString(exec);
346
347       // When assigning location, IE and Mozilla both resolve the URL
348       // relative to the frame where the JavaScript is executing not
349       // the target frame.
350       Frame *activePart = static_cast<ScriptInterpreter *>( exec->dynamicInterpreter() )->frame();
351       if (activePart)
352         str = activePart->document()->completeURL(str);
353
354       // We want a new history item if this JS was called via a user gesture
355       bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
356       frame->scheduleLocationChange(str, activePart->referrer(), !userGesture);
357     }
358     break;
359   }
360   case BgColor:
361     if (bodyElement)
362       bodyElement->setBgColor(value->toString(exec));
363     break;
364   case FgColor:
365     if (bodyElement)
366       bodyElement->setText(value->toString(exec));
367     break;
368   case AlinkColor:
369     if (bodyElement) {
370       // this check is a bit silly, but some benchmarks like to set the
371       // document's link colors over and over to the same value and we
372       // don't want to incur a style update each time.
373       String newColor = value->toString(exec);
374       if (bodyElement->aLink() != newColor)
375         bodyElement->setALink(newColor);
376     }
377     break;
378   case LinkColor:
379     if (bodyElement) {
380       // this check is a bit silly, but some benchmarks like to set the
381       // document's link colors over and over to the same value and we
382       // don't want to incur a style update each time.
383       String newColor = value->toString(exec);
384       if (bodyElement->link() != newColor)
385         bodyElement->setLink(newColor);
386     }
387     break;
388   case VlinkColor:
389     if (bodyElement) {
390       // this check is a bit silly, but some benchmarks like to set the
391       // document's link colors over and over to the same value and we
392       // don't want to incur a style update each time.
393       String newColor = value->toString(exec);
394       if (bodyElement->vLink() != newColor)
395         bodyElement->setVLink(newColor);
396     }
397     break;
398   case Dir:
399     body->setDir(value->toString(exec));
400     break;
401   case DesignMode:
402     {
403       String modeString = value->toString(exec);
404       Document::InheritedBool mode;
405       if (equalIgnoringCase(modeString, "on"))
406         mode = Document::on;
407       else if (equalIgnoringCase(modeString, "off"))
408         mode = Document::off;
409       else
410         mode = Document::inherit;
411       doc.setDesignMode(mode);
412       break;
413     }
414   case All:
415     // Add "all" to the property map.
416     putDirect("all", value);
417     break;
418   }
419 }
420
421 // -------------------------------------------------------------------------
422
423 const ClassInfo JSHTMLElement::a_info = { "HTMLAnchorElement", &JSHTMLElement::info, &HTMLAnchorElementTable, 0 };
424 const ClassInfo JSHTMLElement::applet_info = { "HTMLAppletElement", &JSHTMLElement::info, &HTMLAppletElementTable, 0 };
425 const ClassInfo JSHTMLElement::area_info = { "HTMLAreaElement", &JSHTMLElement::info, &HTMLAreaElementTable, 0 };
426 const ClassInfo JSHTMLElement::baseFont_info = { "HTMLBaseFontElement", &JSHTMLElement::info, &HTMLBaseFontElementTable, 0 };
427 const ClassInfo JSHTMLElement::base_info = { "HTMLBaseElement", &JSHTMLElement::info, &HTMLBaseElementTable, 0 };
428 const ClassInfo JSHTMLElement::blockQuote_info = { "HTMLBlockQuoteElement", &JSHTMLElement::info, &HTMLBlockQuoteElementTable, 0 };
429 const ClassInfo JSHTMLElement::body_info = { "HTMLBodyElement", &JSHTMLElement::info, &HTMLBodyElementTable, 0 };
430 const ClassInfo JSHTMLElement::br_info = { "HTMLBRElement", &JSHTMLElement::info, &HTMLBRElementTable, 0 };
431 const ClassInfo JSHTMLElement::button_info = { "HTMLButtonElement", &JSHTMLElement::info, &HTMLButtonElementTable, 0 };
432 const ClassInfo JSHTMLElement::caption_info = { "HTMLTableCaptionElement", &JSHTMLElement::info, &HTMLTableCaptionElementTable, 0 };
433 const ClassInfo JSHTMLElement::col_info = { "HTMLTableColElement", &JSHTMLElement::info, &HTMLTableColElementTable, 0 };
434 const ClassInfo JSHTMLElement::dir_info = { "HTMLDirectoryElement", &JSHTMLElement::info, &HTMLDirectoryElementTable, 0 };
435 const ClassInfo JSHTMLElement::div_info = { "HTMLDivElement", &JSHTMLElement::info, &HTMLDivElementTable, 0 };
436 const ClassInfo JSHTMLElement::dl_info = { "HTMLDListElement", &JSHTMLElement::info, &HTMLDListElementTable, 0 };
437 const ClassInfo JSHTMLElement::fieldSet_info = { "HTMLFieldSetElement", &JSHTMLElement::info, &HTMLFieldSetElementTable, 0 };
438 const ClassInfo JSHTMLElement::font_info = { "HTMLFontElement", &JSHTMLElement::info, &HTMLFontElementTable, 0 };
439 const ClassInfo JSHTMLElement::form_info = { "HTMLFormElement", &JSHTMLElement::info, &HTMLFormElementTable, 0 };
440 const ClassInfo JSHTMLElement::frameSet_info = { "HTMLFrameSetElement", &JSHTMLElement::info, &HTMLFrameSetElementTable, 0 };
441 const ClassInfo JSHTMLElement::frame_info = { "HTMLFrameElement", &JSHTMLElement::info, &HTMLFrameElementTable, 0 };
442 const ClassInfo JSHTMLElement::head_info = { "HTMLHeadElement", &JSHTMLElement::info, &HTMLHeadElementTable, 0 };
443 const ClassInfo JSHTMLElement::heading_info = { "HTMLHeadingElement", &JSHTMLElement::info, &HTMLHeadingElementTable, 0 };
444 const ClassInfo JSHTMLElement::hr_info = { "HTMLHRElement", &JSHTMLElement::info, &HTMLHRElementTable, 0 };
445 const ClassInfo JSHTMLElement::html_info = { "HTMLHtmlElement", &JSHTMLElement::info, &HTMLHtmlElementTable, 0 };
446 const ClassInfo JSHTMLElement::iFrame_info = { "HTMLIFrameElement", &JSHTMLElement::info, &HTMLIFrameElementTable, 0 };
447 const ClassInfo JSHTMLElement::img_info = { "HTMLImageElement", &JSHTMLElement::info, &HTMLImageElementTable, 0 };
448 const ClassInfo JSHTMLElement::info = { "HTMLElement", &JSElement::info, &HTMLElementTable, 0 };
449 const ClassInfo JSHTMLElement::input_info = { "HTMLInputElement", &JSHTMLElement::info, &HTMLInputElementTable, 0 };
450 const ClassInfo JSHTMLElement::isIndex_info = { "HTMLIsIndexElement", &JSHTMLElement::info, &HTMLIsIndexElementTable, 0 };
451 const ClassInfo JSHTMLElement::label_info = { "HTMLLabelElement", &JSHTMLElement::info, &HTMLLabelElementTable, 0 };
452 const ClassInfo JSHTMLElement::legend_info = { "HTMLLegendElement", &JSHTMLElement::info, &HTMLLegendElementTable, 0 };
453 const ClassInfo JSHTMLElement::li_info = { "HTMLLIElement", &JSHTMLElement::info, &HTMLLIElementTable, 0 };
454 const ClassInfo JSHTMLElement::link_info = { "HTMLLinkElement", &JSHTMLElement::info, &HTMLLinkElementTable, 0 };
455 const ClassInfo JSHTMLElement::map_info = { "HTMLMapElement", &JSHTMLElement::info, &HTMLMapElementTable, 0 };
456 const ClassInfo JSHTMLElement::marquee_info = { "HTMLMarqueeElement", &JSHTMLElement::info, &HTMLMarqueeElementTable, 0 };
457 const ClassInfo JSHTMLElement::menu_info = { "HTMLMenuElement", &JSHTMLElement::info, &HTMLMenuElementTable, 0 };
458 const ClassInfo JSHTMLElement::meta_info = { "HTMLMetaElement", &JSHTMLElement::info, &HTMLMetaElementTable, 0 };
459 const ClassInfo JSHTMLElement::mod_info = { "HTMLModElement", &JSHTMLElement::info, &HTMLModElementTable, 0 };
460 const ClassInfo JSHTMLElement::object_info = { "HTMLObjectElement", &JSHTMLElement::info, &HTMLObjectElementTable, 0 };
461 const ClassInfo JSHTMLElement::ol_info = { "HTMLOListElement", &JSHTMLElement::info, &HTMLOListElementTable, 0 };
462 const ClassInfo JSHTMLElement::optGroup_info = { "HTMLOptGroupElement", &JSHTMLElement::info, &HTMLOptGroupElementTable, 0 };
463 const ClassInfo JSHTMLElement::option_info = { "HTMLOptionElement", &JSHTMLElement::info, &HTMLOptionElementTable, 0 };
464 const ClassInfo JSHTMLElement::p_info = { "HTMLParagraphElement", &JSHTMLElement::info, &HTMLParagraphElementTable, 0 };
465 const ClassInfo JSHTMLElement::param_info = { "HTMLParamElement", &JSHTMLElement::info, &HTMLParamElementTable, 0 };
466 const ClassInfo JSHTMLElement::pre_info = { "HTMLPreElement", &JSHTMLElement::info, &HTMLPreElementTable, 0 };
467 const ClassInfo JSHTMLElement::q_info = { "HTMLQuoteElement", &JSHTMLElement::info, &HTMLQuoteElementTable, 0 };
468 const ClassInfo JSHTMLElement::script_info = { "HTMLScriptElement", &JSHTMLElement::info, &HTMLScriptElementTable, 0 };
469 const ClassInfo JSHTMLElement::select_info = { "HTMLSelectElement", &JSHTMLElement::info, &HTMLSelectElementTable, 0 };
470 const ClassInfo JSHTMLElement::style_info = { "HTMLStyleElement", &JSHTMLElement::info, &HTMLStyleElementTable, 0 };
471 const ClassInfo JSHTMLElement::table_info = { "HTMLTableElement", &JSHTMLElement::info, &HTMLTableElementTable, 0 };
472 const ClassInfo JSHTMLElement::tablecell_info = { "HTMLTableCellElement", &JSHTMLElement::info, &HTMLTableCellElementTable, 0 };
473 const ClassInfo JSHTMLElement::tablesection_info = { "HTMLTableSectionElement", &JSHTMLElement::info, &HTMLTableSectionElementTable, 0 };
474 const ClassInfo JSHTMLElement::textArea_info = { "HTMLTextAreaElement", &JSHTMLElement::info, &HTMLTextAreaElementTable, 0 };
475 const ClassInfo JSHTMLElement::title_info = { "HTMLTitleElement", &JSHTMLElement::info, &HTMLTitleElementTable, 0 };
476 const ClassInfo JSHTMLElement::tr_info = { "HTMLTableRowElement", &JSHTMLElement::info, &HTMLTableRowElementTable, 0 };
477 const ClassInfo JSHTMLElement::ul_info = { "HTMLUListElement", &JSHTMLElement::info, &HTMLUListElementTable, 0 };
478
479 const ClassInfo* JSHTMLElement::classInfo() const
480 {
481     static HashMap<WebCore::AtomicStringImpl*, const ClassInfo*> classInfoMap;
482     if (classInfoMap.isEmpty()) {
483         classInfoMap.set(appletTag.localName().impl(), &applet_info);
484         classInfoMap.set(areaTag.localName().impl(), &area_info);
485         classInfoMap.set(baseTag.localName().impl(), &base_info);
486         classInfoMap.set(basefontTag.localName().impl(), &baseFont_info);
487         classInfoMap.set(blockquoteTag.localName().impl(), &blockQuote_info);
488         classInfoMap.set(bodyTag.localName().impl(), &body_info);
489         classInfoMap.set(brTag.localName().impl(), &br_info);
490         classInfoMap.set(buttonTag.localName().impl(), &button_info);
491         classInfoMap.set(captionTag.localName().impl(), &caption_info);
492         classInfoMap.set(colTag.localName().impl(), &col_info);
493         classInfoMap.set(colgroupTag.localName().impl(), &col_info);
494         classInfoMap.set(delTag.localName().impl(), &mod_info);
495         classInfoMap.set(dirTag.localName().impl(), &dir_info);
496         classInfoMap.set(divTag.localName().impl(), &div_info);
497         classInfoMap.set(dlTag.localName().impl(), &dl_info);
498         classInfoMap.set(fieldsetTag.localName().impl(), &fieldSet_info);
499         classInfoMap.set(fontTag.localName().impl(), &font_info);
500         classInfoMap.set(formTag.localName().impl(), &form_info);
501         classInfoMap.set(frameTag.localName().impl(), &frame_info);
502         classInfoMap.set(framesetTag.localName().impl(), &frameSet_info);
503         classInfoMap.set(h1Tag.localName().impl(), &heading_info);
504         classInfoMap.set(h2Tag.localName().impl(), &heading_info);
505         classInfoMap.set(h3Tag.localName().impl(), &heading_info);
506         classInfoMap.set(h4Tag.localName().impl(), &heading_info);
507         classInfoMap.set(h5Tag.localName().impl(), &heading_info);
508         classInfoMap.set(h6Tag.localName().impl(), &heading_info);
509         classInfoMap.set(headTag.localName().impl(), &head_info);
510         classInfoMap.set(hrTag.localName().impl(), &hr_info);
511         classInfoMap.set(htmlTag.localName().impl(), &html_info);
512         classInfoMap.set(iframeTag.localName().impl(), &iFrame_info);
513         classInfoMap.set(imgTag.localName().impl(), &img_info);
514         classInfoMap.set(inputTag.localName().impl(), &input_info);
515         classInfoMap.set(insTag.localName().impl(), &mod_info);
516         classInfoMap.set(isindexTag.localName().impl(), &isIndex_info);
517         classInfoMap.set(labelTag.localName().impl(), &label_info);
518         classInfoMap.set(legendTag.localName().impl(), &legend_info);
519         classInfoMap.set(liTag.localName().impl(), &li_info);
520         classInfoMap.set(linkTag.localName().impl(), &link_info);
521         classInfoMap.set(listingTag.localName().impl(), &pre_info);
522         classInfoMap.set(mapTag.localName().impl(), &map_info);
523         classInfoMap.set(marqueeTag.localName().impl(), &marquee_info);
524         classInfoMap.set(menuTag.localName().impl(), &menu_info);
525         classInfoMap.set(metaTag.localName().impl(), &meta_info);
526         classInfoMap.set(objectTag.localName().impl(), &object_info);
527         classInfoMap.set(olTag.localName().impl(), &ol_info);
528         classInfoMap.set(optgroupTag.localName().impl(), &optGroup_info);
529         classInfoMap.set(optionTag.localName().impl(), &option_info);
530         classInfoMap.set(pTag.localName().impl(), &p_info);
531         classInfoMap.set(paramTag.localName().impl(), &param_info);
532         classInfoMap.set(preTag.localName().impl(), &pre_info);
533         classInfoMap.set(qTag.localName().impl(), &q_info);
534         classInfoMap.set(scriptTag.localName().impl(), &script_info);
535         classInfoMap.set(selectTag.localName().impl(), &select_info);
536         classInfoMap.set(styleTag.localName().impl(), &style_info);
537         classInfoMap.set(tableTag.localName().impl(), &table_info);
538         classInfoMap.set(tbodyTag.localName().impl(), &tablesection_info);
539         classInfoMap.set(tdTag.localName().impl(), &tablecell_info);
540         classInfoMap.set(textareaTag.localName().impl(), &textArea_info);
541         classInfoMap.set(tfootTag.localName().impl(), &tablesection_info);
542         classInfoMap.set(thTag.localName().impl(), &tablecell_info);
543         classInfoMap.set(theadTag.localName().impl(), &tablesection_info);
544         classInfoMap.set(titleTag.localName().impl(), &title_info);
545         classInfoMap.set(trTag.localName().impl(), &tr_info);
546         classInfoMap.set(ulTag.localName().impl(), &ul_info);
547         classInfoMap.set(aTag.localName().impl(), &a_info);
548     }
549     
550     HTMLElement* element = static_cast<HTMLElement*>(impl());
551     const ClassInfo* result = classInfoMap.get(element->localName().impl());
552     if (result)
553         return result;
554     return &info;
555 }
556
557 const JSHTMLElement::Accessors JSHTMLElement::html_accessors = { &JSHTMLElement::htmlGetter, &JSHTMLElement::htmlSetter };
558 const JSHTMLElement::Accessors JSHTMLElement::head_accessors = { &JSHTMLElement::headGetter, &JSHTMLElement::headSetter };
559 const JSHTMLElement::Accessors JSHTMLElement::link_accessors = { &JSHTMLElement::linkGetter, &JSHTMLElement::linkSetter };
560 const JSHTMLElement::Accessors JSHTMLElement::title_accessors = { &JSHTMLElement::titleGetter, &JSHTMLElement::titleSetter };
561 const JSHTMLElement::Accessors JSHTMLElement::meta_accessors = { &JSHTMLElement::metaGetter, &JSHTMLElement::metaSetter };
562 const JSHTMLElement::Accessors JSHTMLElement::base_accessors = { &JSHTMLElement::baseGetter, &JSHTMLElement::baseSetter };
563 const JSHTMLElement::Accessors JSHTMLElement::isIndex_accessors = { &JSHTMLElement::isIndexGetter, &JSHTMLElement::isIndexSetter };
564 const JSHTMLElement::Accessors JSHTMLElement::style_accessors = { &JSHTMLElement::styleGetter, &JSHTMLElement::styleSetter };
565 const JSHTMLElement::Accessors JSHTMLElement::body_accessors = { &JSHTMLElement::bodyGetter, &JSHTMLElement::bodySetter };
566 const JSHTMLElement::Accessors JSHTMLElement::form_accessors = { &JSHTMLElement::formGetter, &JSHTMLElement::formSetter };
567 const JSHTMLElement::Accessors JSHTMLElement::select_accessors = { &JSHTMLElement::selectGetter, &JSHTMLElement::selectSetter };
568 const JSHTMLElement::Accessors JSHTMLElement::optGroup_accessors = { &JSHTMLElement::optGroupGetter, &JSHTMLElement::optGroupSetter };
569 const JSHTMLElement::Accessors JSHTMLElement::option_accessors = { &JSHTMLElement::optionGetter, &JSHTMLElement::optionSetter };
570 const JSHTMLElement::Accessors JSHTMLElement::input_accessors = { &JSHTMLElement::inputGetter, &JSHTMLElement::inputSetter };
571 const JSHTMLElement::Accessors JSHTMLElement::textArea_accessors = { &JSHTMLElement::textAreaGetter, &JSHTMLElement::textAreaSetter };
572 const JSHTMLElement::Accessors JSHTMLElement::button_accessors = { &JSHTMLElement::buttonGetter, &JSHTMLElement::buttonSetter };
573 const JSHTMLElement::Accessors JSHTMLElement::label_accessors = { &JSHTMLElement::labelGetter, &JSHTMLElement::labelSetter };
574 const JSHTMLElement::Accessors JSHTMLElement::fieldSet_accessors = { &JSHTMLElement::fieldSetGetter, &JSHTMLElement::fieldSetSetter };
575 const JSHTMLElement::Accessors JSHTMLElement::legend_accessors = { &JSHTMLElement::legendGetter, &JSHTMLElement::legendSetter };
576 const JSHTMLElement::Accessors JSHTMLElement::ul_accessors = { &JSHTMLElement::uListGetter, &JSHTMLElement::uListSetter };
577 const JSHTMLElement::Accessors JSHTMLElement::ol_accessors = { &JSHTMLElement::oListGetter, &JSHTMLElement::oListSetter };
578 const JSHTMLElement::Accessors JSHTMLElement::dl_accessors = { &JSHTMLElement::dListGetter, &JSHTMLElement::dListSetter };
579 const JSHTMLElement::Accessors JSHTMLElement::dir_accessors = { &JSHTMLElement::dirGetter, &JSHTMLElement::dirSetter };
580 const JSHTMLElement::Accessors JSHTMLElement::menu_accessors = { &JSHTMLElement::menuGetter, &JSHTMLElement::menuSetter };
581 const JSHTMLElement::Accessors JSHTMLElement::li_accessors = { &JSHTMLElement::liGetter, &JSHTMLElement::liSetter };
582 const JSHTMLElement::Accessors JSHTMLElement::div_accessors = { &JSHTMLElement::divGetter, &JSHTMLElement::divSetter };
583 const JSHTMLElement::Accessors JSHTMLElement::p_accessors = { &JSHTMLElement::paragraphGetter, &JSHTMLElement::paragraphSetter };
584 const JSHTMLElement::Accessors JSHTMLElement::heading_accessors = { &JSHTMLElement::headingGetter, &JSHTMLElement::headingSetter };
585 const JSHTMLElement::Accessors JSHTMLElement::blockQuote_accessors = { &JSHTMLElement::blockQuoteGetter, &JSHTMLElement::blockQuoteSetter };
586 const JSHTMLElement::Accessors JSHTMLElement::q_accessors = { &JSHTMLElement::quoteGetter, &JSHTMLElement::quoteSetter };
587 const JSHTMLElement::Accessors JSHTMLElement::pre_accessors = { &JSHTMLElement::preGetter, &JSHTMLElement::preSetter };
588 const JSHTMLElement::Accessors JSHTMLElement::br_accessors = { &JSHTMLElement::brGetter, &JSHTMLElement::brSetter };
589 const JSHTMLElement::Accessors JSHTMLElement::baseFont_accessors = { &JSHTMLElement::baseFontGetter, &JSHTMLElement::baseFontSetter };
590 const JSHTMLElement::Accessors JSHTMLElement::font_accessors = { &JSHTMLElement::fontGetter, &JSHTMLElement::fontSetter };
591 const JSHTMLElement::Accessors JSHTMLElement::hr_accessors = { &JSHTMLElement::hrGetter, &JSHTMLElement::hrSetter };
592 const JSHTMLElement::Accessors JSHTMLElement::mod_accessors = { &JSHTMLElement::modGetter, &JSHTMLElement::modSetter };
593 const JSHTMLElement::Accessors JSHTMLElement::a_accessors = { &JSHTMLElement::anchorGetter, &JSHTMLElement::anchorSetter };
594 const JSHTMLElement::Accessors JSHTMLElement::img_accessors = { &JSHTMLElement::imageGetter, &JSHTMLElement::imageSetter };
595 const JSHTMLElement::Accessors JSHTMLElement::object_accessors = { &JSHTMLElement::objectGetter, &JSHTMLElement::objectSetter };
596 const JSHTMLElement::Accessors JSHTMLElement::param_accessors = { &JSHTMLElement::paramGetter, &JSHTMLElement::paramSetter };
597 const JSHTMLElement::Accessors JSHTMLElement::applet_accessors = { &JSHTMLElement::appletGetter, &JSHTMLElement::appletSetter };
598 const JSHTMLElement::Accessors JSHTMLElement::map_accessors = { &JSHTMLElement::mapGetter, &JSHTMLElement::mapSetter };
599 const JSHTMLElement::Accessors JSHTMLElement::area_accessors = { &JSHTMLElement::areaGetter, &JSHTMLElement::areaSetter };
600 const JSHTMLElement::Accessors JSHTMLElement::script_accessors = { &JSHTMLElement::scriptGetter, &JSHTMLElement::scriptSetter };
601 const JSHTMLElement::Accessors JSHTMLElement::table_accessors = { &JSHTMLElement::tableGetter, &JSHTMLElement::tableSetter };
602 const JSHTMLElement::Accessors JSHTMLElement::caption_accessors = { &JSHTMLElement::tableCaptionGetter, &JSHTMLElement::tableCaptionSetter };
603 const JSHTMLElement::Accessors JSHTMLElement::col_accessors = { &JSHTMLElement::tableColGetter, &JSHTMLElement::tableColSetter };
604 const JSHTMLElement::Accessors JSHTMLElement::tablesection_accessors = { &JSHTMLElement::tableSectionGetter, &JSHTMLElement::tableSectionSetter };
605 const JSHTMLElement::Accessors JSHTMLElement::tr_accessors = { &JSHTMLElement::tableRowGetter, &JSHTMLElement::tableRowSetter };
606 const JSHTMLElement::Accessors JSHTMLElement::tablecell_accessors = { &JSHTMLElement::tableCellGetter, &JSHTMLElement::tableCellSetter };
607 const JSHTMLElement::Accessors JSHTMLElement::frameSet_accessors = { &JSHTMLElement::frameSetGetter, &JSHTMLElement::frameSetSetter };
608 const JSHTMLElement::Accessors JSHTMLElement::frame_accessors = { &JSHTMLElement::frameGetter, &JSHTMLElement::frameSetter };
609 const JSHTMLElement::Accessors JSHTMLElement::iFrame_accessors = { &JSHTMLElement::iFrameGetter, &JSHTMLElement::iFrameSetter };
610 const JSHTMLElement::Accessors JSHTMLElement::marquee_accessors = { &JSHTMLElement::marqueeGetter, &JSHTMLElement::marqueeSetter };
611
612 const JSHTMLElement::Accessors* JSHTMLElement::accessors() const
613 {
614     static HashMap<WebCore::AtomicStringImpl*, const Accessors*> accessorMap;
615     if (accessorMap.isEmpty()) {
616         accessorMap.add(aTag.localName().impl(), &a_accessors);
617         accessorMap.add(appletTag.localName().impl(), &applet_accessors);
618         accessorMap.add(areaTag.localName().impl(), &area_accessors);
619         accessorMap.add(baseTag.localName().impl(), &base_accessors);
620         accessorMap.add(basefontTag.localName().impl(), &baseFont_accessors);
621         accessorMap.add(blockquoteTag.localName().impl(), &blockQuote_accessors); 
622         accessorMap.add(bodyTag.localName().impl(), &body_accessors);
623         accessorMap.add(brTag.localName().impl(), &br_accessors);
624         accessorMap.add(buttonTag.localName().impl(), &button_accessors);
625         accessorMap.add(captionTag.localName().impl(), &caption_accessors);
626         accessorMap.add(colTag.localName().impl(), &col_accessors);
627         accessorMap.add(colgroupTag.localName().impl(), &col_accessors);
628         accessorMap.add(delTag.localName().impl(), &mod_accessors);
629         accessorMap.add(dirTag.localName().impl(), &dir_accessors);
630         accessorMap.add(divTag.localName().impl(), &div_accessors);
631         accessorMap.add(dlTag.localName().impl(), &dl_accessors);
632         accessorMap.add(fieldsetTag.localName().impl(), &fieldSet_accessors);
633         accessorMap.add(fontTag.localName().impl(), &font_accessors);
634         accessorMap.add(formTag.localName().impl(), &form_accessors);
635         accessorMap.add(frameTag.localName().impl(), &frame_accessors);
636         accessorMap.add(framesetTag.localName().impl(), &frameSet_accessors);
637         accessorMap.add(h1Tag.localName().impl(), &heading_accessors);
638         accessorMap.add(h2Tag.localName().impl(), &heading_accessors);
639         accessorMap.add(h3Tag.localName().impl(), &heading_accessors);
640         accessorMap.add(h4Tag.localName().impl(), &heading_accessors);
641         accessorMap.add(h5Tag.localName().impl(), &heading_accessors);
642         accessorMap.add(h6Tag.localName().impl(), &heading_accessors);
643         accessorMap.add(headTag.localName().impl(), &head_accessors);
644         accessorMap.add(hrTag.localName().impl(), &hr_accessors); 
645         accessorMap.add(htmlTag.localName().impl(), &html_accessors);
646         accessorMap.add(iframeTag.localName().impl(), &iFrame_accessors);
647         accessorMap.add(imgTag.localName().impl(), &img_accessors);
648         accessorMap.add(inputTag.localName().impl(), &input_accessors);
649         accessorMap.add(insTag.localName().impl(), &mod_accessors);
650         accessorMap.add(isindexTag.localName().impl(), &isIndex_accessors);
651         accessorMap.add(labelTag.localName().impl(), &label_accessors);
652         accessorMap.add(legendTag.localName().impl(), &legend_accessors);
653         accessorMap.add(liTag.localName().impl(), &li_accessors);
654         accessorMap.add(linkTag.localName().impl(), &link_accessors);
655         accessorMap.set(listingTag.localName().impl(), &pre_accessors);
656         accessorMap.add(mapTag.localName().impl(), &map_accessors);
657         accessorMap.add(marqueeTag.localName().impl(), &marquee_accessors);
658         accessorMap.add(menuTag.localName().impl(), &menu_accessors);
659         accessorMap.add(metaTag.localName().impl(), &meta_accessors);
660         accessorMap.add(objectTag.localName().impl(), &object_accessors);
661         accessorMap.add(olTag.localName().impl(), &ol_accessors);
662         accessorMap.add(optionTag.localName().impl(), &option_accessors);
663         accessorMap.add(optgroupTag.localName().impl(), &optGroup_accessors);
664         accessorMap.add(pTag.localName().impl(), &p_accessors);
665         accessorMap.add(paramTag.localName().impl(), &param_accessors);
666         accessorMap.add(preTag.localName().impl(), &pre_accessors);
667         accessorMap.add(qTag.localName().impl(), &q_accessors);
668         accessorMap.add(scriptTag.localName().impl(), &script_accessors);
669         accessorMap.add(selectTag.localName().impl(), &select_accessors);
670         accessorMap.add(styleTag.localName().impl(), &style_accessors);
671         accessorMap.add(tableTag.localName().impl(), &table_accessors);
672         accessorMap.add(tbodyTag.localName().impl(), &tablesection_accessors);
673         accessorMap.add(tdTag.localName().impl(), &tablecell_accessors);
674         accessorMap.add(textareaTag.localName().impl(), &textArea_accessors);
675         accessorMap.add(thTag.localName().impl(), &tablecell_accessors);
676         accessorMap.add(theadTag.localName().impl(), &tablesection_accessors);
677         accessorMap.add(tfootTag.localName().impl(), &tablesection_accessors);
678         accessorMap.add(titleTag.localName().impl(), &title_accessors);
679         accessorMap.add(trTag.localName().impl(), &tr_accessors);
680         accessorMap.add(ulTag.localName().impl(), &ul_accessors);
681     }
682     
683     HTMLElement* element = static_cast<HTMLElement*>(impl());
684     return accessorMap.get(element->localName().impl());
685 }
686
687 /*
688
689 @begin JSHTMLElementProtoTable 0
690 @end
691
692 @begin HTMLElementTable 14
693   id            KJS::JSHTMLElement::ElementId     DontDelete
694   title         KJS::JSHTMLElement::ElementTitle  DontDelete
695   lang          KJS::JSHTMLElement::ElementLang   DontDelete
696   dir           KJS::JSHTMLElement::ElementDir    DontDelete
697 ### isn't this "class" in the HTML spec?
698   className     KJS::JSHTMLElement::ElementClassName DontDelete
699   innerHTML     KJS::JSHTMLElement::ElementInnerHTML DontDelete
700   innerText     KJS::JSHTMLElement::ElementInnerText DontDelete
701   outerHTML     KJS::JSHTMLElement::ElementOuterHTML DontDelete
702   outerText     KJS::JSHTMLElement::ElementOuterText DontDelete
703   document      KJS::JSHTMLElement::ElementDocument  DontDelete|ReadOnly
704 # IE extension
705   children      KJS::JSHTMLElement::ElementChildren  DontDelete|ReadOnly
706   contentEditable   KJS::JSHTMLElement::ElementContentEditable  DontDelete
707   isContentEditable KJS::JSHTMLElement::ElementIsContentEditable  DontDelete|ReadOnly
708 @end
709 @begin HTMLHtmlElementTable 1
710   version       KJS::JSHTMLElement::HtmlVersion   DontDelete
711 @end
712 @begin HTMLHeadElementTable 1
713   profile       KJS::JSHTMLElement::HeadProfile   DontDelete
714 @end
715 @begin HTMLLinkElementTable 11
716   disabled      KJS::JSHTMLElement::LinkDisabled  DontDelete
717   charset       KJS::JSHTMLElement::LinkCharset   DontDelete
718   href          KJS::JSHTMLElement::LinkHref      DontDelete
719   hreflang      KJS::JSHTMLElement::LinkHrefLang  DontDelete
720   media         KJS::JSHTMLElement::LinkMedia     DontDelete
721   rel           KJS::JSHTMLElement::LinkRel       DontDelete
722   rev           KJS::JSHTMLElement::LinkRev       DontDelete
723   target        KJS::JSHTMLElement::LinkTarget    DontDelete
724   type          KJS::JSHTMLElement::LinkType      DontDelete
725   sheet         KJS::JSHTMLElement::LinkSheet     DontDelete|ReadOnly
726 @end
727 @begin HTMLTitleElementTable 1
728   text          KJS::JSHTMLElement::TitleText     DontDelete
729 @end
730 @begin HTMLMetaElementTable 4
731   content       KJS::JSHTMLElement::MetaContent   DontDelete
732   httpEquiv     KJS::JSHTMLElement::MetaHttpEquiv DontDelete
733   name          KJS::JSHTMLElement::MetaName      DontDelete
734   scheme        KJS::JSHTMLElement::MetaScheme    DontDelete
735 @end
736 @begin HTMLBaseElementTable 2
737   href          KJS::JSHTMLElement::BaseHref      DontDelete
738   target        KJS::JSHTMLElement::BaseTarget    DontDelete
739 @end
740 @begin HTMLIsIndexElementTable 2
741   form          KJS::JSHTMLElement::IsIndexForm   DontDelete|ReadOnly
742   prompt        KJS::JSHTMLElement::IsIndexPrompt DontDelete
743 @end
744 @begin HTMLStyleElementTable 4
745   disabled      KJS::JSHTMLElement::StyleDisabled DontDelete
746   media         KJS::JSHTMLElement::StyleMedia    DontDelete
747   type          KJS::JSHTMLElement::StyleType     DontDelete
748   sheet         KJS::JSHTMLElement::StyleSheet    DontDelete|ReadOnly
749 @end
750 @begin HTMLBodyElementTable 10
751   aLink         KJS::JSHTMLElement::BodyALink     DontDelete
752   background    KJS::JSHTMLElement::BodyBackground        DontDelete
753   bgColor       KJS::JSHTMLElement::BodyBgColor   DontDelete
754   link          KJS::JSHTMLElement::BodyLink      DontDelete
755   text          KJS::JSHTMLElement::BodyText      DontDelete
756   vLink         KJS::JSHTMLElement::BodyVLink     DontDelete
757   scrollLeft    KJS::JSHTMLElement::BodyScrollLeft        DontDelete
758   scrollTop     KJS::JSHTMLElement::BodyScrollTop         DontDelete
759   scrollHeight  KJS::JSHTMLElement::BodyScrollHeight      DontDelete|ReadOnly
760   scrollWidth   KJS::JSHTMLElement::BodyScrollWidth       DontDelete|ReadOnly
761 @end
762 @begin HTMLFormElementTable 11
763 # Also supported, by name/index
764   elements      KJS::JSHTMLElement::FormElements  DontDelete|ReadOnly
765   length        KJS::JSHTMLElement::FormLength    DontDelete|ReadOnly
766   name          KJS::JSHTMLElement::FormName      DontDelete
767   acceptCharset KJS::JSHTMLElement::FormAcceptCharset     DontDelete
768   action        KJS::JSHTMLElement::FormAction    DontDelete
769   enctype       KJS::JSHTMLElement::FormEncType   DontDelete
770   method        KJS::JSHTMLElement::FormMethod    DontDelete
771   target        KJS::JSHTMLElement::FormTarget    DontDelete
772   submit        KJS::JSHTMLElement::FormSubmit    DontDelete|Function 0
773   reset         KJS::JSHTMLElement::FormReset     DontDelete|Function 0
774 @end
775 @begin HTMLSelectElementTable 11
776 # Also supported, by index
777   type          KJS::JSHTMLElement::SelectType    DontDelete|ReadOnly
778   selectedIndex KJS::JSHTMLElement::SelectSelectedIndex   DontDelete
779   value         KJS::JSHTMLElement::SelectValue   DontDelete
780   length        KJS::JSHTMLElement::SelectLength  DontDelete
781   form          KJS::JSHTMLElement::SelectForm    DontDelete|ReadOnly
782   options       KJS::JSHTMLElement::SelectOptions DontDelete|ReadOnly
783   disabled      KJS::JSHTMLElement::SelectDisabled        DontDelete
784   multiple      KJS::JSHTMLElement::SelectMultiple        DontDelete
785   name          KJS::JSHTMLElement::SelectName    DontDelete
786   size          KJS::JSHTMLElement::SelectSize    DontDelete
787   tabIndex      KJS::JSHTMLElement::SelectTabIndex        DontDelete
788   add           KJS::JSHTMLElement::SelectAdd     DontDelete|Function 2
789   remove        KJS::JSHTMLElement::SelectRemove  DontDelete|Function 1
790   blur          KJS::JSHTMLElement::SelectBlur    DontDelete|Function 0
791   focus         KJS::JSHTMLElement::SelectFocus   DontDelete|Function 0
792 @end
793 @begin HTMLOptGroupElementTable 2
794   disabled      KJS::JSHTMLElement::OptGroupDisabled      DontDelete
795   label         KJS::JSHTMLElement::OptGroupLabel         DontDelete
796 @end
797 @begin HTMLOptionElementTable 8
798   form          KJS::JSHTMLElement::OptionForm            DontDelete|ReadOnly
799   defaultSelected KJS::JSHTMLElement::OptionDefaultSelected       DontDelete
800   text          KJS::JSHTMLElement::OptionText            DontDelete
801   index         KJS::JSHTMLElement::OptionIndex           DontDelete|ReadOnly
802   disabled      KJS::JSHTMLElement::OptionDisabled        DontDelete
803   label         KJS::JSHTMLElement::OptionLabel           DontDelete
804   selected      KJS::JSHTMLElement::OptionSelected        DontDelete
805   value         KJS::JSHTMLElement::OptionValue           DontDelete
806 @end
807 @begin HTMLInputElementTable 24
808   defaultValue  KJS::JSHTMLElement::InputDefaultValue     DontDelete
809   defaultChecked KJS::JSHTMLElement::InputDefaultChecked  DontDelete
810   form          KJS::JSHTMLElement::InputForm             DontDelete|ReadOnly
811   accept        KJS::JSHTMLElement::InputAccept           DontDelete
812   accessKey     KJS::JSHTMLElement::InputAccessKey        DontDelete
813   align         KJS::JSHTMLElement::InputAlign            DontDelete
814   alt           KJS::JSHTMLElement::InputAlt              DontDelete
815   checked       KJS::JSHTMLElement::InputChecked          DontDelete
816   disabled      KJS::JSHTMLElement::InputDisabled         DontDelete
817   indeterminate KJS::JSHTMLElement::InputIndeterminate    DontDelete
818   maxLength     KJS::JSHTMLElement::InputMaxLength        DontDelete
819   name          KJS::JSHTMLElement::InputName             DontDelete
820   readOnly      KJS::JSHTMLElement::InputReadOnly         DontDelete
821   selectionStart        KJS::JSHTMLElement::InputSelectionStart   DontDelete
822   selectionEnd  KJS::JSHTMLElement::InputSelectionEnd     DontDelete
823   size          KJS::JSHTMLElement::InputSize             DontDelete
824   src           KJS::JSHTMLElement::InputSrc              DontDelete
825   tabIndex      KJS::JSHTMLElement::InputTabIndex         DontDelete
826   type          KJS::JSHTMLElement::InputType             DontDelete
827   useMap        KJS::JSHTMLElement::InputUseMap           DontDelete
828   value         KJS::JSHTMLElement::InputValue            DontDelete
829   blur          KJS::JSHTMLElement::InputBlur             DontDelete|Function 0
830   focus         KJS::JSHTMLElement::InputFocus            DontDelete|Function 0
831   select        KJS::JSHTMLElement::InputSelect           DontDelete|Function 0
832   click         KJS::JSHTMLElement::InputClick            DontDelete|Function 0
833   setSelectionRange     KJS::JSHTMLElement::InputSetSelectionRange        DontDelete|Function 2
834 @end
835 @begin HTMLTextAreaElementTable 17
836   defaultValue  KJS::JSHTMLElement::TextAreaDefaultValue  DontDelete
837   form          KJS::JSHTMLElement::TextAreaForm          DontDelete|ReadOnly
838   accessKey     KJS::JSHTMLElement::TextAreaAccessKey     DontDelete
839   cols          KJS::JSHTMLElement::TextAreaCols          DontDelete
840   disabled      KJS::JSHTMLElement::TextAreaDisabled      DontDelete
841   name          KJS::JSHTMLElement::TextAreaName          DontDelete
842   readOnly      KJS::JSHTMLElement::TextAreaReadOnly      DontDelete
843   rows          KJS::JSHTMLElement::TextAreaRows          DontDelete
844   selectionStart        KJS::JSHTMLElement::TextAreaSelectionStart        DontDelete
845   selectionEnd  KJS::JSHTMLElement::TextAreaSelectionEnd  DontDelete
846   tabIndex      KJS::JSHTMLElement::TextAreaTabIndex      DontDelete
847   type          KJS::JSHTMLElement::TextAreaType          DontDelete|ReadOnly
848   value         KJS::JSHTMLElement::TextAreaValue         DontDelete
849   blur          KJS::JSHTMLElement::TextAreaBlur          DontDelete|Function 0
850   focus         KJS::JSHTMLElement::TextAreaFocus         DontDelete|Function 0
851   select        KJS::JSHTMLElement::TextAreaSelect        DontDelete|Function 0
852   setSelectionRange     KJS::JSHTMLElement::TextAreaSetSelectionRange     DontDelete|Function 2
853 @end
854 @begin HTMLButtonElementTable 7
855   form          KJS::JSHTMLElement::ButtonForm            DontDelete|ReadOnly
856   accessKey     KJS::JSHTMLElement::ButtonAccessKey       DontDelete
857   disabled      KJS::JSHTMLElement::ButtonDisabled        DontDelete
858   name          KJS::JSHTMLElement::ButtonName            DontDelete
859   tabIndex      KJS::JSHTMLElement::ButtonTabIndex        DontDelete
860   type          KJS::JSHTMLElement::ButtonType            DontDelete|ReadOnly
861   value         KJS::JSHTMLElement::ButtonValue           DontDelete
862   blur          KJS::JSHTMLElement::ButtonBlur            DontDelete|Function 0
863   focus         KJS::JSHTMLElement::ButtonFocus           DontDelete|Function 0
864 @end
865 @begin HTMLLabelElementTable 4
866   form          KJS::JSHTMLElement::LabelForm             DontDelete|ReadOnly
867   accessKey     KJS::JSHTMLElement::LabelAccessKey        DontDelete
868   htmlFor       KJS::JSHTMLElement::LabelHtmlFor          DontDelete
869   focus     KJS::JSHTMLElement::LabelFocus        DontDelete|Function 0
870 @end
871 @begin HTMLFieldSetElementTable 1
872   form          KJS::JSHTMLElement::FieldSetForm          DontDelete|ReadOnly
873 @end
874 @begin HTMLLegendElementTable 4
875   form          KJS::JSHTMLElement::LegendForm            DontDelete|ReadOnly
876   accessKey     KJS::JSHTMLElement::LegendAccessKey       DontDelete
877   align         KJS::JSHTMLElement::LegendAlign           DontDelete
878   focus     KJS::JSHTMLElement::LegendFocus     DontDelete|Function 0
879 @end
880 @begin HTMLUListElementTable 2
881   compact       KJS::JSHTMLElement::UListCompact          DontDelete
882   type          KJS::JSHTMLElement::UListType             DontDelete
883 @end
884 @begin HTMLOListElementTable 3
885   compact       KJS::JSHTMLElement::OListCompact          DontDelete
886   start         KJS::JSHTMLElement::OListStart            DontDelete
887   type          KJS::JSHTMLElement::OListType             DontDelete
888 @end
889 @begin HTMLDListElementTable 1
890   compact       KJS::JSHTMLElement::DListCompact          DontDelete
891 @end
892 @begin HTMLDirectoryElementTable 1
893   compact       KJS::JSHTMLElement::DirectoryCompact      DontDelete
894 @end
895 @begin HTMLMenuElementTable 1
896   compact       KJS::JSHTMLElement::MenuCompact           DontDelete
897 @end
898 @begin HTMLLIElementTable 2
899   type          KJS::JSHTMLElement::LIType                DontDelete
900   value         KJS::JSHTMLElement::LIValue               DontDelete
901 @end
902 @begin HTMLDivElementTable 1
903   align         KJS::JSHTMLElement::DivAlign              DontDelete
904 @end
905 @begin HTMLParagraphElementTable 1
906   align         KJS::JSHTMLElement::ParagraphAlign        DontDelete
907 @end
908 @begin HTMLHeadingElementTable 1
909   align         KJS::JSHTMLElement::HeadingAlign          DontDelete
910 @end
911 @begin HTMLBlockQuoteElementTable 1
912   cite          KJS::JSHTMLElement::BlockQuoteCite        DontDelete
913 @end
914 @begin HTMLQuoteElementTable 1
915   cite          KJS::JSHTMLElement::QuoteCite             DontDelete
916 @end
917 @begin HTMLPreElementTable 1
918   width         KJS::JSHTMLElement::PreWidth              DontDelete
919 @end
920 @begin HTMLBRElementTable 1
921   clear         KJS::JSHTMLElement::BRClear               DontDelete
922 @end
923 @begin HTMLBaseFontElementTable 3
924   color         KJS::JSHTMLElement::BaseFontColor         DontDelete
925   face          KJS::JSHTMLElement::BaseFontFace          DontDelete
926   size          KJS::JSHTMLElement::BaseFontSize          DontDelete
927 @end
928 @begin HTMLFontElementTable 3
929   color         KJS::JSHTMLElement::FontColor             DontDelete
930   face          KJS::JSHTMLElement::FontFace              DontDelete
931   size          KJS::JSHTMLElement::FontSize              DontDelete
932 @end
933 @begin HTMLHRElementTable 4
934   align         KJS::JSHTMLElement::HRAlign               DontDelete
935   noShade       KJS::JSHTMLElement::HRNoShade             DontDelete
936   size          KJS::JSHTMLElement::HRSize                DontDelete
937   width         KJS::JSHTMLElement::HRWidth               DontDelete
938 @end
939 @begin HTMLModElementTable 2
940   cite          KJS::JSHTMLElement::ModCite               DontDelete
941   dateTime      KJS::JSHTMLElement::ModDateTime           DontDelete
942 @end
943 @begin HTMLAnchorElementTable 24
944   accessKey     KJS::JSHTMLElement::AnchorAccessKey       DontDelete
945   charset       KJS::JSHTMLElement::AnchorCharset         DontDelete
946   coords        KJS::JSHTMLElement::AnchorCoords          DontDelete
947   href          KJS::JSHTMLElement::AnchorHref            DontDelete
948   hreflang      KJS::JSHTMLElement::AnchorHrefLang        DontDelete
949   hash          KJS::JSHTMLElement::AnchorHash            DontDelete|ReadOnly
950   host          KJS::JSHTMLElement::AnchorHost            DontDelete|ReadOnly
951   hostname      KJS::JSHTMLElement::AnchorHostname        DontDelete|ReadOnly
952   name          KJS::JSHTMLElement::AnchorName            DontDelete
953   pathname      KJS::JSHTMLElement::AnchorPathName        DontDelete|ReadOnly
954   port          KJS::JSHTMLElement::AnchorPort            DontDelete|ReadOnly
955   protocol      KJS::JSHTMLElement::AnchorProtocol        DontDelete|ReadOnly
956   rel           KJS::JSHTMLElement::AnchorRel             DontDelete
957   rev           KJS::JSHTMLElement::AnchorRev             DontDelete
958   search        KJS::JSHTMLElement::AnchorSearch          DontDelete|ReadOnly
959   shape         KJS::JSHTMLElement::AnchorShape           DontDelete
960   tabIndex      KJS::JSHTMLElement::AnchorTabIndex        DontDelete
961   target        KJS::JSHTMLElement::AnchorTarget          DontDelete
962   text          KJS::JSHTMLElement::AnchorText            DontDelete|ReadOnly
963   type          KJS::JSHTMLElement::AnchorType            DontDelete
964   blur          KJS::JSHTMLElement::AnchorBlur            DontDelete|Function 0
965   focus         KJS::JSHTMLElement::AnchorFocus           DontDelete|Function 0
966   toString      KJS::JSHTMLElement::AnchorToString        DontDelete|Function 0
967 @end
968 @begin HTMLImageElementTable 14
969   name          KJS::JSHTMLElement::ImageName             DontDelete
970   align         KJS::JSHTMLElement::ImageAlign            DontDelete
971   alt           KJS::JSHTMLElement::ImageAlt              DontDelete
972   border        KJS::JSHTMLElement::ImageBorder           DontDelete
973   complete      KJS::JSHTMLElement::ImageComplete         DontDelete|ReadOnly
974   height        KJS::JSHTMLElement::ImageHeight           DontDelete
975   hspace        KJS::JSHTMLElement::ImageHspace           DontDelete
976   isMap         KJS::JSHTMLElement::ImageIsMap            DontDelete
977   longDesc      KJS::JSHTMLElement::ImageLongDesc         DontDelete
978   src           KJS::JSHTMLElement::ImageSrc              DontDelete
979   useMap        KJS::JSHTMLElement::ImageUseMap           DontDelete
980   vspace        KJS::JSHTMLElement::ImageVspace           DontDelete
981   width         KJS::JSHTMLElement::ImageWidth            DontDelete
982   x         KJS::JSHTMLElement::ImageX            DontDelete|ReadOnly
983   y         KJS::JSHTMLElement::ImageY            DontDelete|ReadOnly
984 @end
985 @begin HTMLObjectElementTable 20
986   form            KJS::JSHTMLElement::ObjectForm            DontDelete|ReadOnly
987   code            KJS::JSHTMLElement::ObjectCode            DontDelete
988   align           KJS::JSHTMLElement::ObjectAlign           DontDelete
989   archive         KJS::JSHTMLElement::ObjectArchive         DontDelete
990   border          KJS::JSHTMLElement::ObjectBorder          DontDelete
991   codeBase        KJS::JSHTMLElement::ObjectCodeBase        DontDelete
992   codeType        KJS::JSHTMLElement::ObjectCodeType        DontDelete
993   contentDocument KJS::JSHTMLElement::ObjectContentDocument DontDelete|ReadOnly
994   data            KJS::JSHTMLElement::ObjectData            DontDelete
995   declare         KJS::JSHTMLElement::ObjectDeclare         DontDelete
996   height          KJS::JSHTMLElement::ObjectHeight          DontDelete
997   hspace          KJS::JSHTMLElement::ObjectHspace          DontDelete
998   name            KJS::JSHTMLElement::ObjectName            DontDelete
999   standby         KJS::JSHTMLElement::ObjectStandby         DontDelete
1000   tabIndex        KJS::JSHTMLElement::ObjectTabIndex        DontDelete
1001   type            KJS::JSHTMLElement::ObjectType            DontDelete
1002   useMap          KJS::JSHTMLElement::ObjectUseMap          DontDelete
1003   vspace          KJS::JSHTMLElement::ObjectVspace          DontDelete
1004   width           KJS::JSHTMLElement::ObjectWidth           DontDelete
1005 @end
1006 @begin HTMLParamElementTable 4
1007   name          KJS::JSHTMLElement::ParamName             DontDelete
1008   type          KJS::JSHTMLElement::ParamType             DontDelete
1009   value         KJS::JSHTMLElement::ParamValue            DontDelete
1010   valueType     KJS::JSHTMLElement::ParamValueType        DontDelete
1011 @end
1012 @begin HTMLAppletElementTable 11
1013   align         KJS::JSHTMLElement::AppletAlign           DontDelete
1014   alt           KJS::JSHTMLElement::AppletAlt             DontDelete
1015   archive       KJS::JSHTMLElement::AppletArchive         DontDelete
1016   code          KJS::JSHTMLElement::AppletCode            DontDelete
1017   codeBase      KJS::JSHTMLElement::AppletCodeBase        DontDelete
1018   height        KJS::JSHTMLElement::AppletHeight          DontDelete
1019   hspace        KJS::JSHTMLElement::AppletHspace          DontDelete
1020   name          KJS::JSHTMLElement::AppletName            DontDelete
1021   object        KJS::JSHTMLElement::AppletObject          DontDelete
1022   vspace        KJS::JSHTMLElement::AppletVspace          DontDelete
1023   width         KJS::JSHTMLElement::AppletWidth           DontDelete
1024 @end
1025 @begin HTMLMapElementTable 2
1026   areas         KJS::JSHTMLElement::MapAreas              DontDelete|ReadOnly
1027   name          KJS::JSHTMLElement::MapName               DontDelete
1028 @end
1029 @begin HTMLAreaElementTable 15
1030   accessKey     KJS::JSHTMLElement::AreaAccessKey         DontDelete
1031   alt           KJS::JSHTMLElement::AreaAlt               DontDelete
1032   coords        KJS::JSHTMLElement::AreaCoords            DontDelete
1033   href          KJS::JSHTMLElement::AreaHref              DontDelete
1034   hash          KJS::JSHTMLElement::AreaHash              DontDelete|ReadOnly
1035   host          KJS::JSHTMLElement::AreaHost              DontDelete|ReadOnly
1036   hostname      KJS::JSHTMLElement::AreaHostName          DontDelete|ReadOnly
1037   pathname      KJS::JSHTMLElement::AreaPathName          DontDelete|ReadOnly
1038   port          KJS::JSHTMLElement::AreaPort              DontDelete|ReadOnly
1039   protocol      KJS::JSHTMLElement::AreaProtocol          DontDelete|ReadOnly
1040   search        KJS::JSHTMLElement::AreaSearch            DontDelete|ReadOnly
1041   noHref        KJS::JSHTMLElement::AreaNoHref            DontDelete
1042   shape         KJS::JSHTMLElement::AreaShape             DontDelete
1043   tabIndex      KJS::JSHTMLElement::AreaTabIndex          DontDelete
1044   target        KJS::JSHTMLElement::AreaTarget            DontDelete
1045 @end
1046 @begin HTMLScriptElementTable 7
1047   text          KJS::JSHTMLElement::ScriptText            DontDelete
1048   htmlFor       KJS::JSHTMLElement::ScriptHtmlFor         DontDelete
1049   event         KJS::JSHTMLElement::ScriptEvent           DontDelete
1050   charset       KJS::JSHTMLElement::ScriptCharset         DontDelete
1051   defer         KJS::JSHTMLElement::ScriptDefer           DontDelete
1052   src           KJS::JSHTMLElement::ScriptSrc             DontDelete
1053   type          KJS::JSHTMLElement::ScriptType            DontDelete
1054 @end
1055 @begin HTMLTableElementTable 23
1056   caption       KJS::JSHTMLElement::TableCaption          DontDelete
1057   tHead         KJS::JSHTMLElement::TableTHead            DontDelete
1058   tFoot         KJS::JSHTMLElement::TableTFoot            DontDelete
1059   rows          KJS::JSHTMLElement::TableRows             DontDelete|ReadOnly
1060   tBodies       KJS::JSHTMLElement::TableTBodies          DontDelete|ReadOnly
1061   align         KJS::JSHTMLElement::TableAlign            DontDelete
1062   bgColor       KJS::JSHTMLElement::TableBgColor          DontDelete
1063   border        KJS::JSHTMLElement::TableBorder           DontDelete
1064   cellPadding   KJS::JSHTMLElement::TableCellPadding      DontDelete
1065   cellSpacing   KJS::JSHTMLElement::TableCellSpacing      DontDelete
1066   frame         KJS::JSHTMLElement::TableFrame            DontDelete
1067   rules         KJS::JSHTMLElement::TableRules            DontDelete
1068   summary       KJS::JSHTMLElement::TableSummary          DontDelete
1069   width         KJS::JSHTMLElement::TableWidth            DontDelete
1070   createTHead   KJS::JSHTMLElement::TableCreateTHead      DontDelete|Function 0
1071   deleteTHead   KJS::JSHTMLElement::TableDeleteTHead      DontDelete|Function 0
1072   createTFoot   KJS::JSHTMLElement::TableCreateTFoot      DontDelete|Function 0
1073   deleteTFoot   KJS::JSHTMLElement::TableDeleteTFoot      DontDelete|Function 0
1074   createCaption KJS::JSHTMLElement::TableCreateCaption    DontDelete|Function 0
1075   deleteCaption KJS::JSHTMLElement::TableDeleteCaption    DontDelete|Function 0
1076   insertRow     KJS::JSHTMLElement::TableInsertRow        DontDelete|Function 1
1077   deleteRow     KJS::JSHTMLElement::TableDeleteRow        DontDelete|Function 1
1078 @end
1079 @begin HTMLTableCaptionElementTable 1
1080   align         KJS::JSHTMLElement::TableCaptionAlign     DontDelete
1081 @end
1082 @begin HTMLTableColElementTable 7
1083   align         KJS::JSHTMLElement::TableColAlign         DontDelete
1084   ch            KJS::JSHTMLElement::TableColCh            DontDelete
1085   chOff         KJS::JSHTMLElement::TableColChOff         DontDelete
1086   span          KJS::JSHTMLElement::TableColSpan          DontDelete
1087   vAlign        KJS::JSHTMLElement::TableColVAlign        DontDelete
1088   width         KJS::JSHTMLElement::TableColWidth         DontDelete
1089 @end
1090 @begin HTMLTableSectionElementTable 7
1091   align         KJS::JSHTMLElement::TableSectionAlign             DontDelete
1092   ch            KJS::JSHTMLElement::TableSectionCh                DontDelete
1093   chOff         KJS::JSHTMLElement::TableSectionChOff             DontDelete
1094   vAlign        KJS::JSHTMLElement::TableSectionVAlign            DontDelete
1095   rows          KJS::JSHTMLElement::TableSectionRows              DontDelete|ReadOnly
1096   insertRow     KJS::JSHTMLElement::TableSectionInsertRow         DontDelete|Function 1
1097   deleteRow     KJS::JSHTMLElement::TableSectionDeleteRow         DontDelete|Function 1
1098 @end
1099 @begin HTMLTableRowElementTable 11
1100   rowIndex      KJS::JSHTMLElement::TableRowRowIndex              DontDelete|ReadOnly
1101   sectionRowIndex KJS::JSHTMLElement::TableRowSectionRowIndex     DontDelete|ReadOnly
1102   cells         KJS::JSHTMLElement::TableRowCells                 DontDelete|ReadOnly
1103   align         KJS::JSHTMLElement::TableRowAlign                 DontDelete
1104   bgColor       KJS::JSHTMLElement::TableRowBgColor               DontDelete
1105   ch            KJS::JSHTMLElement::TableRowCh                    DontDelete
1106   chOff         KJS::JSHTMLElement::TableRowChOff                 DontDelete
1107   vAlign        KJS::JSHTMLElement::TableRowVAlign                DontDelete
1108   insertCell    KJS::JSHTMLElement::TableRowInsertCell            DontDelete|Function 1
1109   deleteCell    KJS::JSHTMLElement::TableRowDeleteCell            DontDelete|Function 1
1110 @end
1111 @begin HTMLTableCellElementTable 15
1112   cellIndex     KJS::JSHTMLElement::TableCellCellIndex            DontDelete|ReadOnly
1113   abbr          KJS::JSHTMLElement::TableCellAbbr                 DontDelete
1114   align         KJS::JSHTMLElement::TableCellAlign                DontDelete
1115   axis          KJS::JSHTMLElement::TableCellAxis                 DontDelete
1116   bgColor       KJS::JSHTMLElement::TableCellBgColor              DontDelete
1117   ch            KJS::JSHTMLElement::TableCellCh                   DontDelete
1118   chOff         KJS::JSHTMLElement::TableCellChOff                DontDelete
1119   colSpan       KJS::JSHTMLElement::TableCellColSpan              DontDelete
1120   headers       KJS::JSHTMLElement::TableCellHeaders              DontDelete
1121   height        KJS::JSHTMLElement::TableCellHeight               DontDelete
1122   noWrap        KJS::JSHTMLElement::TableCellNoWrap               DontDelete
1123   rowSpan       KJS::JSHTMLElement::TableCellRowSpan              DontDelete
1124   scope         KJS::JSHTMLElement::TableCellScope                DontDelete
1125   vAlign        KJS::JSHTMLElement::TableCellVAlign               DontDelete
1126   width         KJS::JSHTMLElement::TableCellWidth                DontDelete
1127 @end
1128 @begin HTMLFrameSetElementTable 2
1129   cols          KJS::JSHTMLElement::FrameSetCols                  DontDelete
1130   rows          KJS::JSHTMLElement::FrameSetRows                  DontDelete
1131 @end
1132 @begin HTMLFrameElementTable 9
1133   contentDocument KJS::JSHTMLElement::FrameContentDocument        DontDelete|ReadOnly
1134   contentWindow   KJS::JSHTMLElement::FrameContentWindow          DontDelete|ReadOnly
1135   frameBorder     KJS::JSHTMLElement::FrameFrameBorder            DontDelete
1136   longDesc        KJS::JSHTMLElement::FrameLongDesc               DontDelete
1137   marginHeight    KJS::JSHTMLElement::FrameMarginHeight           DontDelete
1138   marginWidth     KJS::JSHTMLElement::FrameMarginWidth            DontDelete
1139   name            KJS::JSHTMLElement::FrameName                   DontDelete
1140   noResize        KJS::JSHTMLElement::FrameNoResize               DontDelete
1141   width           KJS::JSHTMLElement::FrameWidth                  DontDelete|ReadOnly
1142   height          KJS::JSHTMLElement::FrameHeight                 DontDelete|ReadOnly
1143   scrolling       KJS::JSHTMLElement::FrameScrolling              DontDelete
1144   src             KJS::JSHTMLElement::FrameSrc                    DontDelete
1145   location        KJS::JSHTMLElement::FrameLocation               DontDelete
1146 @end
1147 @begin HTMLIFrameElementTable 12
1148   align           KJS::JSHTMLElement::IFrameAlign                 DontDelete
1149   contentDocument KJS::JSHTMLElement::IFrameContentDocument       DontDelete|ReadOnly
1150   contentWindow   KJS::JSHTMLElement::IFrameContentWindow         DontDelete|ReadOnly
1151   document        KJS::JSHTMLElement::IFrameDocument              DontDelete|ReadOnly
1152   frameBorder     KJS::JSHTMLElement::IFrameFrameBorder           DontDelete
1153   height          KJS::JSHTMLElement::IFrameHeight                DontDelete
1154   longDesc        KJS::JSHTMLElement::IFrameLongDesc              DontDelete
1155   marginHeight    KJS::JSHTMLElement::IFrameMarginHeight          DontDelete
1156   marginWidth     KJS::JSHTMLElement::IFrameMarginWidth           DontDelete
1157   name            KJS::JSHTMLElement::IFrameName                  DontDelete
1158   scrolling       KJS::JSHTMLElement::IFrameScrolling             DontDelete
1159   src             KJS::JSHTMLElement::IFrameSrc                   DontDelete
1160   width           KJS::JSHTMLElement::IFrameWidth                 DontDelete
1161 @end
1162
1163 @begin HTMLMarqueeElementTable 2
1164   start           KJS::JSHTMLElement::MarqueeStart                DontDelete|Function 0
1165   stop            KJS::JSHTMLElement::MarqueeStop                 DontDelete|Function 0
1166 @end
1167 */
1168
1169 KJS_IMPLEMENT_PROTOFUNC(JSHTMLElementProtoFunc)
1170 KJS_IMPLEMENT_PROTOTYPE("HTMLElement", JSHTMLElementProto, JSHTMLElementProtoFunc)
1171
1172 JSValue* JSHTMLElementProtoFunc::callAsFunction(ExecState*, JSObject*, const List&)
1173 {
1174     return 0;
1175 }
1176
1177 JSHTMLElement::JSHTMLElement(ExecState *exec, HTMLElement *e)
1178     : JSElement(exec, e)
1179 {
1180 }
1181
1182 JSValue *JSHTMLElement::formIndexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
1183 {
1184     JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
1185     HTMLFormElement *form = static_cast<HTMLFormElement *>(thisObj->impl());
1186
1187     return toJS(exec, form->elements()->item(slot.index()));
1188 }
1189
1190 JSValue *JSHTMLElement::formNameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
1191 {
1192     JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
1193     HTMLFormElement *form = static_cast<HTMLFormElement *>(thisObj->impl());
1194     
1195     return JSHTMLCollection(exec, form->elements().get()).getNamedItems(exec, propertyName);
1196 }
1197
1198 JSValue *JSHTMLElement::selectIndexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
1199 {
1200     JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
1201     HTMLSelectElement *select = static_cast<HTMLSelectElement *>(thisObj->impl());
1202
1203     return toJS(exec, select->options()->item(slot.index()));
1204 }
1205
1206 JSValue *JSHTMLElement::framesetNameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
1207 {
1208     JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
1209     HTMLElement *element = static_cast<HTMLElement *>(thisObj->impl());
1210
1211     WebCore::Node *frame = element->children()->namedItem(propertyName);
1212     if (Document* doc = static_cast<HTMLFrameElement *>(frame)->contentDocument())
1213         if (Window *window = Window::retrieveWindow(doc->frame()))
1214             return window;
1215
1216     return jsUndefined();
1217 }
1218
1219 JSValue *JSHTMLElement::runtimeObjectGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
1220 {
1221     JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
1222     HTMLElement *element = static_cast<HTMLElement *>(thisObj->impl());
1223
1224     return getRuntimeObject(exec, element);
1225 }
1226
1227 JSValue *JSHTMLElement::runtimeObjectPropertyGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
1228 {
1229     JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
1230     HTMLElement *element = static_cast<HTMLElement *>(thisObj->impl());
1231
1232     if (JSValue *runtimeObject = getRuntimeObject(exec, element))
1233         return static_cast<JSObject *>(runtimeObject)->get(exec, propertyName);
1234     return jsUndefined();
1235 }
1236
1237 bool JSHTMLElement::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
1238 {
1239     HTMLElement &element = *static_cast<HTMLElement *>(impl());
1240
1241     // First look at dynamic properties
1242     if (element.hasLocalName(formTag)) {
1243         HTMLFormElement &form = static_cast<HTMLFormElement &>(element);
1244         // Check if we're retrieving an element (by index or by name)
1245         bool ok;
1246         unsigned u = propertyName.toUInt32(&ok);
1247         if (ok) {
1248             slot.setCustomIndex(this, u, formIndexGetter);
1249             return true;
1250         }
1251
1252         // FIXME: need faster way to check for a named item and/or a way to pass on the named items subcollection
1253         JSValue *namedItems = JSHTMLCollection(exec, form.elements().get()).getNamedItems(exec, propertyName);
1254         if (!namedItems->isUndefined()) {
1255             slot.setCustom(this, formNameGetter);
1256             return true;
1257         }
1258     } else if (element.hasLocalName(selectTag)) {
1259         bool ok;
1260         unsigned u = propertyName.toUInt32(&ok);
1261         if (ok) {
1262             // not specified by DOM(?) but supported in netscape/IE
1263             slot.setCustomIndex(this, u, selectIndexGetter);
1264             return true;
1265         }
1266     } else if (element.hasLocalName(framesetTag)) {
1267         WebCore::Node *frame = element.children()->namedItem(propertyName);
1268         if (frame && frame->hasTagName(frameTag)) {
1269             slot.setCustom(this, framesetNameGetter);
1270             return true;
1271         }
1272     } else if (element.hasLocalName(embedTag) || element.hasLocalName(objectTag) || element.hasLocalName(appletTag)) {
1273         if (propertyName == "__apple_runtime_object") {
1274             slot.setCustom(this, runtimeObjectGetter);
1275             return true;
1276         }
1277         JSValue *runtimeObject = getRuntimeObject(exec,&element);
1278         if (runtimeObject) {
1279             JSObject *imp = static_cast<JSObject *>(runtimeObject);
1280             if (imp->hasProperty(exec, propertyName)) {
1281                 slot.setCustom(this, runtimeObjectPropertyGetter);
1282                 return true;
1283             }
1284         }
1285     }
1286
1287     const HashTable* table = classInfo()->propHashTable; // get the right hashtable
1288     const HashEntry* entry = Lookup::findEntry(table, propertyName);
1289     if (entry) {
1290         // don't expose selection properties for input types that can't have a selection
1291         if (element.hasLocalName(inputTag) && !static_cast<HTMLInputElement *>(impl())->canHaveSelection()) {
1292             switch (entry->value) {
1293             case InputSetSelectionRange:
1294             case InputSelectionStart:
1295             case InputSelectionEnd:
1296                 break;
1297             default:
1298                 if (entry->attr & Function)
1299                     slot.setStaticEntry(this, entry, staticFunctionGetter<HTMLElementFunction>); 
1300                 else
1301                     slot.setStaticEntry(this, entry, staticValueGetter<JSHTMLElement>);
1302                 return true;
1303             }
1304         } else {
1305             if (entry->attr & Function)
1306                 slot.setStaticEntry(this, entry, staticFunctionGetter<HTMLElementFunction>); 
1307             else
1308                 slot.setStaticEntry(this, entry, staticValueGetter<JSHTMLElement>);
1309             return true;
1310         }
1311     }
1312
1313     // Base JSHTMLElement stuff or parent class forward, as usual
1314     return getStaticPropertySlot<HTMLElementFunction, JSHTMLElement, JSElement>(exec, &HTMLElementTable, this, propertyName, slot);
1315 }
1316
1317 bool JSHTMLElement::implementsCall() const
1318 {
1319     HTMLElement *element = static_cast<HTMLElement *>(impl());
1320     if (element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag)) {
1321         Document* doc = element->document();
1322         KJSProxy *proxy = doc->frame()->jScript();
1323         ExecState *exec = proxy->interpreter()->globalExec();
1324         if (JSValue *runtimeObject = getRuntimeObject(exec, element))
1325             return static_cast<JSObject *>(runtimeObject)->implementsCall();
1326     }
1327     return false;
1328 }
1329
1330 JSValue *JSHTMLElement::callAsFunction(ExecState *exec, JSObject *thisObj, const List&args)
1331 {
1332     HTMLElement *element = static_cast<HTMLElement *>(impl());
1333     if (element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag)) {
1334         if (JSValue *runtimeObject = getRuntimeObject(exec, element))
1335             return static_cast<JSObject *>(runtimeObject)->call(exec, thisObj, args);
1336     }
1337     return jsUndefined();
1338 }
1339
1340 JSValue *JSHTMLElement::htmlGetter(ExecState* exec, int token) const
1341 {
1342     HTMLHtmlElement& html = *static_cast<HTMLHtmlElement*>(impl());
1343     if (token == HtmlVersion)
1344         return jsString(html.version());
1345     return jsUndefined();
1346 }
1347
1348 JSValue *JSHTMLElement::headGetter(ExecState* exec, int token) const
1349 {
1350     HTMLHeadElement &head = *static_cast<HTMLHeadElement*>(impl());
1351     if (token == HeadProfile)
1352         return jsString(head.profile());
1353     return jsUndefined();
1354 }
1355
1356 JSValue *JSHTMLElement::linkGetter(ExecState* exec, int token) const
1357 {
1358     HTMLLinkElement &link = *static_cast<HTMLLinkElement*>(impl());
1359     switch (token) {
1360         case LinkDisabled:
1361             return jsBoolean(link.disabled());
1362         case LinkCharset:
1363             return jsString(link.charset());
1364         case LinkHref:
1365             return jsString(link.href());
1366         case LinkHrefLang:
1367             return jsString(link.hreflang());
1368         case LinkMedia:           
1369             return jsString(link.media());
1370         case LinkRel:             
1371             return jsString(link.rel());
1372         case LinkRev:            
1373             return jsString(link.rev());
1374         case LinkTarget:          
1375             return jsString(link.target());
1376         case LinkType:            
1377             return jsString(link.type());
1378         case LinkSheet:           
1379             return toJS(exec, link.sheet());
1380     }
1381     return jsUndefined();
1382 }
1383
1384 JSValue *JSHTMLElement::titleGetter(ExecState* exec, int token) const
1385 {
1386     HTMLTitleElement& title = *static_cast<HTMLTitleElement*>(impl());
1387     if (token == TitleText)
1388         return jsString(title.text());
1389     return jsUndefined();
1390 }
1391
1392 JSValue *JSHTMLElement::metaGetter(ExecState* exec, int token) const
1393 {
1394     HTMLMetaElement& meta = *static_cast<HTMLMetaElement*>(impl());
1395     switch (token) {
1396         case MetaContent:         return jsString(meta.content());
1397         case MetaHttpEquiv:       return jsString(meta.httpEquiv());
1398         case MetaName:            return jsString(meta.name());
1399         case MetaScheme:          return jsString(meta.scheme());
1400     }
1401     return jsUndefined();
1402 }
1403
1404 JSValue *JSHTMLElement::baseGetter(ExecState* exec, int token) const
1405 {
1406     HTMLBaseElement& base = *static_cast<HTMLBaseElement*>(impl());
1407     switch (token) {
1408         case BaseHref:            return jsString(base.href());
1409         case BaseTarget:          return jsString(base.target());
1410     }
1411     return jsUndefined();
1412 }
1413
1414 JSValue *JSHTMLElement::isIndexGetter(ExecState* exec, int token) const
1415 {
1416     HTMLIsIndexElement& isindex = *static_cast<HTMLIsIndexElement*>(impl());
1417     switch (token) {
1418         case IsIndexForm:            return toJS(exec, isindex.form()); // type HTMLFormElement
1419         case IsIndexPrompt:          return jsString(isindex.prompt());
1420     }
1421     return jsUndefined();
1422 }
1423
1424 JSValue *JSHTMLElement::styleGetter(ExecState* exec, int token) const
1425 {
1426     HTMLStyleElement& style = *static_cast<HTMLStyleElement*>(impl());
1427     switch (token) {
1428         case StyleDisabled:        return jsBoolean(style.disabled());
1429         case StyleMedia:           return jsString(style.media());
1430         case StyleType:            return jsString(style.type());
1431         case StyleSheet:           return toJS(exec, style.sheet());
1432     }
1433     return jsUndefined();
1434 }
1435
1436 JSValue *JSHTMLElement::bodyGetter(ExecState* exec, int token) const
1437 {
1438     HTMLBodyElement& body = *static_cast<HTMLBodyElement*>(impl());
1439     switch (token) {
1440         case BodyALink:           return jsString(body.aLink());
1441         case BodyBackground:      return jsString(body.background());
1442         case BodyBgColor:         return jsString(body.bgColor());
1443         case BodyLink:            return jsString(body.link());
1444         case BodyText:            return jsString(body.text());
1445         case BodyVLink:           return jsString(body.vLink());
1446         default: {
1447             // Update the document's layout before we compute these attributes.
1448             Document *doc = body.document();
1449             doc->updateLayoutIgnorePendingStylesheets();
1450             FrameView *view = doc->view();
1451             switch (token) {
1452                 case BodyScrollLeft:
1453                     return jsNumber(view ? view->contentsX() : 0);
1454                 case BodyScrollTop:
1455                     return jsNumber(view ? view->contentsY() : 0);
1456                 case BodyScrollHeight:
1457                     return jsNumber(view ? view->contentsHeight() : 0);
1458                 case BodyScrollWidth:
1459                     return jsNumber(view ? view->contentsWidth() : 0);
1460             }
1461         }
1462     }
1463     return jsUndefined();
1464 }
1465
1466 JSValue *JSHTMLElement::formGetter(ExecState* exec, int token) const
1467 {
1468     HTMLFormElement& form = *static_cast<HTMLFormElement*>(impl());
1469     switch (token) {
1470         case FormElements:        return getHTMLCollection(exec, form.elements().get());
1471         case FormLength:          return jsNumber(form.length());
1472         case FormName:            return jsString(form.name());
1473         case FormAcceptCharset:   return jsString(form.acceptCharset());
1474         case FormAction:          return jsString(form.action());
1475         case FormEncType:         return jsString(form.enctype());
1476         case FormMethod:          return jsString(form.method());
1477         case FormTarget:          return jsString(form.target());
1478     }
1479     return jsUndefined();
1480 }
1481
1482 JSValue *JSHTMLElement::selectGetter(ExecState* exec, int token) const
1483 {
1484     HTMLSelectElement& select = *static_cast<HTMLSelectElement*>(impl());
1485     switch (token) {
1486         case SelectType:            return jsString(select.type());
1487         case SelectSelectedIndex:   return jsNumber(select.selectedIndex());
1488         case SelectValue:           return jsString(select.value());
1489         case SelectLength:          return jsNumber(select.length());
1490         case SelectForm:            return toJS(exec, select.form()); // type HTMLFormElement
1491         case SelectOptions:         return getSelectHTMLCollection(exec, select.options().get(), &select); // type JSHTMLCollection
1492         case SelectDisabled:        return jsBoolean(select.disabled());
1493         case SelectMultiple:        return jsBoolean(select.multiple());
1494         case SelectName:            return jsString(select.name());
1495         case SelectSize:            return jsNumber(select.size());
1496         case SelectTabIndex:        return jsNumber(select.tabIndex());
1497     }
1498     return jsUndefined();
1499 }
1500
1501 JSValue *JSHTMLElement::optGroupGetter(ExecState* exec, int token) const
1502 {
1503     HTMLOptGroupElement& optgroup = *static_cast<HTMLOptGroupElement*>(impl());
1504     switch (token) {
1505         case OptGroupDisabled:        return jsBoolean(optgroup.disabled());
1506         case OptGroupLabel:           return jsString(optgroup.label());
1507     }
1508     return jsUndefined();
1509 }
1510
1511 JSValue *JSHTMLElement::optionGetter(ExecState* exec, int token) const
1512 {
1513     HTMLOptionElement& option = *static_cast<HTMLOptionElement*>(impl());
1514     switch (token) {
1515         case OptionForm:            return toJS(exec,option.form()); // type HTMLFormElement
1516         case OptionDefaultSelected: return jsBoolean(option.defaultSelected());
1517         case OptionText:            return jsString(option.text());
1518         case OptionIndex:           return jsNumber(option.index());
1519         case OptionDisabled:        return jsBoolean(option.disabled());
1520         case OptionLabel:           return jsString(option.label());
1521         case OptionSelected:        return jsBoolean(option.selected());
1522         case OptionValue:           return jsString(option.value());
1523     }
1524     return jsUndefined();
1525 }
1526
1527 static JSValue *getInputSelectionStart(HTMLInputElement &input)
1528 {
1529     if (input.canHaveSelection())
1530         return jsNumber(input.selectionStart());
1531     return jsUndefined();
1532 }
1533
1534 static JSValue *getInputSelectionEnd(HTMLInputElement &input)
1535 {
1536     if (input.canHaveSelection())
1537         return jsNumber(input.selectionEnd());
1538     return jsUndefined();
1539 }
1540
1541 JSValue *JSHTMLElement::inputGetter(ExecState* exec, int token) const
1542 {
1543     HTMLInputElement& input = *static_cast<HTMLInputElement*>(impl());
1544     switch (token) {
1545         case InputDefaultValue:    return jsString(input.defaultValue());
1546         case InputDefaultChecked:  return jsBoolean(input.defaultChecked());
1547         case InputForm:            return toJS(exec,input.form()); // type HTMLFormElement
1548         case InputAccept:          return jsString(input.accept());
1549         case InputAccessKey:       return jsString(input.accessKey());
1550         case InputAlign:           return jsString(input.align());
1551         case InputAlt:             return jsString(input.alt());
1552         case InputChecked:         return jsBoolean(input.checked());
1553         case InputDisabled:        return jsBoolean(input.disabled());
1554         case InputIndeterminate:   return jsBoolean(input.indeterminate());
1555         case InputMaxLength:       return jsNumber(input.maxLength());
1556         case InputName:            return jsString(input.name());
1557         case InputReadOnly:        return jsBoolean(input.readOnly());
1558         case InputSelectionStart:  return getInputSelectionStart(input);
1559         case InputSelectionEnd:    return getInputSelectionEnd(input);
1560         case InputSize:            return jsNumber(input.size());
1561         case InputSrc:             return jsString(input.src());
1562         case InputTabIndex:        return jsNumber(input.tabIndex());
1563         case InputType:            return jsString(input.type());
1564         case InputUseMap:          return jsString(input.useMap());
1565         case InputValue:           return jsString(input.value());
1566     }
1567     return jsUndefined();
1568 }
1569
1570 JSValue *JSHTMLElement::textAreaGetter(ExecState* exec, int token) const
1571 {
1572     HTMLTextAreaElement& textarea = *static_cast<HTMLTextAreaElement*>(impl());
1573     switch (token) {
1574         case TextAreaDefaultValue:    return jsString(textarea.defaultValue());
1575         case TextAreaForm:            return toJS(exec,textarea.form()); // type HTMLFormElement
1576         case TextAreaAccessKey:       return jsString(textarea.accessKey());
1577         case TextAreaCols:            return jsNumber(textarea.cols());
1578         case TextAreaDisabled:        return jsBoolean(textarea.disabled());
1579         case TextAreaName:            return jsString(textarea.name());
1580         case TextAreaReadOnly:        return jsBoolean(textarea.readOnly());
1581         case TextAreaRows:            return jsNumber(textarea.rows());
1582         case TextAreaSelectionStart:  return jsNumber(textarea.selectionStart());
1583         case TextAreaSelectionEnd:    return jsNumber(textarea.selectionEnd());
1584         case TextAreaTabIndex:        return jsNumber(textarea.tabIndex());
1585         case TextAreaType:            return jsString(textarea.type());
1586         case TextAreaValue:           return jsString(textarea.value());
1587     }
1588     return jsUndefined();
1589 }
1590
1591 JSValue *JSHTMLElement::buttonGetter(ExecState* exec, int token) const
1592 {
1593     HTMLButtonElement& button = *static_cast<HTMLButtonElement*>(impl());
1594     switch (token) {
1595         case ButtonForm:            return toJS(exec,button.form()); // type HTMLFormElement
1596         case ButtonAccessKey:       return jsString(button.accessKey());
1597         case ButtonDisabled:        return jsBoolean(button.disabled());
1598         case ButtonName:            return jsString(button.name());
1599         case ButtonTabIndex:        return jsNumber(button.tabIndex());
1600         case ButtonType:            return jsString(button.type());
1601         case ButtonValue:           return jsString(button.value());
1602     }
1603     return jsUndefined();
1604 }
1605
1606 JSValue *JSHTMLElement::labelGetter(ExecState* exec, int token) const
1607 {
1608     HTMLLabelElement& label = *static_cast<HTMLLabelElement*>(impl());
1609     switch (token) {
1610         case LabelForm:            return toJS(exec,label.form()); // type HTMLFormElement
1611         case LabelAccessKey:       return jsString(label.accessKey());
1612         case LabelHtmlFor:         return jsString(label.htmlFor());
1613     }
1614     return jsUndefined();
1615 }
1616
1617 JSValue *JSHTMLElement::fieldSetGetter(ExecState* exec, int token) const
1618 {
1619     HTMLFieldSetElement& fieldSet = *static_cast<HTMLFieldSetElement*>(impl());
1620     if (token == FieldSetForm)
1621         return toJS(exec,fieldSet.form()); // type HTMLFormElement
1622     return jsUndefined();
1623 }
1624
1625 JSValue *JSHTMLElement::legendGetter(ExecState* exec, int token) const
1626 {
1627     HTMLLegendElement& legend = *static_cast<HTMLLegendElement*>(impl());
1628     switch (token) {
1629         case LegendForm:            return toJS(exec,legend.form()); // type HTMLFormElement
1630         case LegendAccessKey:       return jsString(legend.accessKey());
1631         case LegendAlign:           return jsString(legend.align());
1632     }
1633     return jsUndefined();
1634 }
1635
1636 JSValue *JSHTMLElement::uListGetter(ExecState* exec, int token) const
1637 {
1638     HTMLUListElement& uList = *static_cast<HTMLUListElement*>(impl());
1639     switch (token) {
1640         case UListCompact:         return jsBoolean(uList.compact());
1641         case UListType:            return jsString(uList.type());
1642     }
1643     return jsUndefined();
1644 }
1645
1646 JSValue *JSHTMLElement::oListGetter(ExecState* exec, int token) const
1647 {
1648     HTMLOListElement& oList = *static_cast<HTMLOListElement*>(impl());
1649     switch (token) {
1650         case OListCompact:         return jsBoolean(oList.compact());
1651         case OListStart:           return jsNumber(oList.start());
1652         case OListType:            return jsString(oList.type());
1653     }
1654     return jsUndefined();
1655 }
1656
1657 JSValue *JSHTMLElement::dListGetter(ExecState* exec, int token) const
1658 {
1659     HTMLDListElement& dList = *static_cast<HTMLDListElement*>(impl());
1660     if (token == DListCompact)
1661         return jsBoolean(dList.compact());
1662     return jsUndefined();
1663 }
1664
1665 JSValue *JSHTMLElement::dirGetter(ExecState* exec, int token) const
1666 {
1667     HTMLDirectoryElement& dir = *static_cast<HTMLDirectoryElement*>(impl());
1668     if (token == DirectoryCompact)
1669         return jsBoolean(dir.compact());
1670     return jsUndefined();
1671 }
1672
1673 JSValue *JSHTMLElement::menuGetter(ExecState* exec, int token) const
1674 {
1675     HTMLMenuElement& menu = *static_cast<HTMLMenuElement*>(impl());
1676     if (token == MenuCompact)
1677         return jsBoolean(menu.compact());
1678     return jsUndefined();
1679 }
1680
1681 JSValue *JSHTMLElement::liGetter(ExecState* exec, int token) const
1682 {
1683     HTMLLIElement& li = *static_cast<HTMLLIElement*>(impl());
1684     switch (token) {
1685         case LIType:            return jsString(li.type());
1686         case LIValue:           return jsNumber(li.value());
1687     }
1688     return jsUndefined();
1689 }
1690
1691 JSValue *JSHTMLElement::divGetter(ExecState* exec, int token) const
1692 {
1693     HTMLDivElement& div = *static_cast<HTMLDivElement*>(impl());
1694     if (token == DivAlign)
1695         return jsString(div.align());
1696     return jsUndefined();
1697 }
1698
1699 JSValue *JSHTMLElement::paragraphGetter(ExecState* exec, int token) const
1700 {
1701     HTMLParagraphElement& p = *static_cast<HTMLParagraphElement*>(impl());
1702     if (token == ParagraphAlign)
1703         return jsString(p.align());
1704     return jsUndefined();
1705 }
1706
1707 JSValue *JSHTMLElement::headingGetter(ExecState* exec, int token) const
1708 {
1709     HTMLHeadingElement& h = *static_cast<HTMLHeadingElement*>(impl());
1710     if (token == HeadingAlign)
1711         return jsString(h.align());
1712     return jsUndefined();
1713 }
1714
1715 JSValue *JSHTMLElement::blockQuoteGetter(ExecState* exec, int token) const
1716 {
1717     HTMLBlockquoteElement& blockQuote = *static_cast<HTMLBlockquoteElement*>(impl());
1718     if (token == BlockQuoteCite)
1719         return jsString(blockQuote.cite());
1720     return jsUndefined();
1721 }
1722
1723 JSValue *JSHTMLElement::quoteGetter(ExecState* exec, int token) const
1724 {
1725     HTMLQuoteElement& quote = *static_cast<HTMLQuoteElement*>(impl());
1726     if (token == QuoteCite)
1727         return jsString(quote.cite());
1728     return jsUndefined();
1729 }
1730
1731 JSValue *JSHTMLElement::preGetter(ExecState* exec, int token) const
1732 {
1733     // FIXME: Add support for 'wrap' when white-space: pre-wrap is implemented.
1734     HTMLPreElement& pre = *static_cast<HTMLPreElement*>(impl());
1735     if (token == PreWidth)
1736         return jsNumber(pre.width());
1737     if (token == PreWrap)
1738         return jsBoolean(pre.wrap());
1739     return jsUndefined();
1740 }
1741
1742 JSValue *JSHTMLElement::brGetter(ExecState* exec, int token) const
1743 {
1744     HTMLBRElement& br = *static_cast<HTMLBRElement*>(impl());
1745     if (token == BRClear)
1746         return jsString(br.clear());
1747     return jsUndefined();
1748 }
1749
1750 JSValue *JSHTMLElement::baseFontGetter(ExecState* exec, int token) const
1751 {
1752     HTMLBaseFontElement& baseFont = *static_cast<HTMLBaseFontElement*>(impl());
1753     switch (token) {
1754         case BaseFontColor:           return jsString(baseFont.color());
1755         case BaseFontFace:            return jsString(baseFont.face());
1756         case BaseFontSize:            return jsString(baseFont.size());
1757     }
1758     return jsUndefined();
1759 }
1760
1761 JSValue *JSHTMLElement::fontGetter(ExecState* exec, int token) const
1762 {
1763     HTMLFontElement& font = *static_cast<HTMLFontElement*>(impl());
1764     switch (token) {
1765         case FontColor:           return jsString(font.color());
1766         case FontFace:            return jsString(font.face());
1767         case FontSize:            return jsString(font.size());
1768     }
1769     return jsUndefined();
1770 }
1771
1772 JSValue *JSHTMLElement::hrGetter(ExecState* exec, int token) const
1773 {
1774     HTMLHRElement& hr = *static_cast<HTMLHRElement*>(impl());
1775     switch (token) {
1776         case HRAlign:           return jsString(hr.align());
1777         case HRNoShade:         return jsBoolean(hr.noShade());
1778         case HRSize:            return jsString(hr.size());
1779         case HRWidth:           return jsString(hr.width());
1780     }
1781     return jsUndefined();
1782 }
1783
1784 JSValue *JSHTMLElement::modGetter(ExecState* exec, int token) const
1785 {
1786     HTMLModElement& mod = *static_cast<HTMLModElement*>(impl());
1787     switch (token) {
1788         case ModCite:            return jsString(mod.cite());
1789         case ModDateTime:        return jsString(mod.dateTime());
1790     }
1791     return jsUndefined();
1792 }
1793
1794 JSValue *JSHTMLElement::anchorGetter(ExecState* exec, int token) const
1795 {
1796     HTMLAnchorElement& anchor = *static_cast<HTMLAnchorElement*>(impl());
1797     switch (token) {
1798         case AnchorAccessKey:       return jsString(anchor.accessKey());
1799         case AnchorCharset:         return jsString(anchor.charset());
1800         case AnchorCoords:          return jsString(anchor.coords());
1801         case AnchorHref:            return jsString(anchor.href());
1802         case AnchorHrefLang:        return jsString(anchor.hreflang());
1803         case AnchorHash:            return jsString('#'+KURL(anchor.href().deprecatedString()).ref());
1804         case AnchorHost:            return jsString(KURL(anchor.href().deprecatedString()).host());
1805         case AnchorHostname: {
1806             KURL url(anchor.href().deprecatedString());
1807             if (url.port()==0)
1808                 return jsString(url.host());
1809             else
1810                 return jsString(url.host() + ":" + DeprecatedString::number(url.port()));
1811         }
1812         case AnchorPathName:        return jsString(KURL(anchor.href().deprecatedString()).path());
1813         case AnchorPort:            return jsString(DeprecatedString::number(KURL(anchor.href().deprecatedString()).port()));
1814         case AnchorProtocol:        return jsString(KURL(anchor.href().deprecatedString()).protocol()+":");
1815         case AnchorSearch:          return jsString(KURL(anchor.href().deprecatedString()).query());
1816         case AnchorName:            return jsString(anchor.name());
1817         case AnchorRel:             return jsString(anchor.rel());
1818         case AnchorRev:             return jsString(anchor.rev());
1819         case AnchorShape:           return jsString(anchor.shape());
1820         case AnchorTabIndex:        return jsNumber(anchor.tabIndex());
1821         case AnchorTarget:          return jsString(anchor.target());
1822         case AnchorType:            return jsString(anchor.type());
1823         case AnchorText:
1824             anchor.document()->updateLayoutIgnorePendingStylesheets();
1825             return jsString(anchor.innerText());
1826     }
1827     return jsUndefined();
1828 }
1829
1830 JSValue *JSHTMLElement::imageGetter(ExecState* exec, int token) const
1831 {
1832     HTMLImageElement& image = *static_cast<HTMLImageElement*>(impl());
1833     switch (token) {
1834         case ImageName:            return jsString(image.name());
1835         case ImageAlign:           return jsString(image.align());
1836         case ImageAlt:             return jsString(image.alt());
1837         case ImageBorder:          return jsNumber(image.border());
1838         case ImageComplete:        return jsBoolean(image.complete());
1839         case ImageHeight:          return jsNumber(image.height(true));
1840         case ImageHspace:          return jsNumber(image.hspace());
1841         case ImageIsMap:           return jsBoolean(image.isMap());
1842         case ImageLongDesc:        return jsString(image.longDesc());
1843         case ImageSrc:             return jsString(image.src());
1844         case ImageUseMap:          return jsString(image.useMap());
1845         case ImageVspace:          return jsNumber(image.vspace());
1846         case ImageWidth:           return jsNumber(image.width(true));
1847         case ImageX:               return jsNumber(image.x());
1848         case ImageY:               return jsNumber(image.y());
1849     }
1850     return jsUndefined();
1851 }
1852
1853 JSValue *JSHTMLElement::objectGetter(ExecState* exec, int token) const
1854 {
1855     HTMLObjectElement& object = *static_cast<HTMLObjectElement*>(impl());
1856     switch (token) {
1857         case ObjectForm:            return toJS(exec,object.form()); // type HTMLFormElement
1858         case ObjectCode:            return jsString(object.code());
1859         case ObjectAlign:           return jsString(object.align());
1860         case ObjectArchive:         return jsString(object.archive());
1861         case ObjectBorder:          return jsString(object.border());
1862         case ObjectCodeBase:        return jsString(object.codeBase());
1863         case ObjectCodeType:        return jsString(object.codeType());
1864         case ObjectContentDocument: return checkNodeSecurity(exec,object.contentDocument()) ? 
1865                                            toJS(exec, object.contentDocument()) : jsUndefined();
1866         case ObjectData:            return jsString(object.data());
1867         case ObjectDeclare:         return jsBoolean(object.declare());
1868         case ObjectHeight:          return jsString(object.height());
1869         case ObjectHspace:          return jsString(object.hspace());
1870         case ObjectName:            return jsString(object.name());
1871         case ObjectStandby:         return jsString(object.standby());
1872         case ObjectTabIndex:        return jsNumber(object.tabIndex());
1873         case ObjectType:            return jsString(object.type());
1874         case ObjectUseMap:          return jsString(object.useMap());
1875         case ObjectVspace:          return jsString(object.vspace());
1876         case ObjectWidth:           return jsString(object.width());
1877     }
1878     return jsUndefined();
1879 }
1880
1881 JSValue *JSHTMLElement::paramGetter(ExecState* exec, int token) const
1882 {
1883     HTMLParamElement& param = *static_cast<HTMLParamElement*>(impl());
1884     switch (token) {
1885         case ParamName:            return jsString(param.name());
1886         case ParamType:            return jsString(param.type());
1887         case ParamValue:           return jsString(param.value());
1888         case ParamValueType:       return jsString(param.valueType());
1889     }
1890     return jsUndefined();
1891 }
1892
1893 JSValue *JSHTMLElement::appletGetter(ExecState* exec, int token) const
1894 {
1895     HTMLAppletElement& applet = *static_cast<HTMLAppletElement*>(impl());
1896     switch (token) {
1897         case AppletAlign:           return jsString(applet.align());
1898         case AppletAlt:             return jsString(applet.alt());
1899         case AppletArchive:         return jsString(applet.archive());
1900         case AppletCode:            return jsString(applet.code());
1901         case AppletCodeBase:        return jsString(applet.codeBase());
1902         case AppletHeight:          return jsString(applet.height());
1903         case AppletHspace:          return jsString(applet.hspace());
1904         case AppletName:            return jsString(applet.name());
1905         case AppletObject:          return jsString(applet.object());
1906         case AppletVspace:          return jsString(applet.vspace());
1907         case AppletWidth:           return jsString(applet.width());
1908     }
1909     return jsUndefined();
1910 }
1911
1912 JSValue *JSHTMLElement::mapGetter(ExecState* exec, int token) const
1913 {
1914     HTMLMapElement& map = *static_cast<HTMLMapElement*>(impl());
1915     switch (token) {
1916         case MapAreas:           return getHTMLCollection(exec, map.areas().get()); // type JSHTMLCollection
1917         case MapName:            return jsString(map.name());
1918     }
1919     return jsUndefined();
1920 }
1921
1922 JSValue *JSHTMLElement::areaGetter(ExecState* exec, int token) const
1923 {
1924     HTMLAreaElement& area = *static_cast<HTMLAreaElement*>(impl());
1925     switch (token) {
1926         case AreaAccessKey:       return jsString(area.accessKey());
1927         case AreaAlt:             return jsString(area.alt());
1928         case AreaCoords:          return jsString(area.coords());
1929         case AreaHref:            return jsString(area.href());
1930         case AreaHash:            return jsString('#'+KURL(area.href().deprecatedString()).ref());
1931         case AreaHost:            return jsString(KURL(area.href().deprecatedString()).host());
1932         case AreaHostName: {
1933             KURL url(area.href().deprecatedString());
1934             if (url.port()==0)
1935                 return jsString(url.host());
1936             else
1937                 return jsString(url.host() + ":" + DeprecatedString::number(url.port()));
1938         }
1939         case AreaPathName:        return jsString(KURL(area.href().deprecatedString()).path());
1940         case AreaPort:            return jsString(DeprecatedString::number(KURL(area.href().deprecatedString()).port()));
1941         case AreaProtocol:        return jsString(KURL(area.href().deprecatedString()).protocol()+":");
1942         case AreaSearch:          return jsString(KURL(area.href().deprecatedString()).query());
1943         case AreaNoHref:          return jsBoolean(area.noHref());
1944         case AreaShape:           return jsString(area.shape());
1945         case AreaTabIndex:        return jsNumber(area.tabIndex());
1946         case AreaTarget:          return jsString(area.target());
1947     }
1948     return jsUndefined();
1949 }
1950
1951 JSValue *JSHTMLElement::scriptGetter(ExecState* exec, int token) const
1952 {
1953     HTMLScriptElement& script = *static_cast<HTMLScriptElement*>(impl());
1954     switch (token) {
1955         case ScriptText:            return jsString(script.text());
1956         case ScriptHtmlFor:         return jsString(script.htmlFor());
1957         case ScriptEvent:           return jsString(script.event());
1958         case ScriptCharset:         return jsString(script.charset());
1959         case ScriptDefer:           return jsBoolean(script.defer());
1960         case ScriptSrc:             return jsString(script.src());
1961         case ScriptType:            return jsString(script.type());
1962     }
1963     return jsUndefined();
1964 }
1965
1966 JSValue *JSHTMLElement::tableGetter(ExecState* exec, int token) const
1967 {
1968     HTMLTableElement& table = *static_cast<HTMLTableElement*>(impl());
1969     switch (token) {
1970         case TableCaption:         return toJS(exec,table.caption()); // type HTMLTableCaptionElement
1971         case TableTHead:           return toJS(exec,table.tHead()); // type HTMLTableSectionElement
1972         case TableTFoot:           return toJS(exec,table.tFoot()); // type HTMLTableSectionElement
1973         case TableRows:            return getHTMLCollection(exec, table.rows().get()); // type JSHTMLCollection
1974         case TableTBodies:         return getHTMLCollection(exec, table.tBodies().get()); // type JSHTMLCollection
1975         case TableAlign:           return jsString(table.align());
1976         case TableBgColor:         return jsString(table.bgColor());
1977         case TableBorder:          return jsString(table.border());
1978         case TableCellPadding:     return jsString(table.cellPadding());
1979         case TableCellSpacing:     return jsString(table.cellSpacing());
1980         case TableFrame:           return jsString(table.frame());
1981         case TableRules:           return jsString(table.rules());
1982         case TableSummary:         return jsString(table.summary());
1983         case TableWidth:           return jsString(table.width());
1984     }
1985     return jsUndefined();
1986 }
1987
1988 JSValue *JSHTMLElement::tableCaptionGetter(ExecState* exec, int token) const
1989 {
1990     HTMLTableCaptionElement& tableCaption = *static_cast<HTMLTableCaptionElement*>(impl());
1991     if (token == TableCaptionAlign)
1992         return jsString(tableCaption.align());
1993     return jsUndefined();
1994 }
1995
1996 JSValue *JSHTMLElement::tableColGetter(ExecState* exec, int token) const
1997 {
1998     HTMLTableColElement& tableCol = *static_cast<HTMLTableColElement*>(impl());
1999     switch (token) {
2000         case TableColAlign:           return jsString(tableCol.align());
2001         case TableColCh:              return jsString(tableCol.ch());
2002         case TableColChOff:           return jsString(tableCol.chOff());
2003         case TableColSpan:            return jsNumber(tableCol.span());
2004         case TableColVAlign:          return jsString(tableCol.vAlign());
2005         case TableColWidth:           return jsString(tableCol.width());
2006     }
2007     return jsUndefined();
2008 }
2009
2010 JSValue *JSHTMLElement::tableSectionGetter(ExecState* exec, int token) const
2011 {
2012     HTMLTableSectionElement& tableSection = *static_cast<HTMLTableSectionElement*>(impl());
2013     switch (token) {
2014         case TableSectionAlign:           return jsString(tableSection.align());
2015         case TableSectionCh:              return jsString(tableSection.ch());
2016         case TableSectionChOff:           return jsString(tableSection.chOff());
2017         case TableSectionVAlign:          return jsString(tableSection.vAlign());
2018         case TableSectionRows:            return getHTMLCollection(exec, tableSection.rows().get()); // type JSHTMLCollection
2019     }
2020     return jsUndefined();
2021 }
2022
2023 JSValue *JSHTMLElement::tableRowGetter(ExecState* exec, int token) const
2024 {
2025     HTMLTableRowElement& tableRow = *static_cast<HTMLTableRowElement*>(impl());
2026     switch (token) {
2027         case TableRowRowIndex:        return jsNumber(tableRow.rowIndex());
2028         case TableRowSectionRowIndex: return jsNumber(tableRow.sectionRowIndex());
2029         case TableRowCells:           return getHTMLCollection(exec, tableRow.cells().get()); // type JSHTMLCollection
2030         case TableRowAlign:           return jsString(tableRow.align());
2031         case TableRowBgColor:         return jsString(tableRow.bgColor());
2032         case TableRowCh:              return jsString(tableRow.ch());
2033         case TableRowChOff:           return jsString(tableRow.chOff());
2034         case TableRowVAlign:          return jsString(tableRow.vAlign());
2035     }
2036     return jsUndefined();
2037 }
2038
2039 JSValue *JSHTMLElement::tableCellGetter(ExecState* exec, int token) const
2040 {
2041     HTMLTableCellElement& tableCell = *static_cast<HTMLTableCellElement*>(impl());
2042     switch (token) {
2043         case TableCellCellIndex:       return jsNumber(tableCell.cellIndex());
2044         case TableCellAbbr:            return jsString(tableCell.abbr());
2045         case TableCellAlign:           return jsString(tableCell.align());
2046         case TableCellAxis:            return jsString(tableCell.axis());
2047         case TableCellBgColor:         return jsString(tableCell.bgColor());
2048         case TableCellCh:              return jsString(tableCell.ch());
2049         case TableCellChOff:           return jsString(tableCell.chOff());
2050         case TableCellColSpan:         return jsNumber(tableCell.colSpan());
2051         case TableCellHeaders:         return jsString(tableCell.headers());
2052         case TableCellHeight:          return jsString(tableCell.height());
2053         case TableCellNoWrap:          return jsBoolean(tableCell.noWrap());
2054         case TableCellRowSpan:         return jsNumber(tableCell.rowSpan());
2055         case TableCellScope:           return jsString(tableCell.scope());
2056         case TableCellVAlign:          return jsString(tableCell.vAlign());
2057         case TableCellWidth:           return jsString(tableCell.width());
2058     }
2059     return jsUndefined();
2060 }
2061
2062 JSValue *JSHTMLElement::frameSetGetter(ExecState* exec, int token) const
2063 {
2064     HTMLFrameSetElement& frameSet = *static_cast<HTMLFrameSetElement*>(impl());
2065     switch (token) {
2066         case FrameSetCols:            return jsString(frameSet.cols());
2067         case FrameSetRows:            return jsString(frameSet.rows());
2068     }
2069     return jsUndefined();
2070 }
2071
2072 JSValue *JSHTMLElement::frameGetter(ExecState* exec, int token) const
2073 {
2074     HTMLFrameElement& frameElement = *static_cast<HTMLFrameElement*>(impl());
2075     switch (token) {
2076         case FrameContentDocument: return checkNodeSecurity(exec,frameElement.contentDocument()) ? 
2077                                           toJS(exec, frameElement.contentDocument()) : jsUndefined();
2078         case FrameContentWindow:   return checkNodeSecurity(exec,frameElement.contentDocument())
2079                                         ? Window::retrieve(frameElement.contentFrame())
2080                                         : jsUndefined();
2081         case FrameFrameBorder:     return jsString(frameElement.frameBorder());
2082         case FrameLongDesc:        return jsString(frameElement.longDesc());
2083         case FrameMarginHeight:    return jsString(frameElement.marginHeight());
2084         case FrameMarginWidth:     return jsString(frameElement.marginWidth());
2085         case FrameName:            return jsString(frameElement.name());
2086         case FrameNoResize:        return jsBoolean(frameElement.noResize());
2087         case FrameWidth:           return jsNumber(frameElement.frameWidth());
2088         case FrameHeight:          return jsNumber(frameElement.frameHeight());
2089         case FrameScrolling:       return jsString(frameElement.scrolling());
2090         case FrameSrc:
2091         case FrameLocation:        return jsString(frameElement.src());
2092     }
2093     return jsUndefined();
2094 }
2095
2096 JSValue *JSHTMLElement::iFrameGetter(ExecState* exec, int token) const
2097 {
2098     HTMLIFrameElement& iFrame = *static_cast<HTMLIFrameElement*>(impl());
2099     switch (token) {
2100         case IFrameAlign:                return jsString(iFrame.align());
2101           // ### security check ?
2102         case IFrameDocument: // non-standard, mapped to contentDocument
2103         case IFrameContentDocument: return checkNodeSecurity(exec,iFrame.contentDocument()) ? 
2104                                       toJS(exec, iFrame.contentDocument()) : jsUndefined();
2105         case IFrameContentWindow:   return checkNodeSecurity(exec,iFrame.contentDocument()) 
2106                                         ? Window::retrieve(iFrame.contentFrame())
2107                                         : jsUndefined();
2108         case IFrameFrameBorder:     return jsString(iFrame.frameBorder());
2109         case IFrameHeight:          return jsString(iFrame.height());
2110         case IFrameLongDesc:        return jsString(iFrame.longDesc());
2111         case IFrameMarginHeight:    return jsString(iFrame.marginHeight());
2112         case IFrameMarginWidth:     return jsString(iFrame.marginWidth());
2113         case IFrameName:            return jsString(iFrame.name());
2114         case IFrameScrolling:       return jsString(iFrame.scrolling());
2115         case IFrameSrc:             return jsString(iFrame.src());
2116         case IFrameWidth:           return jsString(iFrame.width());
2117     }
2118     return jsUndefined();
2119 }
2120
2121 JSValue *JSHTMLElement::marqueeGetter(ExecState* exec, int token) const
2122 {
2123     // FIXME: Find out what WinIE exposes as properties and implement this.
2124     return jsUndefined();
2125 }
2126
2127 JSValue *JSHTMLElement::getValueProperty(ExecState *exec, int token) const
2128 {
2129     // Check our set of generic properties first.
2130     HTMLElement &element = *static_cast<HTMLElement *>(impl());
2131     switch (token) {
2132         case ElementId:
2133             // iht.com relies on this value being "" when no id is present. Other browsers do this as well.
2134             // So we use jsString() instead of jsStringOrNull() here.
2135             return jsString(element.id());
2136         case ElementTitle:
2137             return jsString(element.title());
2138         case ElementLang:
2139             return jsString(element.lang());
2140         case ElementDir:
2141             return jsString(element.dir());
2142         case ElementClassName:
2143             return jsString(element.className());
2144         case ElementInnerHTML:
2145             return jsString(element.innerHTML());
2146         case ElementInnerText:
2147             impl()->document()->updateLayoutIgnorePendingStylesheets();
2148             return jsString(element.innerText());
2149         case ElementOuterHTML:
2150             return jsString(element.outerHTML());
2151         case ElementOuterText:
2152             return jsString(element.outerText());
2153         case ElementDocument:
2154             return toJS(exec,element.ownerDocument());
2155         case ElementChildren:
2156             return getHTMLCollection(exec, element.children().get());
2157         case ElementContentEditable:
2158             return jsString(element.contentEditable());
2159         case ElementIsContentEditable:
2160             return jsBoolean(element.isContentEditable());
2161     }
2162
2163     // Now check the properties specific to our element type.
2164     const Accessors* access = accessors();
2165     if (access && access->m_getter)
2166         return (this->*(access->m_getter))(exec, token);
2167     return jsUndefined();
2168 }
2169
2170 UString JSHTMLElement::toString(ExecState *exec) const
2171 {
2172     if (impl()->hasTagName(aTag))
2173         return UString(static_cast<const HTMLAnchorElement *>(impl())->href());
2174     else
2175         return JSElement::toString(exec);
2176 }
2177
2178 static HTMLFormElement *getForm(HTMLElement *element)
2179 {
2180     if (element->isGenericFormElement())
2181         return static_cast<HTMLGenericFormElement *>(element)->form();
2182     if (element->hasTagName(labelTag))
2183         return static_cast<HTMLLabelElement *>(element)->form();
2184     if (element->hasTagName(objectTag))
2185         return static_cast<HTMLObjectElement *>(element)->form();
2186
2187     return 0;
2188 }
2189
2190 void JSHTMLElement::pushEventHandlerScope(ExecState *exec, ScopeChain &scope) const
2191 {
2192   HTMLElement *element = static_cast<HTMLElement *>(impl());
2193
2194   // The document is put on first, fall back to searching it only after the element and form.
2195   scope.push(static_cast<JSObject *>(toJS(exec, element->ownerDocument())));
2196
2197   // The form is next, searched before the document, but after the element itself.
2198   
2199   // First try to obtain the form from the element itself.  We do this to deal with
2200   // the malformed case where <form>s aren't in our parent chain (e.g., when they were inside 
2201   // <table> or <tbody>.
2202   HTMLFormElement *form = getForm(element);
2203   if (form)
2204     scope.push(static_cast<JSObject *>(toJS(exec, form)));
2205   else {
2206     WebCore::Node* form = element->parentNode();
2207     while (form && !form->hasTagName(formTag))
2208       form = form->parentNode();
2209     
2210     if (form)
2211       scope.push(static_cast<JSObject *>(toJS(exec, form)));
2212   }
2213   
2214   // The element is on top, searched first.
2215   scope.push(static_cast<JSObject *>(toJS(exec, element)));
2216 }
2217
2218 HTMLElementFunction::HTMLElementFunction(ExecState *exec, int i, int len, const Identifier& name)
2219   : InternalFunctionImp(static_cast<FunctionPrototype*>(exec->lexicalInterpreter()->builtinFunctionPrototype()), name)
2220   , id(i)
2221 {
2222   put(exec,lengthPropertyName,jsNumber(len),DontDelete|ReadOnly|DontEnum);
2223 }
2224
2225 JSValue *HTMLElementFunction::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
2226 {
2227     if (!thisObj->inherits(&JSHTMLElement::info))
2228         return throwError(exec, TypeError);
2229     DOMExceptionTranslator exception(exec);
2230     HTMLElement &element = *static_cast<HTMLElement *>(static_cast<JSHTMLElement *>(thisObj)->impl());
2231
2232     if (element.hasLocalName(formTag)) {
2233         HTMLFormElement &form = static_cast<HTMLFormElement &>(element);
2234         if (id == JSHTMLElement::FormSubmit) {
2235             form.submit();
2236             return jsUndefined();
2237         }
2238         else if (id == JSHTMLElement::FormReset) {
2239             form.reset();
2240             return jsUndefined();
2241         }
2242     }
2243     else if (element.hasLocalName(selectTag)) {
2244         HTMLSelectElement &select = static_cast<HTMLSelectElement &>(element);
2245         if (id == JSHTMLElement::SelectAdd) {
2246             select.add(toHTMLElement(args[0]), toHTMLElement(args[1]), exception);
2247             return jsUndefined();
2248         }
2249         else if (id == JSHTMLElement::SelectRemove) {
2250             select.remove(int(args[0]->toNumber(exec)));
2251             return jsUndefined();
2252         }
2253         else if (id == JSHTMLElement::SelectBlur) {
2254             select.blur();
2255             return jsUndefined();
2256         }
2257         else if (id == JSHTMLElement::SelectFocus) {
2258             select.focus();
2259             return jsUndefined();
2260         }
2261     }
2262     else if (element.hasLocalName(inputTag)) {
2263         HTMLInputElement &input = static_cast<HTMLInputElement &>(element);
2264         if (id == JSHTMLElement::InputBlur) {
2265             input.blur();
2266             return jsUndefined();
2267         }
2268         else if (id == JSHTMLElement::InputFocus) {
2269             input.focus();
2270             return jsUndefined();
2271         }
2272         else if (id == JSHTMLElement::InputSelect) {
2273             input.select();
2274             return jsUndefined();
2275         }
2276         else if (id == JSHTMLElement::InputClick) {
2277             input.click();
2278             return jsUndefined();
2279         }
2280         else if (id == JSHTMLElement::InputSetSelectionRange) {
2281             input.setSelectionRange(args[0]->toInt32(exec), args[1]->toInt32(exec));
2282             return jsUndefined();
2283         }
2284     }
2285     else if (element.hasLocalName(buttonTag)) {
2286         HTMLButtonElement &button = static_cast<HTMLButtonElement &>(element);
2287         if (id == JSHTMLElement::ButtonBlur) {
2288             button.blur();
2289             return jsUndefined();
2290         }
2291         else if (id == JSHTMLElement::ButtonFocus) {
2292             button.focus();
2293             return jsUndefined();
2294         }
2295     }
2296     else if (element.hasLocalName(labelTag)) {
2297         HTMLLabelElement &label = static_cast<HTMLLabelElement &>(element);
2298         if (id == JSHTMLElement::LabelFocus) {
2299             label.focus();
2300             return jsUndefined();
2301         }
2302     }
2303     else if (element.hasLocalName(legendTag)) {
2304         HTMLLegendElement &legend = static_cast<HTMLLegendElement &>(element);
2305         if (id == JSHTMLElement::LegendFocus) {
2306             legend.focus();
2307             return jsUndefined();
2308         }
2309     }
2310     else if (element.hasLocalName(textareaTag)) {
2311         HTMLTextAreaElement &textarea = static_cast<HTMLTextAreaElement &>(element);
2312         if (id == JSHTMLElement::TextAreaBlur) {
2313             textarea.blur();
2314             return jsUndefined();
2315         }
2316         else if (id == JSHTMLElement::TextAreaFocus) {
2317             textarea.focus();
2318             return jsUndefined();
2319         }
2320         else if (id == JSHTMLElement::TextAreaSelect) {
2321             textarea.select();
2322             return jsUndefined();
2323         }
2324         else if (id == JSHTMLElement::TextAreaSetSelectionRange) {
2325             textarea.setSelectionRange(args[0]->toInt32(exec), args[1]->toInt32(exec));
2326             return jsUndefined();
2327         }
2328     }
2329     else if (element.hasLocalName(aTag)) {
2330         HTMLAnchorElement &anchor = static_cast<HTMLAnchorElement &>(element);
2331         if (id == JSHTMLElement::AnchorBlur) {
2332             anchor.blur();
2333             return jsUndefined();
2334         }
2335         else if (id == JSHTMLElement::AnchorFocus) {
2336             anchor.focus();
2337             return jsUndefined();
2338         }
2339         else if (id == JSHTMLElement::AnchorToString)
2340             return jsString(thisObj->toString(exec));
2341     }
2342     else if (element.hasLocalName(tableTag)) {
2343         HTMLTableElement &table = static_cast<HTMLTableElement &>(element);
2344         if (id == JSHTMLElement::TableCreateTHead)
2345             return toJS(exec,table.createTHead());
2346         else if (id == JSHTMLElement::TableDeleteTHead) {
2347             table.deleteTHead();
2348             return jsUndefined();
2349         }
2350         else if (id == JSHTMLElement::TableCreateTFoot)
2351             return toJS(exec,table.createTFoot());
2352         else if (id == JSHTMLElement::TableDeleteTFoot) {
2353             table.deleteTFoot();
2354             return jsUndefined();
2355         }
2356         else if (id == JSHTMLElement::TableCreateCaption)
2357             return toJS(exec,table.createCaption());
2358         else if (id == JSHTMLElement::TableDeleteCaption) {
2359             table.deleteCaption();
2360             return jsUndefined();
2361         }
2362         else if (id == JSHTMLElement::TableInsertRow)
2363             return toJS(exec,table.insertRow(args[0]->toInt32(exec), exception));
2364         else if (id == JSHTMLElement::TableDeleteRow) {
2365             table.deleteRow(args[0]->toInt32(exec), exception);
2366             return jsUndefined();
2367         }
2368     }
2369     else if (element.hasLocalName(theadTag) ||
2370              element.hasLocalName(tbodyTag) ||
2371              element.hasLocalName(tfootTag)) {
2372         HTMLTableSectionElement &tableSection = static_cast<HTMLTableSectionElement &>(element);
2373         if (id == JSHTMLElement::TableSectionInsertRow)
2374             return toJS(exec, tableSection.insertRow(args[0]->toInt32(exec), exception));
2375         else if (id == JSHTMLElement::TableSectionDeleteRow) {
2376             tableSection.deleteRow(args[0]->toInt32(exec), exception);
2377             return jsUndefined();
2378         }
2379     }
2380     else if (element.hasLocalName(trTag)) {
2381         HTMLTableRowElement &tableRow = static_cast<HTMLTableRowElement &>(element);
2382         if (id == JSHTMLElement::TableRowInsertCell)
2383             return toJS(exec,tableRow.insertCell(args[0]->toInt32(exec), exception));
2384         else if (id == JSHTMLElement::TableRowDeleteCell) {
2385             tableRow.deleteCell(args[0]->toInt32(exec), exception);
2386             return jsUndefined();
2387         }
2388     }
2389     else if (element.hasLocalName(marqueeTag)) {
2390         if (id == JSHTMLElement::MarqueeStart && element.renderer() && 
2391             element.renderer()->layer() &&
2392             element.renderer()->layer()->marquee()) {
2393             element.renderer()->layer()->marquee()->start();
2394             return jsUndefined();
2395         }
2396         if (id == JSHTMLElement::MarqueeStop && element.renderer() && 
2397             element.renderer()->layer() &&
2398             element.renderer()->layer()->marquee()) {
2399             element.renderer()->layer()->marquee()->stop();
2400             return jsUndefined();
2401         }
2402     }
2403
2404     return jsUndefined();
2405 }
2406
2407 void JSHTMLElement::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr)
2408 {
2409     HTMLElement &element = *static_cast<HTMLElement *>(impl());
2410     // First look at dynamic properties
2411     if (element.hasLocalName(selectTag)) {
2412         HTMLSelectElement &select = static_cast<HTMLSelectElement &>(element);
2413         bool ok;
2414         /*unsigned u =*/ propertyName.toUInt32(&ok);
2415         if (ok) {
2416             JSObject *coll = static_cast<JSObject *>(getSelectHTMLCollection(exec, select.options().get(), &select));
2417             coll->put(exec,propertyName,value);
2418             return;
2419         }
2420     }
2421     else if (element.hasLocalName(embedTag) || element.hasLocalName(objectTag) || element.hasLocalName(appletTag)) {
2422         if (JSValue *runtimeObject = getRuntimeObject(exec, &element)) {
2423             JSObject *imp = static_cast<JSObject *>(runtimeObject);
2424             if (imp->canPut(exec, propertyName))
2425                 return imp->put(exec, propertyName, value);
2426         }
2427     }
2428
2429     const HashTable* table = classInfo()->propHashTable; // get the right hashtable
2430     const HashEntry* entry = Lookup::findEntry(table, propertyName);
2431     if (entry) {
2432         if (entry->attr & Function) { // function: put as override property
2433             JSObject::put(exec, propertyName, value, attr);
2434             return;
2435         }
2436         else if (!(entry->attr & ReadOnly)) { // let lookupPut print the warning if read-only
2437             putValueProperty(exec, entry->value, value, attr);
2438             return;
2439         }
2440     }
2441
2442     lookupPut<JSHTMLElement, JSElement>(exec, propertyName, value, attr, &HTMLElementTable, this);
2443 }
2444
2445 void JSHTMLElement::htmlSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2446 {
2447     HTMLHeadElement &head = *static_cast<HTMLHeadElement*>(impl());
2448     if (token == HeadProfile) 
2449         head.setProfile(str);
2450 }
2451
2452 void JSHTMLElement::headSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2453 {
2454     HTMLHeadElement &head = *static_cast<HTMLHeadElement*>(impl());
2455     if (token == HeadProfile) 
2456         head.setProfile(str);
2457 }
2458
2459 void JSHTMLElement::linkSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2460 {
2461     HTMLLinkElement &link = *static_cast<HTMLLinkElement*>(impl());
2462     switch (token) {
2463         case LinkDisabled:        { link.setDisabled(value->toBoolean(exec)); return; }
2464         case LinkCharset:         { link.setCharset(str); return; }
2465         case LinkHref:            { link.setHref(str); return; }
2466         case LinkHrefLang:        { link.setHreflang(str); return; }
2467         case LinkMedia:           { link.setMedia(str); return; }
2468         case LinkRel:             { link.setRel(str); return; }
2469         case LinkRev:             { link.setRev(str); return; }
2470         case LinkTarget:          { link.setTarget(str); return; }
2471         case LinkType:            { link.setType(str); return; }
2472     }
2473 }
2474
2475 void JSHTMLElement::titleSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2476 {
2477      HTMLTitleElement& title = *static_cast<HTMLTitleElement*>(impl());
2478      if (token == TitleText)
2479         title.setText(str);
2480 }
2481
2482 void JSHTMLElement::metaSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2483 {
2484     HTMLMetaElement& meta = *static_cast<HTMLMetaElement*>(impl());
2485     switch (token) {
2486         case MetaContent:         { meta.setContent(str); return; }
2487         case MetaHttpEquiv:       { meta.setHttpEquiv(str); return; }
2488         case MetaName:            { meta.setName(str); return; }
2489         case MetaScheme:          { meta.setScheme(str); return; }
2490     }
2491 }
2492
2493 void JSHTMLElement::baseSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2494 {
2495     HTMLBaseElement& base = *static_cast<HTMLBaseElement*>(impl());
2496     switch (token) {
2497         case BaseHref:            { base.setHref(str); return; }
2498         case BaseTarget:          { base.setTarget(str); return; }
2499     }
2500 }
2501
2502 void JSHTMLElement::isIndexSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2503 {
2504     HTMLIsIndexElement& isindex = *static_cast<HTMLIsIndexElement*>(impl());
2505     if (token == IsIndexPrompt)
2506         isindex.setPrompt(str);
2507 }
2508
2509 void JSHTMLElement::styleSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2510 {
2511     HTMLStyleElement& style = *static_cast<HTMLStyleElement*>(impl());
2512     switch (token) {
2513         case StyleDisabled:        { style.setDisabled(value->toBoolean(exec)); return; }
2514         case StyleMedia:           { style.setMedia(str); return; }
2515         case StyleType:            { style.setType(str); return; }
2516     }
2517 }
2518
2519 void JSHTMLElement::bodySetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2520 {
2521     HTMLBodyElement& body = *static_cast<HTMLBodyElement*>(impl());
2522     switch (token) {
2523         case BodyALink:           { body.setALink(str); return; }
2524         case BodyBackground:      { body.setBackground(str); return; }
2525         case BodyBgColor:         { body.setBgColor(str); return; }
2526         case BodyLink:            { body.setLink(str); return; }
2527         case BodyText:            { body.setText(str); return; }
2528         case BodyVLink:           { body.setVLink(str); return; }
2529         case BodyScrollLeft:
2530         case BodyScrollTop: {
2531             FrameView* sview = body.ownerDocument()->view();
2532             if (sview) {
2533                 // Update the document's layout before we compute these attributes.
2534                 body.document()->updateLayoutIgnorePendingStylesheets();
2535                 if (token == BodyScrollLeft)
2536                     sview->setContentsPos(value->toInt32(exec), sview->contentsY());
2537                 else
2538                     sview->setContentsPos(sview->contentsX(), value->toInt32(exec));
2539             }
2540             return;
2541         }
2542     }
2543 }
2544
2545 void JSHTMLElement::formSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2546 {
2547     HTMLFormElement& form = *static_cast<HTMLFormElement*>(impl());
2548     switch (token) {
2549         // read-only: elements
2550         // read-only: length
2551         case FormName:            { form.setName(str); return; }
2552         case FormAcceptCharset:   { form.setAcceptCharset(str); return; }
2553         case FormAction:          { form.setAction(str); return; }
2554         case FormEncType:         { form.setEnctype(str); return; }
2555         case FormMethod:          { form.setMethod(str); return; }
2556         case FormTarget:          { form.setTarget(str); return; }
2557     }
2558 }
2559
2560 void JSHTMLElement::selectSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2561 {
2562     HTMLSelectElement& select = *static_cast<HTMLSelectElement*>(impl());
2563     switch (token) {
2564         // read-only: type
2565         case SelectSelectedIndex:   { select.setSelectedIndex(value->toInt32(exec)); return; }
2566         case SelectValue:           { select.setValue(str); return; }
2567         case SelectLength:          { // read-only according to the NS spec, but webpages need it writeable
2568                                         JSObject *coll = static_cast<JSObject *>(getSelectHTMLCollection(exec, select.options().get(), &select));
2569                                         coll->put(exec,lengthPropertyName,value);
2570                                         return;
2571                                     }
2572         // read-only: form
2573         // read-only: options
2574         case SelectDisabled:        { select.setDisabled(value->toBoolean(exec)); return; }
2575         case SelectMultiple:        { select.setMultiple(value->toBoolean(exec)); return; }
2576         case SelectName:            { select.setName(AtomicString(str)); return; }
2577         case SelectSize:            { select.setSize(value->toInt32(exec)); return; }
2578         case SelectTabIndex:        { select.setTabIndex(value->toInt32(exec)); return; }
2579     }
2580 }
2581
2582 void JSHTMLElement::optGroupSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2583 {
2584     HTMLOptGroupElement& optgroup = *static_cast<HTMLOptGroupElement*>(impl());
2585     switch (token) {
2586         case OptGroupDisabled:        { optgroup.setDisabled(value->toBoolean(exec)); return; }
2587         case OptGroupLabel:           { optgroup.setLabel(str); return; }
2588     }
2589 }
2590
2591 void JSHTMLElement::optionSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2592 {
2593     DOMExceptionTranslator exception(exec);
2594     HTMLOptionElement& option = *static_cast<HTMLOptionElement*>(impl());
2595     switch (token) {
2596         // read-only: form
2597         case OptionDefaultSelected: { option.setDefaultSelected(value->toBoolean(exec)); return; }
2598         case OptionText:            { option.setText(str, exception); return; }
2599         // read-only: index
2600         case OptionDisabled:        { option.setDisabled(value->toBoolean(exec)); return; }
2601         case OptionLabel:           { option.setLabel(str); return; }
2602         case OptionSelected:        { option.setSelected(value->toBoolean(exec)); return; }
2603         case OptionValue:           { option.setValue(str); return; }
2604     }
2605 }
2606
2607 void JSHTMLElement::inputSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2608 {
2609     HTMLInputElement& input = *static_cast<HTMLInputElement*>(impl());
2610     switch (token) {
2611         case InputDefaultValue:    { input.setDefaultValue(str); return; }
2612         case InputDefaultChecked:  { input.setDefaultChecked(value->toBoolean(exec)); return; }
2613         // read-only: form
2614         case InputAccept:          { input.setAccept(str); return; }
2615         case InputAccessKey:       { input.setAccessKey(str); return; }
2616         case InputAlign:           { input.setAlign(str); return; }
2617         case InputAlt:             { input.setAlt(str); return; }
2618         case InputChecked:         { input.setChecked(value->toBoolean(exec)); return; }
2619         case InputDisabled:        { input.setDisabled(value->toBoolean(exec)); return; }
2620         case InputIndeterminate:   { input.setIndeterminate(value->toBoolean(exec)); return; }
2621         case InputMaxLength:       { input.setMaxLength(value->toInt32(exec)); return; }
2622         case InputName:            { input.setName(AtomicString(str)); return; }
2623         case InputReadOnly:        { input.setReadOnly(value->toBoolean(exec)); return; }
2624         case InputSize:            { input.setSize(value->toInt32(exec)); return; }
2625         case InputSelectionStart:  { input.setSelectionStart(value->toInt32(exec)); return; }
2626         case InputSelectionEnd:    { input.setSelectionEnd(value->toInt32(exec)); return; }
2627         case InputSrc:             { input.setSrc(str); return; }
2628         case InputTabIndex:        { input.setTabIndex(value->toInt32(exec)); return; }
2629         case InputType:            { input.setType(str); return; }
2630         case InputUseMap:          { input.setUseMap(str); return; }
2631         case InputValue:           { input.setValue(str); return; }
2632     }
2633 }
2634
2635 void JSHTMLElement::textAreaSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2636 {
2637     HTMLTextAreaElement& textarea = *static_cast<HTMLTextAreaElement*>(impl());
2638     switch (token) {
2639         case TextAreaDefaultValue:    { textarea.setDefaultValue(str); return; }
2640         // read-only: form
2641         case TextAreaAccessKey:       { textarea.setAccessKey(str); return; }
2642         case TextAreaCols:            { textarea.setCols(value->toInt32(exec)); return; }
2643         case TextAreaDisabled:        { textarea.setDisabled(value->toBoolean(exec)); return; }
2644         case TextAreaName:            { textarea.setName(AtomicString(str)); return; }
2645         case TextAreaReadOnly:        { textarea.setReadOnly(value->toBoolean(exec)); return; }
2646         case TextAreaRows:            { textarea.setRows(value->toInt32(exec)); return; }
2647         case TextAreaSelectionStart:  { textarea.setSelectionStart(value->toInt32(exec)); return; }
2648         case TextAreaSelectionEnd:    { textarea.setSelectionEnd(value->toInt32(exec)); return; }
2649         case TextAreaTabIndex:        { textarea.setTabIndex(value->toInt32(exec)); return; }
2650         // read-only: type
2651         case TextAreaValue:           { textarea.setValue(str); return; }
2652     }
2653 }
2654
2655 void JSHTMLElement::buttonSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2656 {
2657     HTMLButtonElement& button = *static_cast<HTMLButtonElement*>(impl());
2658     switch (token) {
2659         // read-only: form
2660         case ButtonAccessKey:       { button.setAccessKey(str); return; }
2661         case ButtonDisabled:        { button.setDisabled(value->toBoolean(exec)); return; }
2662         case ButtonName:            { button.setName(AtomicString(str)); return; }
2663         case ButtonTabIndex:        { button.setTabIndex(value->toInt32(exec)); return; }
2664         // read-only: type
2665         case ButtonValue:           { button.setValue(str); return; }
2666     }
2667 }
2668
2669 void JSHTMLElement::labelSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2670 {
2671     HTMLLabelElement& label = *static_cast<HTMLLabelElement*>(impl());
2672     switch (token) {
2673         // read-only: form
2674         case LabelAccessKey:       { label.setAccessKey(str); return; }
2675         case LabelHtmlFor:         { label.setHtmlFor(str); return; }
2676     }
2677 }
2678
2679 void JSHTMLElement::fieldSetSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2680 {
2681 }
2682
2683 void JSHTMLElement::legendSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2684 {
2685     HTMLLegendElement& legend = *static_cast<HTMLLegendElement*>(impl());
2686     switch (token) {
2687         // read-only: form
2688         case LegendAccessKey:       { legend.setAccessKey(str); return; }
2689         case LegendAlign:           { legend.setAlign(str); return; }
2690     }
2691 }
2692
2693 void JSHTMLElement::uListSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2694 {
2695     HTMLUListElement& uList = *static_cast<HTMLUListElement*>(impl());
2696     switch (token) {
2697         case UListCompact:         { uList.setCompact(value->toBoolean(exec)); return; }
2698         case UListType:            { uList.setType(str); return; }
2699     }
2700 }
2701
2702 void JSHTMLElement::oListSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2703 {
2704     HTMLOListElement& oList = *static_cast<HTMLOListElement*>(impl());
2705     switch (token) {
2706         case OListCompact:         { oList.setCompact(value->toBoolean(exec)); return; }
2707         case OListStart:           { oList.setStart(value->toInt32(exec)); return; }
2708         case OListType:            { oList.setType(str); return; }
2709     }
2710 }
2711
2712 void JSHTMLElement::dListSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2713 {
2714     HTMLDListElement& dList = *static_cast<HTMLDListElement*>(impl());
2715     if (token == DListCompact)
2716         dList.setCompact(value->toBoolean(exec));
2717 }
2718
2719 void JSHTMLElement::dirSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2720 {
2721     HTMLDirectoryElement& directory = *static_cast<HTMLDirectoryElement*>(impl());
2722     if (token == DirectoryCompact)
2723         directory.setCompact(value->toBoolean(exec));
2724 }
2725
2726 void JSHTMLElement::menuSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2727 {
2728     HTMLMenuElement& menu = *static_cast<HTMLMenuElement*>(impl());
2729     if (token == MenuCompact)
2730         menu.setCompact(value->toBoolean(exec));
2731 }
2732
2733 void JSHTMLElement::liSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2734 {
2735     HTMLLIElement& li = *static_cast<HTMLLIElement*>(impl());
2736     switch (token) {
2737         case LIType:            { li.setType(str); return; }
2738         case LIValue:           { li.setValue(value->toInt32(exec)); return; }
2739     }
2740 }
2741
2742 void JSHTMLElement::divSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2743 {
2744     HTMLDivElement& div = *static_cast<HTMLDivElement*>(impl());
2745     if (token == DivAlign)
2746         div.setAlign(str);
2747 }
2748
2749 void JSHTMLElement::paragraphSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2750 {
2751     HTMLParagraphElement& paragraph = *static_cast<HTMLParagraphElement*>(impl());
2752     if (token == ParagraphAlign)
2753         paragraph.setAlign(str);
2754 }
2755
2756 void JSHTMLElement::headingSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2757 {
2758     HTMLHeadingElement& heading = *static_cast<HTMLHeadingElement*>(impl());
2759     if (token == HeadingAlign)
2760         heading.setAlign(str);
2761 }
2762
2763 void JSHTMLElement::blockQuoteSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2764 {
2765     HTMLBlockquoteElement& blockQuote = *static_cast<HTMLBlockquoteElement*>(impl());
2766     if (token == BlockQuoteCite)
2767         blockQuote.setCite(str);
2768 }
2769
2770 void JSHTMLElement::quoteSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2771 {
2772     HTMLQuoteElement& quote = *static_cast<HTMLQuoteElement*>(impl());
2773     if (token == QuoteCite)
2774         quote.setCite(str);
2775 }
2776
2777 void JSHTMLElement::preSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2778 {
2779     HTMLPreElement& pre = *static_cast<HTMLPreElement*>(impl());
2780     if (token == PreWidth)
2781         pre.setWidth(value->toInt32(exec));
2782     else if (token == PreWrap)
2783         pre.setWrap(value->toBoolean(exec));
2784 }
2785
2786 void JSHTMLElement::brSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2787 {
2788     HTMLBRElement& br = *static_cast<HTMLBRElement*>(impl());
2789     if (token == BRClear)
2790         br.setClear(str);
2791 }
2792
2793 void JSHTMLElement::baseFontSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2794 {
2795     HTMLBaseFontElement& baseFont = *static_cast<HTMLBaseFontElement*>(impl());
2796     switch (token) {
2797         case BaseFontColor:           { baseFont.setColor(str); return; }
2798         case BaseFontFace:            { baseFont.setFace(str); return; }
2799         case BaseFontSize:            { baseFont.setSize(str); return; }
2800     }
2801 }
2802
2803 void JSHTMLElement::fontSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2804 {
2805     HTMLFontElement& font = *static_cast<HTMLFontElement*>(impl());
2806     switch (token) {
2807         case FontColor:           { font.setColor(str); return; }
2808         case FontFace:            { font.setFace(str); return; }
2809         case FontSize:            { font.setSize(str); return; }
2810     }
2811 }
2812
2813 void JSHTMLElement::hrSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2814 {
2815     HTMLHRElement& hr = *static_cast<HTMLHRElement*>(impl());
2816     switch (token) {
2817         case HRAlign:           { hr.setAlign(str); return; }
2818         case HRNoShade:         { hr.setNoShade(value->toBoolean(exec)); return; }
2819         case HRSize:            { hr.setSize(str); return; }
2820         case HRWidth:           { hr.setWidth(str); return; }
2821     }
2822 }
2823
2824 void JSHTMLElement::modSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2825 {
2826     HTMLModElement& mod = *static_cast<HTMLModElement*>(impl());
2827     switch (token) {
2828         case ModCite:            { mod.setCite(str); return; }
2829         case ModDateTime:        { mod.setDateTime(str); return; }
2830     }
2831 }
2832
2833 void JSHTMLElement::anchorSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2834 {
2835     HTMLAnchorElement& anchor = *static_cast<HTMLAnchorElement*>(impl());
2836     switch (token) {
2837         case AnchorAccessKey:       { anchor.setAccessKey(str); return; }
2838         case AnchorCharset:         { anchor.setCharset(str); return; }
2839         case AnchorCoords:          { anchor.setCoords(str); return; }
2840         case AnchorHref:            { anchor.setHref(str); return; }
2841         case AnchorHrefLang:        { anchor.setHreflang(str); return; }
2842         case AnchorName:            { anchor.setName(str); return; }
2843         case AnchorRel:             { anchor.setRel(str); return; }
2844         case AnchorRev:             { anchor.setRev(str); return; }
2845         case AnchorShape:           { anchor.setShape(str); return; }
2846         case AnchorTabIndex:        { anchor.setTabIndex(value->toInt32(exec)); return; }
2847         case AnchorTarget:          { anchor.setTarget(str); return; }
2848         case AnchorType:            { anchor.setType(str); return; }
2849     }
2850 }
2851
2852 void JSHTMLElement::imageSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2853 {
2854     HTMLImageElement& image = *static_cast<HTMLImageElement*>(impl());
2855     switch (token) {
2856         case ImageName:            { image.setName(str); return; }
2857         case ImageAlign:           { image.setAlign(str); return; }
2858         case ImageAlt:             { image.setAlt(str); return; }
2859         case ImageBorder:          { image.setBorder(value->toInt32(exec)); return; }
2860         case ImageHeight:          { image.setHeight(value->toInt32(exec)); return; }
2861         case ImageHspace:          { image.setHspace(value->toInt32(exec)); return; }
2862         case ImageIsMap:           { image.setIsMap(value->toBoolean(exec)); return; }
2863         case ImageLongDesc:        { image.setLongDesc(str); return; }
2864         case ImageSrc:             { image.setSrc(str); return; }
2865         case ImageUseMap:          { image.setUseMap(str); return; }
2866         case ImageVspace:          { image.setVspace(value->toInt32(exec)); return; }
2867         case ImageWidth:           { image.setWidth(value->toInt32(exec)); return; }
2868     }
2869 }
2870
2871 void JSHTMLElement::objectSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2872 {
2873     HTMLObjectElement& object = *static_cast<HTMLObjectElement*>(impl());
2874     switch (token) {
2875         // read-only: form
2876         case ObjectCode:            { object.setCode(str); return; }
2877         case ObjectAlign:           { object.setAlign(str); return; }
2878         case ObjectArchive:         { object.setArchive(str); return; }
2879         case ObjectBorder:          { object.setBorder(str); return; }
2880         case ObjectCodeBase:        { object.setCodeBase(str); return; }
2881         case ObjectCodeType:        { object.setCodeType(str); return; }
2882         // read-only: ObjectContentDocument
2883         case ObjectData:            { object.setData(str); return; }
2884         case ObjectDeclare:         { object.setDeclare(value->toBoolean(exec)); return; }
2885         case ObjectHeight:          { object.setHeight(str); return; }
2886         case ObjectHspace:          { object.setHspace(str); return; }
2887         case ObjectName:            { object.setName(str); return; }
2888         case ObjectStandby:         { object.setStandby(str); return; }
2889         case ObjectTabIndex:        { object.setTabIndex(value->toInt32(exec)); return; }
2890         case ObjectType:            { object.setType(str); return; }
2891         case ObjectUseMap:          { object.setUseMap(str); return; }
2892         case ObjectVspace:          { object.setVspace(str); return; }
2893         case ObjectWidth:           { object.setWidth(str); return; }
2894     }
2895 }
2896
2897 void JSHTMLElement::paramSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2898 {
2899     HTMLParamElement& param = *static_cast<HTMLParamElement*>(impl());
2900     switch (token) {
2901         case ParamName:            { param.setName(str); return; }
2902         case ParamType:            { param.setType(str); return; }
2903         case ParamValue:           { param.setValue(str); return; }
2904         case ParamValueType:       { param.setValueType(str); return; }
2905     }
2906 }
2907
2908 void JSHTMLElement::appletSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2909 {
2910     HTMLAppletElement& applet = *static_cast<HTMLAppletElement*>(impl());
2911     switch (token) {
2912         case AppletAlign:           { applet.setAlign(str); return; }
2913         case AppletAlt:             { applet.setAlt(str); return; }
2914         case AppletArchive:         { applet.setArchive(str); return; }
2915         case AppletCode:            { applet.setCode(str); return; }
2916         case AppletCodeBase:        { applet.setCodeBase(str); return; }
2917         case AppletHeight:          { applet.setHeight(str); return; }
2918         case AppletHspace:          { applet.setHspace(str); return; }
2919         case AppletName:            { applet.setName(str); return; }
2920         case AppletObject:          { applet.setObject(str); return; }
2921         case AppletVspace:          { applet.setVspace(str); return; }
2922         case AppletWidth:           { applet.setWidth(str); return; }
2923     }
2924 }
2925
2926 void JSHTMLElement::mapSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2927 {
2928     HTMLMapElement& map = *static_cast<HTMLMapElement*>(impl());
2929     if (token == MapName)
2930         // read-only: areas
2931         map.setName(str);
2932 }
2933
2934 void JSHTMLElement::areaSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2935 {
2936     HTMLAreaElement& area = *static_cast<HTMLAreaElement*>(impl());
2937     switch (token) {
2938         case AreaAccessKey:       { area.setAccessKey(str); return; }
2939         case AreaAlt:             { area.setAlt(str); return; }
2940         case AreaCoords:          { area.setCoords(str); return; }
2941         case AreaHref:            { area.setHref(str); return; }
2942         case AreaNoHref:          { area.setNoHref(value->toBoolean(exec)); return; }
2943         case AreaShape:           { area.setShape(str); return; }
2944         case AreaTabIndex:        { area.setTabIndex(value->toInt32(exec)); return; }
2945         case AreaTarget:          { area.setTarget(str); return; }
2946     }
2947 }
2948
2949 void JSHTMLElement::scriptSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2950 {
2951     HTMLScriptElement& script = *static_cast<HTMLScriptElement*>(impl());
2952     switch (token) {
2953         case ScriptText:            { script.setText(str); return; }
2954         case ScriptHtmlFor:         { script.setHtmlFor(str); return; }
2955         case ScriptEvent:           { script.setEvent(str); return; }
2956         case ScriptCharset:         { script.setCharset(str); return; }
2957         case ScriptDefer:           { script.setDefer(value->toBoolean(exec)); return; }
2958         case ScriptSrc:             { script.setSrc(str); return; }
2959         case ScriptType:            { script.setType(str); return; }
2960     }
2961 }
2962
2963 void JSHTMLElement::tableSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2964 {
2965     HTMLTableElement& table = *static_cast<HTMLTableElement*>(impl());
2966     switch (token) {
2967         case TableCaption:         { table.setCaption(toHTMLTableCaptionElement(value)); return; }
2968         case TableTHead:           { table.setTHead(toHTMLTableSectionElement(value)); return; }
2969         case TableTFoot:           { table.setTFoot(toHTMLTableSectionElement(value)); return; }
2970         // read-only: rows
2971         // read-only: tbodies
2972         case TableAlign:           { table.setAlign(str); return; }
2973         case TableBgColor:         { table.setBgColor(str); return; }
2974         case TableBorder:          { table.setBorder(str); return; }
2975         case TableCellPadding:     { table.setCellPadding(str); return; }
2976         case TableCellSpacing:     { table.setCellSpacing(str); return; }
2977         case TableFrame:           { table.setFrame(str); return; }
2978         case TableRules:           { table.setRules(str); return; }
2979         case TableSummary:         { table.setSummary(str); return; }
2980         case TableWidth:           { table.setWidth(str); return; }
2981     }
2982 }
2983
2984 void JSHTMLElement::tableCaptionSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2985 {
2986     HTMLTableCaptionElement& tableCaption = *static_cast<HTMLTableCaptionElement*>(impl());
2987     if (token == TableCaptionAlign)
2988         tableCaption.setAlign(str);
2989 }
2990
2991 void JSHTMLElement::tableColSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
2992 {
2993     HTMLTableColElement& tableCol = *static_cast<HTMLTableColElement*>(impl());
2994     switch (token) {
2995         case TableColAlign:           { tableCol.setAlign(str); return; }
2996         case TableColCh:              { tableCol.setCh(str); return; }
2997         case TableColChOff:           { tableCol.setChOff(str); return; }
2998         case TableColSpan:            { tableCol.setSpan(value->toInt32(exec)); return; }
2999         case TableColVAlign:          { tableCol.setVAlign(str); return; }
3000         case TableColWidth:           { tableCol.setWidth(str); return; }
3001     }
3002 }
3003
3004 void JSHTMLElement::tableSectionSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
3005 {
3006     HTMLTableSectionElement& tableSection = *static_cast<HTMLTableSectionElement*>(impl());
3007     switch (token) {
3008         case TableSectionAlign:           { tableSection.setAlign(str); return; }
3009         case TableSectionCh:              { tableSection.setCh(str); return; }
3010         case TableSectionChOff:           { tableSection.setChOff(str); return; }
3011         case TableSectionVAlign:          { tableSection.setVAlign(str); return; }
3012         // read-only: rows
3013     }
3014 }
3015
3016 void JSHTMLElement::tableRowSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
3017 {
3018     HTMLTableRowElement& tableRow = *static_cast<HTMLTableRowElement*>(impl());
3019     switch (token) {
3020         // read-only: rowIndex
3021         // read-only: sectionRowIndex
3022         // read-only: cells
3023         case TableRowAlign:           { tableRow.setAlign(str); return; }
3024         case TableRowBgColor:         { tableRow.setBgColor(str); return; }
3025         case TableRowCh:              { tableRow.setCh(str); return; }
3026         case TableRowChOff:           { tableRow.setChOff(str); return; }
3027         case TableRowVAlign:          { tableRow.setVAlign(str); return; }
3028     }
3029 }
3030
3031 void JSHTMLElement::tableCellSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
3032 {
3033     HTMLTableCellElement& tableCell = *static_cast<HTMLTableCellElement*>(impl());
3034     switch (token) {
3035         // read-only: cellIndex
3036         case TableCellAbbr:            { tableCell.setAbbr(str); return; }
3037         case TableCellAlign:           { tableCell.setAlign(str); return; }
3038         case TableCellAxis:            { tableCell.setAxis(str); return; }
3039         case TableCellBgColor:         { tableCell.setBgColor(str); return; }
3040         case TableCellCh:              { tableCell.setCh(str); return; }
3041         case TableCellChOff:           { tableCell.setChOff(str); return; }
3042         case TableCellColSpan:         { tableCell.setColSpan(value->toInt32(exec)); return; }
3043         case TableCellHeaders:         { tableCell.setHeaders(str); return; }
3044         case TableCellHeight:          { tableCell.setHeight(str); return; }
3045         case TableCellNoWrap:          { tableCell.setNoWrap(value->toBoolean(exec)); return; }
3046         case TableCellRowSpan:         { tableCell.setRowSpan(value->toInt32(exec)); return; }
3047         case TableCellScope:           { tableCell.setScope(str); return; }
3048         case TableCellVAlign:          { tableCell.setVAlign(str); return; }
3049         case TableCellWidth:           { tableCell.setWidth(str); return; }
3050     }
3051 }
3052
3053 void JSHTMLElement::frameSetSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
3054 {
3055     HTMLFrameSetElement& frameSet = *static_cast<HTMLFrameSetElement*>(impl());
3056     switch (token) {
3057         case FrameSetCols:            { frameSet.setCols(str); return; }
3058         case FrameSetRows:            { frameSet.setRows(str); return; }
3059     }
3060 }
3061
3062 void JSHTMLElement::frameSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
3063 {
3064     HTMLFrameElement& frameElement = *static_cast<HTMLFrameElement*>(impl());
3065     switch (token) {
3066         // read-only: FrameContentDocument:
3067         case FrameFrameBorder:     { frameElement.setFrameBorder(str); return; }
3068         case FrameLongDesc:        { frameElement.setLongDesc(str); return; }
3069         case FrameMarginHeight:    { frameElement.setMarginHeight(str); return; }
3070         case FrameMarginWidth:     { frameElement.setMarginWidth(str); return; }
3071         case FrameName:            { frameElement.setName(str); return; }
3072         case FrameNoResize:        { frameElement.setNoResize(value->toBoolean(exec)); return; }
3073         case FrameScrolling:       { frameElement.setScrolling(str); return; }
3074         case FrameSrc:             { frameElement.setSrc(str); return; }
3075         case FrameLocation:        { frameElement.setLocation(str); return; }
3076     }
3077 }
3078
3079 void JSHTMLElement::iFrameSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
3080 {
3081     HTMLIFrameElement& iFrame = *static_cast<HTMLIFrameElement*>(impl());
3082     switch (token) {
3083         case IFrameAlign:           { iFrame.setAlign(str); return; }
3084         // read-only: IFrameContentDocument
3085         case IFrameFrameBorder:     { iFrame.setFrameBorder(str); return; }
3086         case IFrameHeight:          { iFrame.setHeight(str); return; }
3087         case IFrameLongDesc:        { iFrame.setLongDesc(str); return; }
3088         case IFrameMarginHeight:    { iFrame.setMarginHeight(str); return; }
3089         case IFrameMarginWidth:     { iFrame.setMarginWidth(str); return; }
3090         case IFrameName:            { iFrame.setName(str); return; }
3091         case IFrameScrolling:       { iFrame.setScrolling(str); return; }
3092         case IFrameSrc:             { iFrame.setSrc(str); return; }
3093         case IFrameWidth:           { iFrame.setWidth(str); return; }
3094     }
3095 }
3096
3097 void JSHTMLElement::marqueeSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
3098 {
3099     // FIXME: Find out what WinIE supports and implement it.
3100 }
3101
3102 void JSHTMLElement::putValueProperty(ExecState *exec, int token, JSValue *value, int)
3103 {
3104     DOMExceptionTranslator exception(exec);
3105     WebCore::String str = value->toString(exec);
3106  
3107     // Check our set of generic properties first.
3108     HTMLElement &element = *static_cast<HTMLElement *>(impl());
3109     switch (token) {
3110         case ElementId:
3111             element.setId(str);
3112             return;
3113         case ElementTitle:
3114             element.setTitle(str);
3115             return;
3116         case ElementLang:
3117             element.setLang(str);
3118             return;
3119         case ElementDir:
3120             element.setDir(str);
3121             return;
3122         case ElementClassName:
3123             element.setClassName(str);
3124             return;
3125         case ElementInnerHTML:
3126             element.setInnerHTML(str, exception);
3127             return;
3128         case ElementInnerText:
3129             element.setInnerText(str, exception);
3130             return;
3131         case ElementOuterHTML:
3132             element.setOuterHTML(str, exception);
3133             return;
3134         case ElementOuterText:
3135             element.setOuterText(str, exception);
3136             return;
3137         case ElementContentEditable:
3138             element.setContentEditable(str);
3139             return;
3140     }
3141
3142     // Now check for properties that apply to a specific element type.
3143     const Accessors* access = accessors();
3144     if (access && access->m_setter)
3145         return (this->*(access->m_setter))(exec, token, value, str);  
3146 }
3147
3148 HTMLElement *toHTMLElement(JSValue *val)
3149 {
3150     if (!val || !val->isObject(&JSHTMLElement::info))
3151         return 0;
3152     return static_cast<HTMLElement *>(static_cast<JSHTMLElement *>(val)->impl());
3153 }
3154
3155 HTMLTableCaptionElement *toHTMLTableCaptionElement(JSValue *val)
3156 {
3157     HTMLElement *e = toHTMLElement(val);
3158     if (e && e->hasTagName(captionTag))
3159         return static_cast<HTMLTableCaptionElement *>(e);
3160     return 0;
3161 }
3162
3163 HTMLTableSectionElement *toHTMLTableSectionElement(JSValue *val)
3164 {
3165     HTMLElement *e = toHTMLElement(val);
3166     if (e && (e->hasTagName(theadTag) || e->hasTagName(tbodyTag) || e->hasTagName(tfootTag)))
3167         return static_cast<HTMLTableSectionElement *>(e);
3168     return 0;
3169 }
3170
3171 // -------------------------------------------------------------------------
3172 /* Source for HTMLCollectionProtoTable. Use "make hashtables" to regenerate.
3173 @begin HTMLCollectionProtoTable 3
3174   item          JSHTMLCollection::Item            DontDelete|Function 1
3175   namedItem     JSHTMLCollection::NamedItem       DontDelete|Function 1
3176   tags          JSHTMLCollection::Tags            DontDelete|Function 1
3177 @end
3178 */
3179 KJS_DEFINE_PROTOTYPE(HTMLCollectionProto)
3180 KJS_IMPLEMENT_PROTOFUNC(HTMLCollectionProtoFunc)
3181 KJS_IMPLEMENT_PROTOTYPE("HTMLCollection",HTMLCollectionProto,HTMLCollectionProtoFunc)
3182
3183 const ClassInfo JSHTMLCollection::info = { "HTMLCollection", 0, 0, 0 };
3184
3185 JSHTMLCollection::JSHTMLCollection(ExecState *exec, HTMLCollection *c)
3186   : m_impl(c) 
3187 {
3188   setPrototype(HTMLCollectionProto::self(exec));
3189 }
3190
3191 JSHTMLCollection::~JSHTMLCollection()
3192 {
3193   ScriptInterpreter::forgetDOMObject(m_impl.get());
3194 }
3195
3196 JSValue *JSHTMLCollection::lengthGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
3197 {
3198     JSHTMLCollection *thisObj = static_cast<JSHTMLCollection *>(slot.slotBase());
3199     return jsNumber(thisObj->m_impl->length());
3200 }
3201
3202 JSValue *JSHTMLCollection::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
3203 {
3204     JSHTMLCollection *thisObj = static_cast<JSHTMLCollection *>(slot.slotBase());
3205     return toJS(exec, thisObj->m_impl->item(slot.index()));
3206 }
3207
3208 JSValue *JSHTMLCollection::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
3209 {
3210     JSHTMLCollection *thisObj = static_cast<JSHTMLCollection *>(slot.slotBase());
3211     return thisObj->