| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kjs_html.cpp

    00001 // -*- c-basic-offset: 2 -*-
    00002 /*
    00003  *  This file is part of the KDE libraries
    00004  *  Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
    00005  *  Copyright (C) 2001-2003 David Faure (faure@kde.org)
    00006  *  Copyright (C) 2003 Apple Computer, Inc.
    00007  *
    00008  *  This library is free software; you can redistribute it and/or
    00009  *  modify it under the terms of the GNU Library General Public
    00010  *  License as published by the Free Software Foundation; either
    00011  *  version 2 of the License, or (at your option) any later version.
    00012  *
    00013  *  This library is distributed in the hope that it will be useful,
    00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00016  *  Library General Public License for more details.
    00017  *
    00018  *  You should have received a copy of the GNU Library General Public
    00019  *  License along with this library; if not, write to the Free Software
    00020  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00021  */
    00022
    00023 #include "misc/loader.h"
    00024 #include "dom/html_block.h"
    00025 #include "dom/html_head.h"
    00026 #include "dom/html_image.h"
    00027 #include "dom/html_inline.h"
    00028 #include "dom/html_list.h"
    00029 #include "dom/html_table.h"
    00030 #include "dom/html_object.h"
    00031 #include "dom/dom_exception.h"
    00032
    00033 // ### HACK
    00034 #include "html/html_baseimpl.h"
    00035 #include "html/html_documentimpl.h"
    00036 #include "html/html_imageimpl.h"
    00037 #include "html/html_miscimpl.h"
    00038 #include "xml/dom2_eventsimpl.h"
    00039
    00040 #include <kparts/browserextension.h>
    00041
    00042 #include "khtml_part.h"
    00043 #include "khtmlview.h"
    00044
    00045 #include "ecma/kjs_css.h"
    00046 #include "ecma/kjs_events.h"
    00047 #include "ecma/kjs_html.h"
    00048 #include "ecma/kjs_window.h"
    00049 #include "kjs_html.lut.h"
    00050
    00051 #include "misc/htmltags.h"
    00052 #include "misc/htmlattrs.h"
    00053 #include "rendering/render_object.h"
    00054 #include "rendering/render_canvas.h"
    00055 #include "rendering/render_frames.h"
    00056 #include "rendering/render_layer.h"
    00057
    00058 #include "kmessagebox.h"
    00059 #include <kstringhandler.h>
    00060 #include <klocale.h>
    00061
    00062 #include <kdebug.h>
    00063
    00064 using namespace KJS;
    00065
    00066 IMPLEMENT_PROTOFUNC_DOM(HTMLDocFunction)
    00067
    00068 Value KJS::HTMLDocFunction::tryCall(ExecState *exec, Object &thisObj, const List &args)
    00069 {
    00070   KJS_CHECK_THIS( HTMLDocument, thisObj );
    00071
    00072   DOM::HTMLDocument doc = static_cast<KJS::HTMLDocument *>(thisObj.imp())->toDocument();
    00073
    00074   switch (id) {
    00075   case HTMLDocument::Clear: // even IE doesn't support that one...
    00076     //doc.clear(); // TODO
    00077     return Undefined();
    00078   case HTMLDocument::Open:
    00079     if (args.size() >= 3) // IE extension for document.open: it means window.open if it has 3 args or more
    00080     {
    00081       KHTMLView *view = static_cast<DOM::DocumentImpl*>(doc.handle())->view();
    00082       if ( view && view->part() ) {
    00083         Window* win = Window::retrieveWindow(view->part());
    00084         if( win ) {
    00085           win->openWindow(exec, args);
    00086         }
    00087       }
    00088     }
    00089
    00090     doc.open();
    00091     return Undefined();
    00092   case HTMLDocument::Close:
    00093     // see khtmltests/ecma/tokenizer-script-recursion.html
    00094     doc.close();
    00095     return Undefined();
    00096   case HTMLDocument::Write:
    00097   case HTMLDocument::WriteLn: {
    00098     // DOM only specifies single string argument, but NS & IE allow multiple
    00099     // or no arguments
    00100     UString str = "";
    00101     for (int i = 0; i < args.size(); i++)
    00102       str += args[i].toString(exec);
    00103     if (id == HTMLDocument::WriteLn)
    00104       str += "\n";
    00105 #ifdef KJS_VERBOSE
    00106     kdDebug(6070) << "document.write: " << str.string().string() << endl;
    00107 #endif
    00108     doc.write(str.string());
    00109     return Undefined();
    00110   }
    00111   case HTMLDocument::GetElementsByName:
    00112     return getDOMNodeList(exec,doc.getElementsByName(args[0].toString(exec).string()));
    00113   case HTMLDocument::GetSelection: {
    00114     // NS4 and Mozilla specific. IE uses document.selection.createRange()
    00115     // http://docs.sun.com/source/816-6408-10/document.htm#1195981
    00116     KHTMLView *view = static_cast<DOM::DocumentImpl*>(doc.handle())->view();
    00117     if ( view && view->part() )
    00118        return String(view->part()->selectedText());
    00119     else
    00120        return Undefined();
    00121   }
    00122   case HTMLDocument::CaptureEvents:
    00123   case HTMLDocument::ReleaseEvents:
    00124     // Do nothing for now. These are NS-specific legacy calls.
    00125     break;
    00126   }
    00127
    00128   return Undefined();
    00129 }
    00130
    00131 const ClassInfo KJS::HTMLDocument::info =
    00132   { "HTMLDocument", &DOMDocument::info, &HTMLDocumentTable, 0 };
    00133 /* Source for HTMLDocumentTable.
    00134 @begin HTMLDocumentTable 31
    00135   title         HTMLDocument::Title     DontDelete
    00136   referrer      HTMLDocument::Referrer      DontDelete|ReadOnly
    00137   domain        HTMLDocument::Domain        DontDelete
    00138   URL           HTMLDocument::URL       DontDelete|ReadOnly
    00139   body          HTMLDocument::Body      DontDelete
    00140   location      HTMLDocument::Location      DontDelete
    00141   cookie        HTMLDocument::Cookie        DontDelete
    00142   images        HTMLDocument::Images        DontDelete|ReadOnly
    00143   applets       HTMLDocument::Applets       DontDelete|ReadOnly
    00144   links         HTMLDocument::Links     DontDelete|ReadOnly
    00145   forms         HTMLDocument::Forms     DontDelete|ReadOnly
    00146   anchors       HTMLDocument::Anchors       DontDelete|ReadOnly
    00147   scripts       HTMLDocument::Scripts       DontDelete|ReadOnly
    00148   all           HTMLDocument::All       DontDelete|ReadOnly
    00149   clear         HTMLDocument::Clear     DontDelete|Function 0
    00150   open          HTMLDocument::Open      DontDelete|Function 0
    00151   close         HTMLDocument::Close     DontDelete|Function 0
    00152   write         HTMLDocument::Write     DontDelete|Function 1
    00153   writeln       HTMLDocument::WriteLn       DontDelete|Function 1
    00154   getElementsByName HTMLDocument::GetElementsByName DontDelete|Function 1
    00155   getSelection  HTMLDocument::GetSelection  DontDelete|Function 1
    00156   captureEvents     HTMLDocument::CaptureEvents DontDelete|Function 0
    00157   releaseEvents     HTMLDocument::ReleaseEvents DontDelete|Function 0
    00158   bgColor       HTMLDocument::BgColor       DontDelete
    00159   fgColor       HTMLDocument::FgColor       DontDelete
    00160   alinkColor        HTMLDocument::AlinkColor    DontDelete
    00161   linkColor     HTMLDocument::LinkColor     DontDelete
    00162   vlinkColor        HTMLDocument::VlinkColor    DontDelete
    00163   lastModified      HTMLDocument::LastModified  DontDelete|ReadOnly
    00164   height        HTMLDocument::Height        DontDelete|ReadOnly
    00165   width         HTMLDocument::Width     DontDelete|ReadOnly
    00166   dir           HTMLDocument::Dir       DontDelete
    00167   compatMode        HTMLDocument::CompatMode    DontDelete|ReadOnly
    00168 #IE extension
    00169   frames        HTMLDocument::Frames        DontDelete|ReadOnly
    00170 #NS4 extension
    00171   layers        HTMLDocument::Layers        DontDelete|ReadOnly
    00172 #potentially obsolete array properties
    00173 # plugins
    00174 # tags
    00175 #potentially obsolete properties
    00176 # embeds
    00177 # ids
    00178 @end
    00179 */
    00180
    00181 void NamedTagLengthDeterminer::operator () (NodeImpl *start) {
    00182   for(NodeImpl *n = start->firstChild(); n != 0; n = n->nextSibling())
    00183     if ( n->nodeType() == Node::ELEMENT_NODE ) {
    00184       for (int i = 0; i < nrTags; i++)
    00185         if (n->id() == tags[i].id &&
    00186             static_cast<ElementImpl *>(n)->getAttribute(ATTR_NAME) == name) {
    00187           tags[i].length++;
    00188           tags[i].last = n;   // cache this NodeImpl*
    00189           nrTags = i+1;       // forget about Tags with lower preference
    00190           break;
    00191         }
    00192       (*this)(n);
    00193     }
    00194 }
    00195
    00196 KJS::HTMLDocument::HTMLDocument(ExecState *exec, const DOM::HTMLDocument& d)
    00197   /*TODO pass HTMLDocumentProto::self(exec), but it needs to access DOMDocumentProto...*/
    00198   : DOMDocument(exec, d) { }
    00199
    00200 bool KJS::HTMLDocument::hasProperty(ExecState *exec, const Identifier &p) const
    00201 {
    00202 #ifdef KJS_VERBOSE
    00203   //kdDebug(6070) << "KJS::HTMLDocument::hasProperty " << p.qstring() << endl;
    00204 #endif
    00205   DOM::HTMLDocument doc = static_cast<DOM::HTMLDocument>(node);
    00206   KHTMLView *view = static_cast<DOM::DocumentImpl*>(doc.handle())->view();
    00207   Window* win = view && view->part() ? Window::retrieveWindow(view->part()) : 0L;
    00208   if ( !win || !win->isSafeScript(exec) )
    00209     return false;
    00210
    00211   // Keep in sync with tryGet
    00212   NamedTagLengthDeterminer::TagLength tags[4] = {
    00213       {ID_IMG, 0, 0L}, {ID_FORM, 0, 0L}, {ID_APPLET, 0, 0L}, {ID_LAYER, 0, 0L}
    00214   };
    00215   NamedTagLengthDeterminer(p.string(), tags, 4)(doc.handle());
    00216   for (int i = 0; i < 4; i++)
    00217     if (tags[i].length > 0)
    00218         return true;
    00219
    00220   if ( view && view->part() )
    00221   {
    00222     KHTMLPart *kp = view->part()->findFrame( p.qstring() );
    00223     if (kp)
    00224       return true;
    00225   }
    00226
    00227   return DOMDocument::hasProperty(exec, p);
    00228 }
    00229
    00230 Value KJS::HTMLDocument::tryGet(ExecState *exec, const Identifier &propertyName) const
    00231 {
    00232 #ifdef KJS_VERBOSE
    00233   kdDebug(6070) << "KJS::HTMLDocument::tryGet " << propertyName.qstring() << endl;
    00234 #endif
    00235
    00236   DOM::HTMLDocument doc = static_cast<DOM::HTMLDocument>(node);
    00237   KHTMLView *view = static_cast<DOM::DocumentImpl*>(doc.handle())->view();
    00238
    00239   Window* win = view && view->part() ? Window::retrieveWindow(view->part()) : 0L;
    00240   if ( !win || !win->isSafeScript(exec) )
    00241     return Undefined();
    00242
    00243   // Check for images with name==propertyName, return item or list if found
    00244   // We don't use the images collection because it looks for id=p and name=p, we only want name=p
    00245   // Check for forms with name==propertyName, return item or list if found
    00246   // Note that document.myform should only look at forms
    00247   // Check for applets with name==propertyName, return item or list if found
    00248
    00249   NamedTagLengthDeterminer::TagLength tags[4] = {
    00250     {ID_IMG, 0, 0L}, {ID_FORM, 0, 0L}, {ID_APPLET, 0, 0L}, {ID_LAYER, 0, 0L}
    00251   };
    00252   NamedTagLengthDeterminer(propertyName.string(), tags, 4)(doc.handle());
    00253   for (int i = 0; i < 4; i++)
    00254     if (tags[i].length > 0) {
    00255       if (tags[i].length == 1)
    00256         return getDOMNode(exec, tags[i].last);
    00257       // Get all the items with the same name
    00258       return getDOMNodeList(exec, DOM::NodeList(new DOM::NamedTagNodeListImpl(doc.handle(), tags[i].id, propertyName.string())));
    00259     }
    00260
    00261   // Check for frames/iframes with name==propertyName
    00262   if ( view && view->part() )
    00263   {
    00264     // ###### TODO return a collection in case several frames have the same name
    00265     // (IE does that). Hard to do with findFrame :}
    00266     KHTMLPart *kp = view->part()->findFrame( propertyName.qstring() );
    00267     if (kp)
    00268       return Window::retrieve(kp);
    00269   }
    00270
    00271   const HashEntry* entry = Lookup::findEntry(&HTMLDocumentTable, propertyName);
    00272   if (entry) {
    00273     switch (entry->value) {
    00274     case Title:
    00275       return String(doc.title());
    00276     case Referrer:
    00277       return String(doc.referrer());
    00278     case Domain:
    00279       return String(doc.domain());
    00280     case URL:
    00281       return String(doc.URL());
    00282     case Body:
    00283       return getDOMNode(exec,doc.body());
    00284     case Location:
    00285       if (win)
    00286         return Value(win->location());
    00287       else
    00288         return Undefined();
    00289     case Cookie:
    00290       return String(doc.cookie());
    00291     case Images:
    00292       return getHTMLCollection(exec,doc.images());
    00293     case Applets:
    00294       return getHTMLCollection(exec,doc.applets());
    00295     case Links:
    00296       return getHTMLCollection(exec,doc.links());
    00297     case Forms:
    00298       return getHTMLCollection(exec,doc.forms());
    00299     case Layers:
    00300       // ### Should not be hidden when we emulate Netscape4
    00301       return getHTMLCollection(exec,doc.layers(), true);
    00302     case Anchors:
    00303       return getHTMLCollection(exec,doc.anchors());
    00304     case Scripts: // TODO (IE-specific)
    00305     {
    00306       // Disable document.scripts unless we try to be IE-compatible
    00307       // Especially since it's not implemented, so
    00308       // if (document.scripts) shouldn't return true.
    00309       if ( exec->interpreter()->compatMode() != Interpreter::IECompat )
    00310         return Undefined();
    00311       // To be implemented. Meanwhile, return an object with a length property set to 0
    00312       // This gets some code going on IE-specific pages.
    00313       // The script object isn't really simple to implement though
    00314       // (http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/script.asp)
    00315       kdDebug(6070) << "WARNING: KJS::HTMLDocument document.scripts called - not implemented" << endl;
    00316       Object obj( new ObjectImp() );
    00317       obj.put( exec, lengthPropertyName, Number(0) );
    00318       return obj;
    00319     }
    00320     case All:
    00321       // Disable document.all when we try to be Netscape-compatible
    00322       if ( exec->interpreter()->compatMode() == Interpreter::NetscapeCompat )
    00323         return Undefined();
    00324       else
    00325       if ( exec->interpreter()->compatMode() == Interpreter::IECompat )
    00326         return getHTMLCollection(exec,doc.all());
    00327       else // enabled but hidden
    00328         return getHTMLCollection(exec,doc.all(), true);
    00329     case Clear:
    00330     case Open:
    00331     case Close:
    00332     case Write:
    00333     case WriteLn:
    00334     case GetElementsByName:
    00335     case GetSelection:
    00336     case CaptureEvents:
    00337     case ReleaseEvents:
    00338       return lookupOrCreateFunction<HTMLDocFunction>( exec, propertyName, this, entry->value, entry->params, entry->attr );
    00339     case CompatMode:
    00340       return String(static_cast<HTMLDocumentImpl *>(doc.handle())->parseMode()
    00341               == DocumentImpl::Compat ? "BackCompat" : "CSS1Compat");
    00342     }
    00343   }
    00344   // Look for overrides
    00345   ValueImp * val = ObjectImp::getDirect(propertyName);
    00346   if (val)
    00347     return Value(val);
    00348
    00349   DOM::HTMLBodyElement body = doc.body();
    00350   if (entry) {
    00351     switch (entry->value) {
    00352     case BgColor:
    00353       return String(body.bgColor());
    00354     case FgColor:
    00355       return String(body.text());
    00356     case AlinkColor:
    00357       return String(body.aLink());
    00358     case LinkColor:
    00359       return String(body.link());
    00360     case VlinkColor:
    00361       return String(body.vLink());
    00362     case LastModified:
    00363       return String(doc.lastModified());
    00364     case Height: // NS-only, not available in IE
    00365       return Number(view ? view->contentsHeight() : 0);
    00366     case Width: // NS-only, not available in IE
    00367       return Number(view ? view->contentsWidth() : 0);
    00368     case Dir:
    00369       return String(body.dir());
    00370     case Frames:
    00371       if ( win )
    00372         return Value(win->frames(exec));
    00373       else
    00374         return Undefined();
    00375     }
    00376   }
    00377   if (DOMDocument::hasProperty(exec, propertyName))
    00378     return DOMDocument::tryGet(exec, propertyName);
    00379
    00380   // allow shortcuts like 'document.Applet1' instead of document.applets.Applet1
    00381   if (doc.isHTMLDocument()) { // might be XML
    00382     DOM::HTMLCollection coll = doc.applets();
    00383     DOM::HTMLElement element = coll.namedItem(propertyName.string());
    00384     if (!element.isNull()) {
    00385       return getDOMNode(exec,element);
    00386     }
    00387
    00388     DOM::HTMLCollection coll2 = doc.layers();
    00389     DOM::HTMLElement element2 = coll2.namedItem(propertyName.string());
    00390     if (!element2.isNull()) {
    00391       return getDOMNode(exec,element2);
    00392     }
    00393   }
    00394 #ifdef KJS_VERBOSE
    00395   kdDebug(6070) << "KJS::HTMLDocument::tryGet " << propertyName.qstring() << " not found" << endl;
    00396 #endif
    00397   return Undefined();
    00398 }
    00399
    00400 void KJS::HTMLDocument::tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
    00401 {
    00402 #ifdef KJS_VERBOSE
    00403   kdDebug(6070) << "KJS::HTMLDocument::tryPut " << propertyName.qstring() << endl;
    00404 #endif
    00405   KHTMLView *view = static_cast<DOM::DocumentImpl*>(node.handle())->view();
    00406
    00407   Window* win = view && view->part() ? Window::retrieveWindow(view->part()) : 0L;
    00408   if ( !win || !win->isSafeScript(exec) )
    00409     return;
    00410
    00411   DOMObjectLookupPut<HTMLDocument, DOMDocument>( exec, propertyName, value, attr, &HTMLDocumentTable, this );
    00412 }
    00413
    00414 void KJS::HTMLDocument::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
    00415 {
    00416   DOM::HTMLDocument doc = static_cast<DOM::HTMLDocument>(node);
    00417
    00418   DOM::HTMLBodyElement body = doc.body();
    00419   DOM::DOMString val = value.toString(exec).string();
    00420
    00421   switch (token) {
    00422   case Title:
    00423     if (doc.title() != val) doc.setTitle(val);
    00424     break;
    00425   case Body: {
    00426     DOMNode *node = new DOMNode(exec, KJS::toNode(value));
    00427     // This is required to avoid leaking the node.
    00428     Value nodeValue(node);
    00429     doc.setBody(node->toNode());
    00430     break;
    00431   }
    00432   case Domain: { // not part of the DOM
    00433     DOM::HTMLDocumentImpl* docimpl = static_cast<DOM::HTMLDocumentImpl*>(doc.handle());
    00434     if (docimpl)
    00435       docimpl->setDomain(val);
    00436     break;
    00437   }
    00438   case Cookie:
    00439     doc.setCookie(val);
    00440     break;
    00441   case Location:
    00442   {
    00443     KHTMLView *view = static_cast<DOM::DocumentImpl*>(doc.handle())->view();
    00444     if ( view )
    00445       Window::retrieveWindow(view->part())->goURL(exec, value.toString(exec).qstring(), false /*don't lock history*/);
    00446     break;
    00447   }
    00448   case BgColor:
    00449     if (body.bgColor() != val) body.setBgColor(val);
    00450     break;
    00451   case FgColor:
    00452     if (body.text() != val) body.setText(val);
    00453     break;
    00454   case AlinkColor:
    00455     if (body.aLink() != val) body.setALink(val);
    00456     break;
    00457   case LinkColor:
    00458     if (body.link() != val) body.setLink(val);
    00459     break;
    00460   case VlinkColor:
    00461     if (body.vLink() != val) body.setVLink(val);
    00462     break;
    00463   case Dir:
    00464     body.setDir(val);
    00465     break;
    00466   default:
    00467     kdDebug(6070) << "WARNING: HTMLDocument::putValueProperty unhandled token " << token << endl;
    00468   }
    00469 }
    00470
    00471 // -------------------------------------------------------------------------
    00472
    00473 const ClassInfo KJS::HTMLElement::info = { "HTMLElement", &DOMElement::info, &HTMLElementTable, 0 };
    00474 const ClassInfo KJS::HTMLElement::html_info = { "HTMLHtmlElement", &KJS::HTMLElement::info, &HTMLHtmlElementTable, 0 };
    00475 const ClassInfo KJS::HTMLElement::head_info = { "HTMLHeadElement", &KJS::HTMLElement::info, &HTMLHeadElementTable, 0 };
    00476 const ClassInfo KJS::HTMLElement::link_info = { "HTMLLinkElement", &KJS::HTMLElement::info, &HTMLLinkElementTable, 0 };
    00477 const ClassInfo KJS::HTMLElement::title_info = { "HTMLTitleElement", &KJS::HTMLElement::info, &HTMLTitleElementTable, 0 };
    00478 const ClassInfo KJS::HTMLElement::meta_info = { "HTMLMetaElement", &KJS::HTMLElement::info, &HTMLMetaElementTable, 0 };
    00479 const ClassInfo KJS::HTMLElement::base_info = { "HTMLBaseElement", &KJS::HTMLElement::info, &HTMLBaseElementTable, 0 };
    00480 const ClassInfo KJS::HTMLElement::isIndex_info = { "HTMLIsIndexElement", &KJS::HTMLElement::info, &HTMLIsIndexElementTable, 0 };
    00481 const ClassInfo KJS::HTMLElement::style_info = { "HTMLStyleElement", &KJS::HTMLElement::info, &HTMLStyleElementTable, 0 };
    00482 const ClassInfo KJS::HTMLElement::body_info = { "HTMLBodyElement", &KJS::HTMLElement::info, &HTMLBodyElementTable, 0 };
    00483 const ClassInfo KJS::HTMLElement::form_info = { "HTMLFormElement", &KJS::HTMLElement::info, &HTMLFormElementTable, 0 };
    00484 const ClassInfo KJS::HTMLElement::select_info = { "HTMLSelectElement", &KJS::HTMLElement::info, &HTMLSelectElementTable, 0 };
    00485 const ClassInfo KJS::HTMLElement::optGroup_info = { "HTMLOptGroupElement", &KJS::HTMLElement::info, &HTMLOptGroupElementTable, 0 };
    00486 const ClassInfo KJS::HTMLElement::option_info = { "HTMLOptionElement", &KJS::HTMLElement::info, &HTMLOptionElementTable, 0 };
    00487 const ClassInfo KJS::HTMLElement::input_info = { "HTMLInputElement", &KJS::HTMLElement::info, &HTMLInputElementTable, 0 };
    00488 const ClassInfo KJS::HTMLElement::textArea_info = { "HTMLTextAreaElement", &KJS::HTMLElement::info, &HTMLTextAreaElementTable, 0 };
    00489 const ClassInfo KJS::HTMLElement::button_info = { "HTMLButtonElement", &KJS::HTMLElement::info, &HTMLButtonElementTable, 0 };
    00490 const ClassInfo KJS::HTMLElement::label_info = { "HTMLLabelElement", &KJS::HTMLElement::info, &HTMLLabelElementTable, 0 };
    00491 const ClassInfo KJS::HTMLElement::fieldSet_info = { "HTMLFieldSetElement", &KJS::HTMLElement::info, &HTMLFieldSetElementTable, 0 };
    00492 const ClassInfo KJS::HTMLElement::legend_info = { "HTMLLegendElement", &KJS::HTMLElement::info, &HTMLLegendElementTable, 0 };
    00493 const ClassInfo KJS::HTMLElement::ul_info = { "HTMLUListElement", &KJS::HTMLElement::info, &HTMLUListElementTable, 0 };
    00494 const ClassInfo KJS::HTMLElement::ol_info = { "HTMLOListElement", &KJS::HTMLElement::info, &HTMLOListElementTable, 0 };
    00495 const ClassInfo KJS::HTMLElement::dl_info = { "HTMLDListElement", &KJS::HTMLElement::info, &HTMLDListElementTable, 0 };
    00496 const ClassInfo KJS::HTMLElement::dir_info = { "HTMLDirectoryElement", &KJS::HTMLElement::info, &HTMLDirectoryElementTable, 0 };
    00497 const ClassInfo KJS::HTMLElement::menu_info = { "HTMLMenuElement", &KJS::HTMLElement::info, &HTMLMenuElementTable, 0 };
    00498 const ClassInfo KJS::HTMLElement::li_info = { "HTMLLIElement", &KJS::HTMLElement::info, &HTMLLIElementTable, 0 };
    00499 const ClassInfo KJS::HTMLElement::div_info = { "HTMLDivElement", &KJS::HTMLElement::info, &HTMLDivElementTable, 0 };
    00500 const ClassInfo KJS::HTMLElement::p_info = { "HTMLParagraphElement", &KJS::HTMLElement::info, &HTMLParagraphElementTable, 0 };
    00501 const ClassInfo KJS::HTMLElement::heading_info = { "HTMLHeadingElement", &KJS::HTMLElement::info, &HTMLHeadingElementTable, 0 };
    00502 const ClassInfo KJS::HTMLElement::blockQuote_info = { "HTMLBlockQuoteElement", &KJS::HTMLElement::info, &HTMLBlockQuoteElementTable, 0 };
    00503 const ClassInfo KJS::HTMLElement::q_info = { "HTMLQuoteElement", &KJS::HTMLElement::info, &HTMLQuoteElementTable, 0 };
    00504 const ClassInfo KJS::HTMLElement::pre_info = { "HTMLPreElement", &KJS::HTMLElement::info, &HTMLPreElementTable, 0 };
    00505 const ClassInfo KJS::HTMLElement::br_info = { "HTMLBRElement", &KJS::HTMLElement::info, &HTMLBRElementTable, 0 };
    00506 const ClassInfo KJS::HTMLElement::baseFont_info = { "HTMLBaseFontElement", &KJS::HTMLElement::info, &HTMLBaseFontElementTable, 0 };
    00507 const ClassInfo KJS::HTMLElement::font_info = { "HTMLFontElement", &KJS::HTMLElement::info, &HTMLFontElementTable, 0 };
    00508 const ClassInfo KJS::HTMLElement::hr_info = { "HTMLHRElement", &KJS::HTMLElement::info, &HTMLHRElementTable, 0 };
    00509 const ClassInfo KJS::HTMLElement::mod_info = { "HTMLModElement", &KJS::HTMLElement::info, &HTMLModElementTable, 0 };
    00510 const ClassInfo KJS::HTMLElement::a_info = { "HTMLAnchorElement", &KJS::HTMLElement::info, &HTMLAnchorElementTable, 0 };
    00511 const ClassInfo KJS::HTMLElement::img_info = { "HTMLImageElement", &KJS::HTMLElement::info, &HTMLImageElementTable, 0 };
    00512 const ClassInfo KJS::HTMLElement::object_info = { "HTMLObjectElement", &KJS::HTMLElement::info, &HTMLObjectElementTable, 0 };
    00513 const ClassInfo KJS::HTMLElement::param_info = { "HTMLParamElement", &KJS::HTMLElement::info, &HTMLParamElementTable, 0 };
    00514 const ClassInfo KJS::HTMLElement::applet_info = { "HTMLAppletElement", &KJS::HTMLElement::info, &HTMLAppletElementTable, 0 };
    00515 const ClassInfo KJS::HTMLElement::map_info = { "HTMLMapElement", &KJS::HTMLElement::info, &HTMLMapElementTable, 0 };
    00516 const ClassInfo KJS::HTMLElement::area_info = { "HTMLAreaElement", &KJS::HTMLElement::info, &HTMLAreaElementTable, 0 };
    00517 const ClassInfo KJS::HTMLElement::script_info = { "HTMLScriptElement", &KJS::HTMLElement::info, &HTMLScriptElementTable, 0 };
    00518 const ClassInfo KJS::HTMLElement::table_info = { "HTMLTableElement", &KJS::HTMLElement::info, &HTMLTableElementTable, 0 };
    00519 const ClassInfo KJS::HTMLElement::caption_info = { "HTMLTableCaptionElement", &KJS::HTMLElement::info, &HTMLTableCaptionElementTable, 0 };
    00520 const ClassInfo KJS::HTMLElement::col_info = { "HTMLTableColElement", &KJS::HTMLElement::info, &HTMLTableColElementTable, 0 };
    00521 const ClassInfo KJS::HTMLElement::tablesection_info = { "HTMLTableSectionElement", &KJS::HTMLElement::info, &HTMLTableSectionElementTable, 0 };
    00522 const ClassInfo KJS::HTMLElement::tr_info = { "HTMLTableRowElement", &KJS::HTMLElement::info, &HTMLTableRowElementTable, 0 };
    00523 const ClassInfo KJS::HTMLElement::tablecell_info = { "HTMLTableCellElement", &KJS::HTMLElement::info, &HTMLTableCellElementTable, 0 };
    00524 const ClassInfo KJS::HTMLElement::frameSet_info = { "HTMLFrameSetElement", &KJS::HTMLElement::info, &HTMLFrameSetElementTable, 0 };
    00525 const ClassInfo KJS::HTMLElement::frame_info = { "HTMLFrameElement", &KJS::HTMLElement::info, &HTMLFrameElementTable, 0 };
    00526 const ClassInfo KJS::HTMLElement::iFrame_info = { "HTMLIFrameElement", &KJS::HTMLElement::info, &HTMLIFrameElementTable, 0 };
    00527 const ClassInfo KJS::HTMLElement::marquee_info = { "HTMLMarqueeElement", &KJS::HTMLElement::info, &HTMLMarqueeElementTable, 0 };
    00528 const ClassInfo KJS::HTMLElement::layer_info = { "HTMLLayerElement", &KJS::HTMLElement::info, &HTMLLayerElementTable, 0 };
    00529
    00530 const ClassInfo* KJS::HTMLElement::classInfo() const
    00531 {
    00532   DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);
    00533   switch (element.elementId()) {
    00534   case ID_HTML:
    00535     return &html_info;
    00536   case ID_HEAD:
    00537     return &head_info;
    00538   case ID_LINK:
    00539     return &link_info;
    00540   case ID_TITLE:
    00541     return &title_info;
    00542   case ID_META:
    00543     return &meta_info;
    00544   case ID_BASE:
    00545     return &base_info;
    00546   case ID_ISINDEX:
    00547     return &isIndex_info;
    00548   case ID_STYLE:
    00549     return &style_info;
    00550   case ID_BODY:
    00551     return &body_info;
    00552   case ID_FORM:
    00553     return &form_info;
    00554   case ID_SELECT:
    00555     return &select_info;
    00556   case ID_OPTGROUP:
    00557     return &optGroup_info;
    00558   case ID_OPTION:
    00559     return &option_info;
    00560   case ID_INPUT:
    00561     return &input_info;
    00562   case ID_TEXTAREA:
    00563     return &textArea_info;
    00564   case ID_BUTTON:
    00565     return &button_info;
    00566   case ID_LABEL:
    00567     return &label_info;
    00568   case ID_FIELDSET:
    00569     return &fieldSet_info;
    00570   case ID_LEGEND:
    00571     return &legend_info;
    00572   case ID_UL:
    00573     return &ul_info;
    00574   case ID_OL:
    00575     return &ol_info;
    00576   case ID_DL:
    00577     return &dl_info;
    00578   case ID_DIR:
    00579     return &dir_info;
    00580   case ID_MENU:
    00581     return &menu_info;
    00582   case ID_LI:
    00583     return &li_info;
    00584   case ID_DIV:
    00585     return &div_info;
    00586   case ID_P:
    00587     return &p_info;
    00588   case ID_H1:
    00589   case ID_H2:
    00590   case ID_H3:
    00591   case ID_H4:
    00592   case ID_H5:
    00593   case ID_H6:
    00594     return &heading_info;
    00595   case ID_BLOCKQUOTE:
    00596     return &blockQuote_info;
    00597   case ID_Q:
    00598     return &q_info;
    00599   case ID_PRE:
    00600     return &pre_info;
    00601   case ID_BR:
    00602     return &br_info;
    00603   case ID_BASEFONT:
    00604     return &baseFont_info;
    00605   case ID_FONT:
    00606     return &font_info;
    00607   case ID_HR:
    00608     return &hr_info;
    00609   case ID_INS:
    00610   case ID_DEL:
    00611     return &mod_info;
    00612   case ID_A:
    00613     return &a_info;
    00614   case ID_IMG:
    00615     return &img_info;
    00616   case ID_OBJECT:
    00617     return &object_info;
    00618   case ID_PARAM:
    00619     return &param_info;
    00620   case ID_APPLET:
    00621     return &applet_info;
    00622   case ID_MAP:
    00623     return &map_info;
    00624   case ID_AREA:
    00625     return &area_info;
    00626   case ID_SCRIPT:
    00627     return &script_info;
    00628   case ID_TABLE:
    00629     return &table_info;
    00630   case ID_CAPTION:
    00631     return &caption_info;
    00632   case ID_COL:
    00633   case ID_COLGROUP:
    00634     return &col_info;
    00635   case ID_THEAD:
    00636     return &tablesection_info;
    00637   case ID_TBODY:
    00638     return &tablesection_info;
    00639   case ID_TFOOT:
    00640     return &tablesection_info;
    00641   case ID_TR:
    00642     return &tr_info;
    00643   case ID_TH:
    00644     return &tablecell_info;
    00645   case ID_TD:
    00646     return &tablecell_info;
    00647   case ID_FRAMESET:
    00648     return &frameSet_info;
    00649   case ID_FRAME:
    00650     return &frame_info;
    00651   case ID_IFRAME:
    00652     return &iFrame_info;
    00653   case ID_MARQUEE:
    00654     return &marquee_info;
    00655   case ID_LAYER:
    00656     return &layer_info;
    00657   default:
    00658     return &info;
    00659   }
    00660 }
    00661 /*
    00662 @begin HTMLElementTable 11
    00663   id        KJS::HTMLElement::ElementId DontDelete
    00664   title     KJS::HTMLElement::ElementTitle  DontDelete
    00665   lang      KJS::HTMLElement::ElementLang   DontDelete
    00666   dir       KJS::HTMLElement::ElementDir    DontDelete
    00667 ### isn't this "class" in the HTML spec?
    00668   className KJS::HTMLElement::ElementClassName DontDelete
    00669   innerHTML KJS::HTMLElement::ElementInnerHTML DontDelete
    00670   innerText KJS::HTMLElement::ElementInnerText DontDelete
    00671   document  KJS::HTMLElement::ElementDocument  DontDelete|ReadOnly
    00672 # IE extension
    00673   children  KJS::HTMLElement::ElementChildren  DontDelete|ReadOnly
    00674   all           KJS::HTMLElement::ElementAll       DontDelete|ReadOnly
    00675 @end
    00676 @begin HTMLHtmlElementTable 1
    00677   version   KJS::HTMLElement::HtmlVersion   DontDelete
    00678 @end
    00679 @begin HTMLHeadElementTable 1
    00680   profile   KJS::HTMLElement::HeadProfile   DontDelete
    00681 @end
    00682 @begin HTMLLinkElementTable 11
    00683   disabled  KJS::HTMLElement::LinkDisabled  DontDelete
    00684   charset   KJS::HTMLElement::LinkCharset   DontDelete
    00685   href      KJS::HTMLElement::LinkHref  DontDelete
    00686   hreflang  KJS::HTMLElement::LinkHrefLang  DontDelete
    00687   media     KJS::HTMLElement::LinkMedia DontDelete
    00688   rel       KJS::HTMLElement::LinkRel       DontDelete
    00689   rev       KJS::HTMLElement::LinkRev   DontDelete
    00690   target    KJS::HTMLElement::LinkTarget    DontDelete
    00691   type      KJS::HTMLElement::LinkType  DontDelete
    00692   sheet     KJS::HTMLElement::LinkSheet DontDelete|ReadOnly
    00693 @end
    00694 @begin HTMLTitleElementTable 1
    00695   text      KJS::HTMLElement::TitleText DontDelete
    00696 @end
    00697 @begin HTMLMetaElementTable 4
    00698   content   KJS::HTMLElement::MetaContent   DontDelete
    00699   httpEquiv KJS::HTMLElement::MetaHttpEquiv DontDelete
    00700   name      KJS::HTMLElement::MetaName  DontDelete
    00701   scheme    KJS::HTMLElement::MetaScheme    DontDelete
    00702 @end
    00703 @begin HTMLBaseElementTable 2
    00704   href      KJS::HTMLElement::BaseHref  DontDelete
    00705   target    KJS::HTMLElement::BaseTarget    DontDelete
    00706 @end
    00707 @begin HTMLIsIndexElementTable 2
    00708   form      KJS::HTMLElement::IsIndexForm   DontDelete|ReadOnly
    00709   prompt    KJS::HTMLElement::IsIndexPrompt DontDelete
    00710 @end
    00711 @begin HTMLStyleElementTable 4
    00712   disabled  KJS::HTMLElement::StyleDisabled DontDelete
    00713   media     KJS::HTMLElement::StyleMedia    DontDelete
    00714   type      KJS::HTMLElement::StyleType DontDelete
    00715   sheet     KJS::HTMLElement::StyleSheet    DontDelete|ReadOnly
    00716 @end
    00717 @begin HTMLBodyElementTable 8
    00718   aLink     KJS::HTMLElement::BodyALink DontDelete
    00719   background    KJS::HTMLElement::BodyBackground    DontDelete
    00720   bgColor   KJS::HTMLElement::BodyBgColor   DontDelete
    00721   link      KJS::HTMLElement::BodyLink  DontDelete
    00722   text      KJS::HTMLElement::BodyText  DontDelete
    00723   vLink     KJS::HTMLElement::BodyVLink DontDelete
    00724 # IE extension
    00725   scrollLeft    KJS::HTMLElement::BodyScrollLeft DontDelete
    00726   scrollTop KJS::HTMLElement::BodyScrollTop  DontDelete
    00727   scrollWidth   KJS::HTMLElement::BodyScrollWidth DontDelete|ReadOnly
    00728   scrollHeight  KJS::HTMLElement::BodyScrollHeight DontDelete|ReadOnly
    00729   onload        KJS::HTMLElement::BodyOnLoad     DontDelete
    00730 @end
    00731 @begin HTMLFormElementTable 11
    00732 # Also supported, by name/index
    00733   elements  KJS::HTMLElement::FormElements  DontDelete|ReadOnly
    00734   length    KJS::HTMLElement::FormLength    DontDelete|ReadOnly
    00735   name      KJS::HTMLElement::FormName  DontDelete
    00736   acceptCharset KJS::HTMLElement::FormAcceptCharset DontDelete
    00737   action    KJS::HTMLElement::FormAction    DontDelete
    00738   encoding  KJS::HTMLElement::FormEncType   DontDelete
    00739   enctype   KJS::HTMLElement::FormEncType   DontDelete
    00740   method    KJS::HTMLElement::FormMethod    DontDelete
    00741   target    KJS::HTMLElement::FormTarget    DontDelete
    00742   submit    KJS::HTMLElement::FormSubmit    DontDelete|Function 0
    00743   reset     KJS::HTMLElement::FormReset DontDelete|Function 0
    00744 @end
    00745 @begin HTMLSelectElementTable 11
    00746 # Also supported, by index
    00747   type      KJS::HTMLElement::SelectType    DontDelete|ReadOnly
    00748   selectedIndex KJS::HTMLElement::SelectSelectedIndex   DontDelete
    00749   value     KJS::HTMLElement::SelectValue   DontDelete
    00750   length    KJS::HTMLElement::SelectLength  DontDelete
    00751   form      KJS::HTMLElement::SelectForm    DontDelete|ReadOnly
    00752   options   KJS::HTMLElement::SelectOptions DontDelete|ReadOnly
    00753   disabled  KJS::HTMLElement::SelectDisabled    DontDelete
    00754   multiple  KJS::HTMLElement::SelectMultiple    DontDelete
    00755   name      KJS::HTMLElement::SelectName    DontDelete
    00756   size      KJS::HTMLElement::SelectSize    DontDelete
    00757   tabIndex  KJS::HTMLElement::SelectTabIndex    DontDelete
    00758   add       KJS::HTMLElement::SelectAdd DontDelete|Function 2
    00759   remove    KJS::HTMLElement::SelectRemove  DontDelete|Function 1
    00760   blur      KJS::HTMLElement::SelectBlur    DontDelete|Function 0
    00761   focus     KJS::HTMLElement::SelectFocus   DontDelete|Function 0
    00762 @end
    00763 @begin HTMLOptGroupElementTable 2
    00764   disabled  KJS::HTMLElement::OptGroupDisabled  DontDelete
    00765   label     KJS::HTMLElement::OptGroupLabel     DontDelete
    00766 @end
    00767 @begin HTMLOptionElementTable 8
    00768   form      KJS::HTMLElement::OptionForm        DontDelete|ReadOnly
    00769   defaultSelected KJS::HTMLElement::OptionDefaultSelected   DontDelete
    00770   text      KJS::HTMLElement::OptionText        DontDelete
    00771   index     KJS::HTMLElement::OptionIndex       DontDelete|ReadOnly
    00772   disabled  KJS::HTMLElement::OptionDisabled    DontDelete
    00773   label     KJS::HTMLElement::OptionLabel       DontDelete
    00774   selected  KJS::HTMLElement::OptionSelected    DontDelete
    00775   value     KJS::HTMLElement::OptionValue       DontDelete
    00776 @end
    00777 @begin HTMLInputElementTable 24
    00778   defaultValue  KJS::HTMLElement::InputDefaultValue DontDelete
    00779   defaultChecked KJS::HTMLElement::InputDefaultChecked  DontDelete
    00780   form      KJS::HTMLElement::InputForm     DontDelete|ReadOnly
    00781   accept    KJS::HTMLElement::InputAccept       DontDelete
    00782   accessKey KJS::HTMLElement::InputAccessKey    DontDelete
    00783   align     KJS::HTMLElement::InputAlign        DontDelete
    00784   alt       KJS::HTMLElement::InputAlt      DontDelete
    00785   checked   KJS::HTMLElement::InputChecked      DontDelete
    00786   status    KJS::HTMLElement::InputChecked      DontDelete
    00787   disabled  KJS::HTMLElement::InputDisabled     DontDelete
    00788   maxLength KJS::HTMLElement::InputMaxLength    DontDelete
    00789   name      KJS::HTMLElement::InputName     DontDelete
    00790   readOnly  KJS::HTMLElement::InputReadOnly     DontDelete
    00791   size      KJS::HTMLElement::InputSize     DontDelete
    00792   src       KJS::HTMLElement::InputSrc      DontDelete
    00793   tabIndex  KJS::HTMLElement::InputTabIndex     DontDelete
    00794   type      KJS::HTMLElement::InputType     DontDelete
    00795   useMap    KJS::HTMLElement::InputUseMap       DontDelete
    00796   value     KJS::HTMLElement::InputValue        DontDelete
    00797   blur      KJS::HTMLElement::InputBlur     DontDelete|Function 0
    00798   focus     KJS::HTMLElement::InputFocus        DontDelete|Function 0
    00799   select    KJS::HTMLElement::InputSelect       DontDelete|Function 0
    00800   click     KJS::HTMLElement::InputClick        DontDelete|Function 0
    00801 @end
    00802 @begin HTMLTextAreaElementTable 13
    00803   defaultValue  KJS::HTMLElement::TextAreaDefaultValue  DontDelete
    00804   form      KJS::HTMLElement::TextAreaForm      DontDelete|ReadOnly
    00805   accessKey KJS::HTMLElement::TextAreaAccessKey DontDelete
    00806   cols      KJS::HTMLElement::TextAreaCols      DontDelete
    00807   disabled  KJS::HTMLElement::TextAreaDisabled  DontDelete
    00808   name      KJS::HTMLElement::TextAreaName      DontDelete
    00809   readOnly  KJS::HTMLElement::TextAreaReadOnly  DontDelete
    00810   rows      KJS::HTMLElement::TextAreaRows      DontDelete
    00811   tabIndex  KJS::HTMLElement::TextAreaTabIndex  DontDelete
    00812   type      KJS::HTMLElement::TextAreaType      DontDelete|ReadOnly
    00813   value     KJS::HTMLElement::TextAreaValue     DontDelete
    00814   blur      KJS::HTMLElement::TextAreaBlur      DontDelete|Function 0
    00815   focus     KJS::HTMLElement::TextAreaFocus     DontDelete|Function 0
    00816   select    KJS::HTMLElement::TextAreaSelect    DontDelete|Function 0
    00817 @end
    00818 @begin HTMLButtonElementTable 7
    00819   form      KJS::HTMLElement::ButtonForm        DontDelete|ReadOnly
    00820   accessKey KJS::HTMLElement::ButtonAccessKey   DontDelete
    00821   disabled  KJS::HTMLElement::ButtonDisabled    DontDelete
    00822   name      KJS::HTMLElement::ButtonName        DontDelete
    00823   tabIndex  KJS::HTMLElement::ButtonTabIndex    DontDelete
    00824   type      KJS::HTMLElement::ButtonType        DontDelete|ReadOnly
    00825   value     KJS::HTMLElement::ButtonValue       DontDelete
    00826 @end
    00827 @begin HTMLLabelElementTable 3
    00828   form      KJS::HTMLElement::LabelForm     DontDelete|ReadOnly
    00829   accessKey KJS::HTMLElement::LabelAccessKey    DontDelete
    00830   htmlFor   KJS::HTMLElement::LabelHtmlFor      DontDelete
    00831 @end
    00832 @begin HTMLFieldSetElementTable 1
    00833   form      KJS::HTMLElement::FieldSetForm      DontDelete|ReadOnly
    00834 @end
    00835 @begin HTMLLegendElementTable 3
    00836   form      KJS::HTMLElement::LegendForm        DontDelete|ReadOnly
    00837   accessKey KJS::HTMLElement::LegendAccessKey   DontDelete
    00838   align     KJS::HTMLElement::LegendAlign       DontDelete
    00839 @end
    00840 @begin HTMLUListElementTable 2
    00841   compact   KJS::HTMLElement::UListCompact      DontDelete
    00842   type      KJS::HTMLElement::UListType     DontDelete
    00843 @end
    00844 @begin HTMLOListElementTable 3
    00845   compact   KJS::HTMLElement::OListCompact      DontDelete
    00846   start     KJS::HTMLElement::OListStart        DontDelete
    00847   type      KJS::HTMLElement::OListType     DontDelete
    00848 @end
    00849 @begin HTMLDListElementTable 1
    00850   compact   KJS::HTMLElement::DListCompact      DontDelete
    00851 @end
    00852 @begin HTMLDirectoryElementTable 1
    00853   compact   KJS::HTMLElement::DirectoryCompact  DontDelete
    00854 @end
    00855 @begin HTMLMenuElementTable 1
    00856   compact   KJS::HTMLElement::MenuCompact       DontDelete
    00857 @end
    00858 @begin HTMLLIElementTable 2
    00859   type      KJS::HTMLElement::LIType        DontDelete
    00860   value     KJS::HTMLElement::LIValue       DontDelete
    00861 @end
    00862 @begin HTMLDivElementTable 1
    00863   align     KJS::HTMLElement::DivAlign      DontDelete
    00864 @end
    00865 @begin HTMLParagraphElementTable 1
    00866   align     KJS::HTMLElement::ParagraphAlign    DontDelete
    00867 @end
    00868 @begin HTMLHeadingElementTable 1
    00869   align     KJS::HTMLElement::HeadingAlign      DontDelete
    00870 @end
    00871 @begin HTMLBlockQuoteElementTable 1
    00872   cite      KJS::HTMLElement::BlockQuoteCite    DontDelete
    00873 @end
    00874 @begin HTMLQuoteElementTable 1
    00875   cite      KJS::HTMLElement::QuoteCite     DontDelete
    00876 @end
    00877 @begin HTMLPreElementTable 1
    00878   width     KJS::HTMLElement::PreWidth      DontDelete
    00879 @end
    00880 @begin HTMLBRElementTable 1
    00881   clear     KJS::HTMLElement::BRClear       DontDelete
    00882 @end
    00883 @begin HTMLBaseFontElementTable 3
    00884   color     KJS::HTMLElement::BaseFontColor     DontDelete
    00885   face      KJS::HTMLElement::BaseFontFace      DontDelete
    00886   size      KJS::HTMLElement::BaseFontSize      DontDelete
    00887 @end
    00888 @begin HTMLFontElementTable 3
    00889   color     KJS::HTMLElement::FontColor     DontDelete
    00890   face      KJS::HTMLElement::FontFace      DontDelete
    00891   size      KJS::HTMLElement::FontSize      DontDelete
    00892 @end
    00893 @begin HTMLHRElementTable 4
    00894   align     KJS::HTMLElement::HRAlign       DontDelete
    00895   noShade   KJS::HTMLElement::HRNoShade     DontDelete
    00896   size      KJS::HTMLElement::HRSize        DontDelete
    00897   width     KJS::HTMLElement::HRWidth       DontDelete
    00898 @end
    00899 @begin HTMLModElementTable 2
    00900   cite      KJS::HTMLElement::ModCite       DontDelete
    00901   dateTime  KJS::HTMLElement::ModDateTime       DontDelete
    00902 @end
    00903 @begin HTMLAnchorElementTable 23
    00904   accessKey KJS::HTMLElement::AnchorAccessKey   DontDelete
    00905   charset   KJS::HTMLElement::AnchorCharset     DontDelete
    00906   coords    KJS::HTMLElement::AnchorCoords      DontDelete
    00907   href      KJS::HTMLElement::AnchorHref        DontDelete
    00908   hreflang  KJS::HTMLElement::AnchorHrefLang    DontDelete
    00909   hash      KJS::HTMLElement::AnchorHash        DontDelete|ReadOnly
    00910   host      KJS::HTMLElement::AnchorHost        DontDelete|ReadOnly
    00911   hostname  KJS::HTMLElement::AnchorHostname    DontDelete|ReadOnly
    00912   name      KJS::HTMLElement::AnchorName        DontDelete
    00913   pathname  KJS::HTMLElement::AnchorPathName    DontDelete|ReadOnly
    00914   port      KJS::HTMLElement::AnchorPort        DontDelete|ReadOnly
    00915   protocol  KJS::HTMLElement::AnchorProtocol    DontDelete|ReadOnly
    00916   rel       KJS::HTMLElement::AnchorRel     DontDelete
    00917   rev       KJS::HTMLElement::AnchorRev     DontDelete
    00918   search    KJS::HTMLElement::AnchorSearch      DontDelete|ReadOnly
    00919   shape     KJS::HTMLElement::AnchorShape       DontDelete
    00920   tabIndex  KJS::HTMLElement::AnchorTabIndex    DontDelete
    00921   target    KJS::HTMLElement::AnchorTarget      DontDelete
    00922   text      KJS::HTMLElement::AnchorText        DontDelete|ReadOnly
    00923   type      KJS::HTMLElement::AnchorType        DontDelete
    00924   blur      KJS::HTMLElement::AnchorBlur        DontDelete|Function 0
    00925   focus     KJS::HTMLElement::AnchorFocus       DontDelete|Function 0
    00926 @end
    00927 @begin HTMLImageElementTable 14
    00928   name      KJS::HTMLElement::ImageName     DontDelete
    00929   align     KJS::HTMLElement::ImageAlign        DontDelete
    00930   alt       KJS::HTMLElement::ImageAlt      DontDelete
    00931   border    KJS::HTMLElement::ImageBorder       DontDelete
    00932   complete  KJS::HTMLElement::ImageComplete     DontDelete|ReadOnly
    00933   height    KJS::HTMLElement::ImageHeight       DontDelete
    00934   hspace    KJS::HTMLElement::ImageHspace       DontDelete
    00935   isMap     KJS::HTMLElement::ImageIsMap        DontDelete
    00936   longDesc  KJS::HTMLElement::ImageLongDesc     DontDelete
    00937   src       KJS::HTMLElement::ImageSrc      DontDelete
    00938   useMap    KJS::HTMLElement::ImageUseMap       DontDelete
    00939   vspace    KJS::HTMLElement::ImageVspace       DontDelete
    00940   width     KJS::HTMLElement::ImageWidth        DontDelete
    00941   x         KJS::HTMLElement::ImageX        DontDelete|ReadOnly
    00942   y         KJS::HTMLElement::ImageY        DontDelete|ReadOnly
    00943 @end
    00944 @begin HTMLObjectElementTable 20
    00945   form        KJS::HTMLElement::ObjectForm        DontDelete|ReadOnly
    00946   code        KJS::HTMLElement::ObjectCode        DontDelete
    00947   align       KJS::HTMLElement::ObjectAlign       DontDelete
    00948   archive     KJS::HTMLElement::ObjectArchive     DontDelete
    00949   border      KJS::HTMLElement::ObjectBorder      DontDelete
    00950   codeBase    KJS::HTMLElement::ObjectCodeBase    DontDelete
    00951   codeType    KJS::HTMLElement::ObjectCodeType    DontDelete
    00952   contentDocument KJS::HTMLElement::ObjectContentDocument DontDelete|ReadOnly
    00953   data        KJS::HTMLElement::ObjectData        DontDelete
    00954   declare     KJS::HTMLElement::ObjectDeclare     DontDelete
    00955   height      KJS::HTMLElement::ObjectHeight      DontDelete
    00956   hspace      KJS::HTMLElement::ObjectHspace      DontDelete
    00957   name        KJS::HTMLElement::ObjectName        DontDelete
    00958   standby     KJS::HTMLElement::ObjectStandby     DontDelete
    00959   tabIndex    KJS::HTMLElement::ObjectTabIndex    DontDelete
    00960   type        KJS::HTMLElement::ObjectType        DontDelete
    00961   useMap      KJS::HTMLElement::ObjectUseMap      DontDelete
    00962   vspace      KJS::HTMLElement::ObjectVspace      DontDelete
    00963   width       KJS::HTMLElement::ObjectWidth       DontDelete
    00964 @end
    00965 @begin HTMLParamElementTable 4
    00966   name      KJS::HTMLElement::ParamName     DontDelete
    00967   type      KJS::HTMLElement::ParamType     DontDelete
    00968   value     KJS::HTMLElement::ParamValue        DontDelete
    00969   valueType KJS::HTMLElement::ParamValueType    DontDelete
    00970 @end
    00971 @begin HTMLAppletElementTable 11
    00972   align     KJS::HTMLElement::AppletAlign       DontDelete
    00973   alt       KJS::HTMLElement::AppletAlt     DontDelete
    00974   archive   KJS::HTMLElement::AppletArchive     DontDelete
    00975   code      KJS::HTMLElement::AppletCode        DontDelete
    00976   codeBase  KJS::HTMLElement::AppletCodeBase    DontDelete
    00977   height    KJS::HTMLElement::AppletHeight      DontDelete
    00978   hspace    KJS::HTMLElement::AppletHspace      DontDelete
    00979   name      KJS::HTMLElement::AppletName        DontDelete
    00980   object    KJS::HTMLElement::AppletObject      DontDelete
    00981   vspace    KJS::HTMLElement::AppletVspace      DontDelete
    00982   width     KJS::HTMLElement::AppletWidth       DontDelete
    00983 @end
    00984 @begin HTMLMapElementTable 2
    00985   areas     KJS::HTMLElement::MapAreas      DontDelete|ReadOnly
    00986   name      KJS::HTMLElement::MapName       DontDelete
    00987 @end
    00988 @begin HTMLAreaElementTable 15
    00989   accessKey KJS::HTMLElement::AreaAccessKey     DontDelete
    00990   alt       KJS::HTMLElement::AreaAlt       DontDelete
    00991   coords    KJS::HTMLElement::AreaCoords        DontDelete
    00992   href      KJS::HTMLElement::AreaHref      DontDelete
    00993   hash      KJS::HTMLElement::AreaHash      DontDelete|ReadOnly
    00994   host      KJS::HTMLElement::AreaHost      DontDelete|ReadOnly
    00995   hostname  KJS::HTMLElement::AreaHostName      DontDelete|ReadOnly
    00996   pathname  KJS::HTMLElement::AreaPathName      DontDelete|ReadOnly
    00997   port      KJS::HTMLElement::AreaPort      DontDelete|ReadOnly
    00998   protocol  KJS::HTMLElement::AreaProtocol      DontDelete|ReadOnly
    00999   search    KJS::HTMLElement::AreaSearch        DontDelete|ReadOnly
    01000   noHref    KJS::HTMLElement::AreaNoHref        DontDelete
    01001   shape     KJS::HTMLElement::AreaShape     DontDelete
    01002   tabIndex  KJS::HTMLElement::AreaTabIndex      DontDelete
    01003   target    KJS::HTMLElement::AreaTarget        DontDelete
    01004 @end
    01005 @begin HTMLScriptElementTable 7
    01006   text      KJS::HTMLElement::ScriptText        DontDelete
    01007   htmlFor   KJS::HTMLElement::ScriptHtmlFor     DontDelete
    01008   event     KJS::HTMLElement::ScriptEvent       DontDelete
    01009   charset   KJS::HTMLElement::ScriptCharset     DontDelete
    01010   defer     KJS::HTMLElement::ScriptDefer       DontDelete
    01011   src       KJS::HTMLElement::ScriptSrc     DontDelete
    01012   type      KJS::HTMLElement::ScriptType        DontDelete
    01013 @end
    01014 @begin HTMLTableElementTable 23
    01015   caption   KJS::HTMLElement::TableCaption      DontDelete
    01016   tHead     KJS::HTMLElement::TableTHead        DontDelete
    01017   tFoot     KJS::HTMLElement::TableTFoot        DontDelete
    01018   rows      KJS::HTMLElement::TableRows     DontDelete|ReadOnly
    01019   tBodies   KJS::HTMLElement::TableTBodies      DontDelete|ReadOnly
    01020   align     KJS::HTMLElement::TableAlign        DontDelete
    01021   bgColor   KJS::HTMLElement::TableBgColor      DontDelete
    01022   border    KJS::HTMLElement::TableBorder       DontDelete
    01023   cellPadding   KJS::HTMLElement::TableCellPadding  DontDelete
    01024   cellSpacing   KJS::HTMLElement::TableCellSpacing  DontDelete
    01025   frame     KJS::HTMLElement::TableFrame        DontDelete
    01026   rules     KJS::HTMLElement::TableRules        DontDelete
    01027   summary   KJS::HTMLElement::TableSummary      DontDelete
    01028   width     KJS::HTMLElement::TableWidth        DontDelete
    01029   createTHead   KJS::HTMLElement::TableCreateTHead  DontDelete|Function 0
    01030   deleteTHead   KJS::HTMLElement::TableDeleteTHead  DontDelete|Function 0
    01031   createTFoot   KJS::HTMLElement::TableCreateTFoot  DontDelete|Function 0
    01032   deleteTFoot   KJS::HTMLElement::TableDeleteTFoot  DontDelete|Function 0
    01033   createCaption KJS::HTMLElement::TableCreateCaption    DontDelete|Function 0
    01034   deleteCaption KJS::HTMLElement::TableDeleteCaption    DontDelete|Function 0
    01035   insertRow KJS::HTMLElement::TableInsertRow    DontDelete|Function 1
    01036   deleteRow KJS::HTMLElement::TableDeleteRow    DontDelete|Function 1
    01037 @end
    01038 @begin HTMLTableCaptionElementTable 1
    01039   align     KJS::HTMLElement::TableCaptionAlign DontDelete
    01040 @end
    01041 @begin HTMLTableColElementTable 7
    01042   align     KJS::HTMLElement::TableColAlign     DontDelete
    01043   ch        KJS::HTMLElement::TableColCh        DontDelete
    01044   chOff     KJS::HTMLElement::TableColChOff     DontDelete
    01045   span      KJS::HTMLElement::TableColSpan      DontDelete
    01046   vAlign    KJS::HTMLElement::TableColVAlign    DontDelete
    01047   width     KJS::HTMLElement::TableColWidth     DontDelete
    01048 @end
    01049 @begin HTMLTableSectionElementTable 7
    01050   align     KJS::HTMLElement::TableSectionAlign     DontDelete
    01051   ch        KJS::HTMLElement::TableSectionCh        DontDelete
    01052   chOff     KJS::HTMLElement::TableSectionChOff     DontDelete
    01053   vAlign    KJS::HTMLElement::TableSectionVAlign        DontDelete
    01054   rows      KJS::HTMLElement::TableSectionRows      DontDelete|ReadOnly
    01055   insertRow KJS::HTMLElement::TableSectionInsertRow     DontDelete|Function 1
    01056   deleteRow KJS::HTMLElement::TableSectionDeleteRow     DontDelete|Function 1
    01057 @end
    01058 @begin HTMLTableRowElementTable 11
    01059   rowIndex  KJS::HTMLElement::TableRowRowIndex      DontDelete|ReadOnly
    01060   sectionRowIndex KJS::HTMLElement::TableRowSectionRowIndex DontDelete|ReadOnly
    01061   cells     KJS::HTMLElement::TableRowCells         DontDelete|ReadOnly
    01062   align     KJS::HTMLElement::TableRowAlign         DontDelete
    01063   bgColor   KJS::HTMLElement::TableRowBgColor       DontDelete
    01064   ch        KJS::HTMLElement::TableRowCh            DontDelete
    01065   chOff     KJS::HTMLElement::TableRowChOff         DontDelete
    01066   vAlign    KJS::HTMLElement::TableRowVAlign        DontDelete
    01067   insertCell    KJS::HTMLElement::TableRowInsertCell        DontDelete|Function 1
    01068   deleteCell    KJS::HTMLElement::TableRowDeleteCell        DontDelete|Function 1
    01069 @end
    01070 @begin HTMLTableCellElementTable 15
    01071   cellIndex KJS::HTMLElement::TableCellCellIndex        DontDelete|ReadOnly
    01072   abbr      KJS::HTMLElement::TableCellAbbr         DontDelete
    01073   align     KJS::HTMLElement::TableCellAlign        DontDelete
    01074   axis      KJS::HTMLElement::TableCellAxis         DontDelete
    01075   bgColor   KJS::HTMLElement::TableCellBgColor      DontDelete
    01076   ch        KJS::HTMLElement::TableCellCh           DontDelete
    01077   chOff     KJS::HTMLElement::TableCellChOff        DontDelete
    01078   colSpan   KJS::HTMLElement::TableCellColSpan      DontDelete
    01079   headers   KJS::HTMLElement::TableCellHeaders      DontDelete
    01080   height    KJS::HTMLElement::TableCellHeight       DontDelete
    01081   noWrap    KJS::HTMLElement::TableCellNoWrap       DontDelete
    01082   rowSpan   KJS::HTMLElement::TableCellRowSpan      DontDelete
    01083   scope     KJS::HTMLElement::TableCellScope        DontDelete
    01084   vAlign    KJS::HTMLElement::TableCellVAlign       DontDelete
    01085   width     KJS::HTMLElement::TableCellWidth        DontDelete
    01086 @end
    01087 @begin HTMLFrameSetElementTable 2
    01088   cols      KJS::HTMLElement::FrameSetCols          DontDelete
    01089   rows      KJS::HTMLElement::FrameSetRows          DontDelete
    01090 @end
    01091 @begin HTMLLayerElementTable 6
    01092   top         KJS::HTMLElement::LayerTop            DontDelete
    01093   left        KJS::HTMLElement::LayerLeft           DontDelete
    01094   visibility      KJS::HTMLElement::LayerVisibility     DontDelete
    01095   bgColor     KJS::HTMLElement::LayerBgColor        DontDelete
    01096   document        KJS::HTMLElement::LayerDocument       DontDelete|ReadOnly
    01097   clip        KJS::HTMLElement::LayerClip           DontDelete|ReadOnly
    01098   layers      KJS::HTMLElement::LayerLayers         DontDelete|ReadOnly
    01099 @end
    01100 @begin HTMLFrameElementTable 9
    01101   contentDocument KJS::HTMLElement::FrameContentDocument        DontDelete|ReadOnly
    01102   frameBorder     KJS::HTMLElement::FrameFrameBorder        DontDelete
    01103   longDesc    KJS::HTMLElement::FrameLongDesc       DontDelete
    01104   marginHeight    KJS::HTMLElement::FrameMarginHeight       DontDelete
    01105   marginWidth     KJS::HTMLElement::FrameMarginWidth        DontDelete
    01106   name        KJS::HTMLElement::FrameName           DontDelete
    01107   noResize    KJS::HTMLElement::FrameNoResize       DontDelete
    01108   scrolling   KJS::HTMLElement::FrameScrolling      DontDelete
    01109   src         KJS::HTMLElement::FrameSrc            DontDelete
    01110   location    KJS::HTMLElement::FrameLocation       DontDelete
    01111 @end
    01112 @begin HTMLIFrameElementTable 12
    01113   align       KJS::HTMLElement::IFrameAlign         DontDelete
    01114   contentDocument KJS::HTMLElement::IFrameContentDocument       DontDelete|ReadOnly
    01115   frameBorder     KJS::HTMLElement::IFrameFrameBorder       DontDelete
    01116   height      KJS::HTMLElement::IFrameHeight        DontDelete
    01117   longDesc    KJS::HTMLElement::IFrameLongDesc      DontDelete
    01118   marginHeight    KJS::HTMLElement::IFrameMarginHeight      DontDelete
    01119   marginWidth     KJS::HTMLElement::IFrameMarginWidth       DontDelete
    01120   name        KJS::HTMLElement::IFrameName          DontDelete
    01121   scrolling   KJS::HTMLElement::IFrameScrolling     DontDelete
    01122   src         KJS::HTMLElement::IFrameSrc           DontDelete
    01123   width       KJS::HTMLElement::IFrameWidth         DontDelete
    01124 @end
    01125
    01126 @begin HTMLMarqueeElementTable 2
    01127   start           KJS::HTMLElement::MarqueeStart        DontDelete|Function 0
    01128   stop            KJS::HTMLElement::MarqueeStop                 DontDelete|Function 0
    01129 @end
    01130
    01131 */
    01132
    01133 static KParts::LiveConnectExtension *getLiveConnectExtension(const DOM::HTMLElement & element)
    01134 {
    01135   DOM::HTMLDocument doc = element.ownerDocument();
    01136   KHTMLView *view = static_cast<DOM::DocumentImpl*>(doc.handle())->view();
    01137   if (view && element.handle())
    01138     return view->part()->liveConnectExtension(static_cast<khtml::RenderPart*>(element.handle()->renderer()));
    01139   return 0L;
    01140 }
    01141
    01142 Value KJS::HTMLElement::tryGet(ExecState *exec, const Identifier &propertyName) const
    01143 {
    01144   DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);
    01145 #ifdef KJS_VERBOSE
    01146   kdDebug(6070) << "KJS::HTMLElement::tryGet " << propertyName.qstring() << " thisTag=" << element.tagName().string() << endl;
    01147 #endif
    01148   // First look at dynamic properties
    01149   switch (element.elementId()) {
    01150     case ID_FORM: {
    01151       DOM::HTMLFormElement form = element;
    01152       // Check if we're retrieving an element (by index or by name)
    01153       bool ok;
    01154       uint u = propertyName.toULong(&ok);
    01155
    01156       if (ok)
    01157         return getDOMNode(exec,form.elements().item(u));
    01158       KJS::HTMLCollection coll(exec, form.elements());
    01159       Value namedItems = coll.getNamedItems(exec, propertyName);
    01160       if (namedItems.type() != UndefinedType)
    01161         return namedItems;
    01162     }
    01163       break;
    01164     case ID_SELECT: {
    01165       DOM::HTMLSelectElement select = element;
    01166       bool ok;
    01167       uint u = propertyName.toULong(&ok);
    01168       if (ok)
    01169         return getDOMNode(exec,select.options().item(u)); // not specified by DOM(?) but supported in netscape/IE
    01170     }
    01171       break;
    01172     case ID_APPLET:
    01173     case ID_OBJECT:
    01174     case ID_EMBED: {
    01175       KParts::LiveConnectExtension *lc = getLiveConnectExtension(element);
    01176       QString rvalue;
    01177       KParts::LiveConnectExtension::Type rtype;
    01178       unsigned long robjid;
    01179       if (lc && lc->get(0, propertyName.qstring(), rtype, robjid, rvalue))
    01180         return getLiveConnectValue(lc, propertyName.qstring(), rtype, rvalue, robjid);
    01181     }
    01182       break;
    01183   default:
    01184     break;
    01185   }
    01186
    01187   const HashTable* table = classInfo()->propHashTable; // get the right hashtable
    01188   const HashEntry* entry = Lookup::findEntry(table, propertyName);
    01189   if (entry) {
    01190     if (entry->attr & Function)
    01191       return lookupOrCreateFunction<KJS::HTMLElementFunction>(exec, propertyName, this, entry->value, entry->params, entry->attr);
    01192     return getValueProperty(exec, entry->value);
    01193   }
    01194
    01195   // Base HTMLElement stuff or parent class forward, as usual
    01196   return DOMObjectLookupGet<KJS::HTMLElementFunction, KJS::HTMLElement, DOMElement>(exec, propertyName, &KJS::HTMLElementTable, this);
    01197 }
    01198
    01199 Value KJS::HTMLElement::getValueProperty(ExecState *exec, int token) const
    01200 {
    01201   DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);
    01202   switch (element.elementId()) {
    01203   case ID_HTML: {
    01204     DOM::HTMLHtmlElement html = element;
    01205     if      (token == HtmlVersion)         return String(html.version());
    01206   }
    01207   break;
    01208   case ID_HEAD: {
    01209     DOM::HTMLHeadElement head = element;
    01210     if      (token == HeadProfile)         return String(head.profile());
    01211   }
    01212   break;
    01213   case ID_LINK: {
    01214     DOM::HTMLLinkElement link = element;
    01215     switch (token) {
    01216     case LinkDisabled:        return Boolean(link.disabled());
    01217     case LinkCharset:         return String(link.charset());
    01218     case LinkHref:            return String(link.href());
    01219     case LinkHrefLang:        return String(link.hreflang());
    01220     case LinkMedia:           return String(link.media());
    01221     case LinkRel:             return String(link.rel());
    01222     case LinkRev:             return String(link.rev());
    01223     case LinkTarget:          return String(link.target());
    01224     case LinkType:            return String(link.type());
    01225     case LinkSheet:           return getDOMStyleSheet(exec,static_cast<DOM::ProcessingInstruction>(node).sheet());
    01226     }
    01227   }
    01228   break;
    01229   case ID_TITLE: {
    01230     DOM::HTMLTitleElement title = element;
    01231     switch (token) {
    01232     case TitleText:                 return String(title.text());
    01233     }
    01234   }
    01235   break;
    01236   case ID_META: {
    01237     DOM::HTMLMetaElement meta = element;
    01238     switch (token) {
    01239     case MetaContent:         return String(meta.content());
    01240     case MetaHttpEquiv:       return String(meta.httpEquiv());
    01241     case MetaName:            return String(meta.name());
    01242     case MetaScheme:          return String(meta.scheme());
    01243     }
    01244   }
    01245   break;
    01246   case ID_BASE: {
    01247     DOM::HTMLBaseElement base = element;
    01248     switch (token) {
    01249     case BaseHref:            return String(base.href());
    01250     case BaseTarget:          return String(base.target());
    01251     }
    01252   }
    01253   break;
    01254   case ID_ISINDEX: {
    01255     DOM::HTMLIsIndexElement isindex = element;
    01256     switch (token) {
    01257     case IsIndexForm:            return getDOMNode(exec,isindex.form()); // type HTMLFormElement
    01258     case IsIndexPrompt:          return String(isindex.prompt());
    01259     }
    01260   }
    01261   break;
    01262   case ID_STYLE: {
    01263     DOM::HTMLStyleElement style = element;
    01264     switch (token) {
    01265     case StyleDisabled:        return Boolean(style.disabled());
    01266     case StyleMedia:           return String(style.media());
    01267     case StyleType:            return String(style.type());
    01268     case StyleSheet:           return getDOMStyleSheet(exec,style.sheet());
    01269     }
    01270   }
    01271   break;
    01272   case ID_BODY: {
    01273     DOM::HTMLBodyElement body = element;
    01274     switch (token) {
    01275     case BodyALink:           return String(body.aLink());
    01276     case BodyBackground:      return String(body.background());
    01277     case BodyBgColor:         return String(body.bgColor());
    01278     case BodyLink:            return String(body.link());
    01279     case BodyText:            return String(body.text());
    01280     case BodyVLink:           return String(body.vLink());
    01281     case BodyOnLoad: {
    01282         DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl *>(node.ownerDocument().handle());
    01283         if (!doc || !checkNodeSecurity(exec, node))
    01284           return Undefined();
    01285         DOMNode* kjsDocNode = new DOMNode(exec, doc);
    01286         // Need to create a Value wrapper to avoid leaking the KJS::DOMNode
    01287         Value nodeValue(kjsDocNode);
    01288         return kjsDocNode->getListener( DOM::EventImpl::LOAD_EVENT );
    01289     }
    01290     default:
    01291       // Update the document's layout before we compute these attributes.
    01292       DOM::DocumentImpl* docimpl = node.handle()->getDocument();
    01293       if (docimpl)
    01294         docimpl->updateLayout();
    01295
    01296       switch( token ) {
    01297       case BodyScrollLeft:
    01298         return Number(body.ownerDocument().view() ? body.ownerDocument().view()->contentsX() : 0);
    01299       case BodyScrollTop:
    01300         return Number(body.ownerDocument().view() ? body.ownerDocument().view()->contentsY() : 0);
    01301       case BodyScrollHeight:   return Number(body.ownerDocument().view() ? body.ownerDocument().view()->contentsHeight() : 0);
    01302       case BodyScrollWidth:    return Number(body.ownerDocument().view() ? body.ownerDocument().view()->contentsWidth() : 0);
    01303       }
    01304     }
    01305   }
    01306   break;
    01307
    01308   case ID_FORM: {
    01309     DOM::HTMLFormElement form = element;
    01310     switch (token) {
    01311     case FormElements:        return getHTMLCollection(exec,form.elements());
    01312     case FormLength:          return Number(form.length());
    01313     case FormName:            return String(form.name()); // NOT getString (IE gives empty string)
    01314     case FormAcceptCharset:   return String(form.acceptCharset());
    01315     case FormAction:          return String(form.action());
    01316     case FormEncType:         return String(form.enctype());
    01317     case FormMethod:          return String(form.method());
    01318     case FormTarget:          return String(form.target());
    01319     }
    01320   }
    01321   break;
    01322   case ID_SELECT: {
    01323     DOM::HTMLSelectElement select = element;
    01324     switch (token) {
    01325     case SelectType:            return String(select.type());
    01326     case SelectSelectedIndex:   return Number(select.selectedIndex());
    01327     case SelectValue:           return String(select.value());
    01328     case SelectLength:          return Number(select.length());
    01329     case SelectForm:            return getDOMNode(exec,select.form()); // type HTMLFormElement
    01330     case SelectOptions:         return getSelectHTMLCollection(exec, select.options(), select); // type HTMLCollection
    01331     case SelectDisabled:        return Boolean(select.disabled());
    01332     case SelectMultiple:        return Boolean(select.multiple());
    01333     case SelectName:            return String(select.name());
    01334     case SelectSize:            return Number(select.size());
    01335     case SelectTabIndex:        return Number(select.tabIndex());
    01336     }
    01337   }
    01338   break;
    01339   case ID_OPTGROUP: {
    01340     DOM::HTMLOptGroupElement optgroup = element;
    01341     switch (token) {
    01342     case OptGroupDisabled:        return Boolean(optgroup.disabled());
    01343     case OptGroupLabel:           return String(optgroup.label());
    01344     }
    01345   }
    01346   break;
    01347   case ID_OPTION: {
    01348     DOM::HTMLOptionElement option = element;
    01349     switch (token) {
    01350     case OptionForm:            return getDOMNode(exec,option.form()); // type HTMLFormElement
    01351     case OptionDefaultSelected: return Boolean(option.defaultSelected());
    01352     case OptionText:            return String(option.text());
    01353     case OptionIndex:           return Number(option.index());
    01354     case OptionDisabled:        return Boolean(option.disabled());
    01355     case OptionLabel:           return String(option.label());
    01356     case OptionSelected:        return Boolean(option.selected());
    01357     case OptionValue:           return String(option.value());
    01358     }
    01359   }
    01360   break;
    01361   case ID_INPUT: {
    01362     DOM::HTMLInputElement input = element;
    01363     switch (token) {
    01364     case InputDefaultValue:    return String(input.defaultValue());
    01365     case InputDefaultChecked:  return Boolean(input.defaultChecked());
    01366     case InputForm:            return getDOMNode(exec,input.form()); // type HTMLFormElement
    01367     case InputAccept:          return String(input.accept());
    01368     case InputAccessKey:       return String(input.accessKey());
    01369     case InputAlign:           return String(input.align());
    01370     case InputAlt:             return String(input.alt());
    01371     case InputChecked:         return Boolean(input.checked());
    01372     case InputDisabled:        return Boolean(input.disabled());
    01373     case InputMaxLength:       return Number(input.maxLength());
    01374     case InputName:            return String(input.name()); // NOT getString (IE gives empty string)
    01375     case InputReadOnly:        return Boolean(input.readOnly());
    01376     case InputSize:            return Number(input.getSize());
    01377     case InputSrc:             return String(input.src());
    01378     case InputTabIndex:        return Number(input.tabIndex());
    01379     case InputType:            return String(input.type());
    01380     case InputUseMap:          return String(input.useMap());
    01381     case InputValue:           return String(input.value());
    01382     }
    01383   }
    01384   break;
    01385   case ID_TEXTAREA: {
    01386     DOM::HTMLTextAreaElement textarea = element;
    01387     switch (token) {
    01388     case TextAreaDefaultValue:    return String(textarea.defaultValue());
    01389     case TextAreaForm:            return getDOMNode(exec,textarea.form()); // type HTMLFormElement
    01390     case TextAreaAccessKey:       return String(textarea.accessKey());
    01391     case TextAreaCols:            return Number(textarea.cols());
    01392     case TextAreaDisabled:        return Boolean(textarea.disabled());
    01393     case TextAreaName:            return String(textarea.name());
    01394     case TextAreaReadOnly:        return Boolean(textarea.readOnly());
    01395     case TextAreaRows:            return Number(textarea.rows());
    01396     case TextAreaTabIndex:        return Number(textarea.tabIndex());
    01397     case TextAreaType:            return String(textarea.type());
    01398     case TextAreaValue:           return String(textarea.value());
    01399     }
    01400   }
    01401   break;
    01402   case ID_BUTTON: {
    01403     DOM::HTMLButtonElement button = element;
    01404     switch (token) {
    01405     case ButtonForm:            return getDOMNode(exec,button.form()); // type HTMLFormElement
    01406     case ButtonAccessKey:       return String(button.accessKey());
    01407     case ButtonDisabled:        return Boolean(button.disabled());
    01408     case ButtonName:            return String(button.name());
    01409     case ButtonTabIndex:        return Number(button.tabIndex());
    01410     case ButtonType:            return String(button.type());
    01411     case ButtonValue:           return String(button.value());
    01412     }
    01413   }
    01414   break;
    01415   case ID_LABEL: {
    01416     DOM::HTMLLabelElement label = element;
    01417     switch (token) {
    01418     case LabelForm:            return getDOMNode(exec,label.form()); // type HTMLFormElement
    01419     case LabelAccessKey:       return String(label.accessKey());
    01420     case LabelHtmlFor:         return String(label.htmlFor());
    01421     }
    01422   }
    01423   break;
    01424   case ID_FIELDSET: {
    01425     DOM::HTMLFieldSetElement fieldSet = element;
    01426     switch (token) {
    01427     case FieldSetForm:            return getDOMNode(exec,fieldSet.form()); // type HTMLFormElement
    01428     }
    01429   }
    01430   break;
    01431   case ID_LEGEND: {
    01432     DOM::HTMLLegendElement legend = element;
    01433     switch (token) {
    01434     case LegendForm:            return getDOMNode(exec,legend.form()); // type HTMLFormElement
    01435     case LegendAccessKey:       return String(legend.accessKey());
    01436     case LegendAlign:           return String(legend.align());
    01437     }
    01438   }
    01439   break;
    01440   case ID_UL: {
    01441     DOM::HTMLUListElement uList = element;
    01442     switch (token) {
    01443     case UListCompact:         return Boolean(uList.compact());
    01444     case UListType:            return String(uList.type());
    01445     }
    01446   }
    01447   break;
    01448   case ID_OL: {
    01449     DOM::HTMLOListElement oList = element;
    01450     switch (token) {
    01451     case OListCompact:         return Boolean(oList.compact());
    01452     case OListStart:           return Number(oList.start());
    01453     case OListType:            return String(oList.type());
    01454     }
    01455   }
    01456   break;
    01457   case ID_DL: {
    01458     DOM::HTMLDListElement dList = element;
    01459     switch (token) {
    01460     case DListCompact:         return Boolean(dList.compact());
    01461     }
    01462   }
    01463   break;
    01464   case ID_DIR: {
    01465     DOM::HTMLDirectoryElement directory = element;
    01466     switch (token) {
    01467     case DirectoryCompact:         return Boolean(directory.compact());
    01468     }
    01469   }
    01470   break;
    01471   case ID_MENU: {
    01472     DOM::HTMLMenuElement menu = element;
    01473     switch (token) {
    01474     case MenuCompact:         return Boolean(menu.compact());
    01475     }
    01476   }
    01477   break;
    01478   case ID_LI: {
    01479     DOM::HTMLLIElement li = element;
    01480     switch (token) {
    01481     case LIType:            return String(li.type());
    01482     case LIValue:           return Number(li.value());
    01483     }
    01484   }
    01485   break;
    01486   case ID_DIV: {
    01487     DOM::HTMLDivElement div = element;
    01488     switch (token) {
    01489     case DivAlign:           return String(div.align());
    01490     }
    01491   }
    01492   break;
    01493   case ID_P: {
    01494     DOM::HTMLParagraphElement paragraph = element;
    01495     switch (token) {
    01496     case ParagraphAlign:           return String(paragraph.align());
    01497     }
    01498   }
    01499   break;
    01500   case ID_H1:
    01501   case ID_H2:
    01502   case ID_H3:
    01503   case ID_H4:
    01504   case ID_H5:
    01505   case ID_H6: {
    01506     DOM::HTMLHeadingElement heading = element;
    01507     switch (token) {
    01508     case HeadingAlign:           return String(heading.align());
    01509     }
    01510   }
    01511   break;
    01512   case ID_BLOCKQUOTE: {
    01513     DOM::HTMLBlockquoteElement blockquote = element;
    01514     switch (token) {
    01515     case BlockQuoteCite:            return String(blockquote.cite());
    01516     }
    01517   }
    01518   case ID_Q: {
    01519     DOM::HTMLQuoteElement quote = element;
    01520     switch (token) {
    01521     case QuoteCite:            return String(quote.cite());
    01522     }
    01523   }
    01524   case ID_PRE: {
    01525     DOM::HTMLPreElement pre = element;
    01526     switch (token) {
    01527     case PreWidth:           return Number(pre.width());
    01528     }
    01529   }
    01530   break;
    01531   case ID_BR: {
    01532     DOM::HTMLBRElement br = element;
    01533     switch (token) {
    01534     case BRClear:           return String(br.clear());
    01535     }
    01536   }
    01537   break;
    01538   case ID_BASEFONT: {
    01539     DOM::HTMLBaseFontElement baseFont = element;
    01540     switch (token) {
    01541     case BaseFontColor:           return String(baseFont.color());
    01542     case BaseFontFace:            return String(baseFont.face());
    01543     case BaseFontSize:            return Number(baseFont.getSize());
    01544     }
    01545   }
    01546   break;
    01547   case ID_FONT: {
    01548     DOM::HTMLFontElement font = element;
    01549     switch (token) {
    01550     case FontColor:           return String(font.color());
    01551     case FontFace:            return String(font.face());
    01552     case FontSize:            return String(font.size());
    01553     }
    01554   }
    01555   break;
    01556   case ID_HR: {
    01557     DOM::HTMLHRElement hr = element;
    01558     switch (token) {
    01559     case HRAlign:           return String(hr.align());
    01560     case HRNoShade:         return Boolean(hr.noShade());
    01561     case HRSize:            return String(hr.size());
    01562     case HRWidth:           return String(hr.width());
    01563     }
    01564   }
    01565   break;
    01566   case ID_INS:
    01567   case ID_DEL: {
    01568     DOM::HTMLModElement mod = element;
    01569     switch (token) {
    01570     case ModCite:            return String(mod.cite());
    01571     case ModDateTime:        return String(mod.dateTime());
    01572     }
    01573   }
    01574   break;
    01575   case ID_A: {
    01576     DOM::HTMLAnchorElement anchor = element;
    01577     switch (token) {
    01578     case AnchorAccessKey:       return String(anchor.accessKey());
    01579     case AnchorCharset:         return String(anchor.charset());
    01580     case AnchorCoords:          return String(anchor.coords());
    01581     case AnchorHref:            return String(anchor.href());
    01582     case AnchorHrefLang:        return String(anchor.hreflang());
    01583     case AnchorHash:            return String('#'+KURL(anchor.href().string()).ref());
    01584     case AnchorHost:            return String(KURL(anchor.href().string()).host());
    01585     case AnchorHostname: {
    01586       KURL url(anchor.href().string());
    01587       kdDebug(6070) << "anchor::hostname uses:" <<url.url()<<endl;
    01588       if (url.port()==0)
    01589         return String(url.host());
    01590       else
    01591         return String(url.host() + ":" + QString::number(url.port()));
    01592     }
    01593     case AnchorPathName:        return String(KURL(anchor.href().string()).path());
    01594     case AnchorPort:            return String(QString::number(KURL(anchor.href().string()).port()));
    01595     case AnchorProtocol:        return String(KURL(anchor.href().string()).protocol()+":");
    01596     case AnchorSearch:          return String(KURL(anchor.href().string()).query());
    01597     case AnchorName:            return String(anchor.name());
    01598     case AnchorRel:             return String(anchor.rel());
    01599     case AnchorRev:             return String(anchor.rev());
    01600     case AnchorShape:           return String(anchor.shape());
    01601     case AnchorTabIndex:        return Number(anchor.tabIndex());
    01602     case AnchorTarget:          return String(anchor.target());
    01603     // Not specified in http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/a.asp
    01604     // Mozilla returns the inner text.
    01605     case AnchorText:            return String(anchor.innerText());
    01606     case AnchorType:            return String(anchor.type());
    01607     }
    01608   }
    01609   break;
    01610   case ID_IMG: {
    01611     DOM::HTMLImageElement image = element;
    01612     switch (token) {
    01613     case ImageName:            return String(image.name()); // NOT getString (IE gives empty string)
    01614     case ImageAlign:           return String(image.align());
    01615     case ImageAlt:             return String(image.alt());
    01616     case ImageBorder:          return String(image.getBorder());
    01617     case ImageComplete:        return Boolean(static_cast<DOM::HTMLImageElementImpl*>( image.handle() )->complete());
    01618     case ImageHeight:          return Number(image.height());
    01619     case ImageHspace:          return Number(image.hspace());
    01620     case ImageIsMap:           return Boolean(image.isMap());
    01621     case ImageLongDesc:        return String(image.longDesc());
    01622     case ImageSrc:             return String(image.src());
    01623     case ImageUseMap:          return String(image.useMap());
    01624     case ImageVspace:          return Number(image.vspace());
    01625     case ImageWidth:           return Number(image.width());
    01626     case ImageX:               return Number(image.x());
    01627     case ImageY:               return Number(image.y());
    01628     }
    01629   }
    01630   break;
    01631   case ID_OBJECT: {
    01632     DOM::HTMLObjectElement object = element;
    01633     switch (token) {
    01634     case ObjectForm:            return getDOMNode(exec,object.form()); // type HTMLFormElement
    01635     case ObjectCode:            return String(object.code());
    01636     case ObjectAlign:           return String(object.align());
    01637     case ObjectArchive:         return String(object.archive());
    01638     case ObjectBorder:          return String(object.border());
    01639     case ObjectCodeBase:        return String(object.codeBase());
    01640     case ObjectCodeType:        return String(object.codeType());
    01641     case ObjectContentDocument: return checkNodeSecurity(exec,object.contentDocument()) ?
    01642                        getDOMNode(exec, object.contentDocument()) : Undefined();
    01643     case ObjectData:            return String(object.data());
    01644     case ObjectDeclare:         return Boolean(object.declare());
    01645     case ObjectHeight:          return String(object.height());
    01646     case ObjectHspace:          return Number(object.getHspace());
    01647     case ObjectName:            return String(object.name());
    01648     case ObjectStandby:         return String(object.standby());
    01649     case ObjectTabIndex:        return Number(object.tabIndex());
    01650     case ObjectType:            return String(object.type());
    01651     case ObjectUseMap:          return String(object.useMap());
    01652     case ObjectVspace:          return Number(object.getVspace());
    01653     case ObjectWidth:           return String(object.width());
    01654     }
    01655   }
    01656   break;
    01657   case ID_PARAM: {
    01658     DOM::HTMLParamElement param = element;
    01659     switch (token) {
    01660     case ParamName:            return String(param.name());
    01661     case ParamType:            return String(param.type());
    01662     case ParamValue:           return String(param.value());
    01663     case ParamValueType:       return String(param.valueType());
    01664     }
    01665   }
    01666   break;
    01667   case ID_APPLET: {
    01668     DOM::HTMLAppletElement applet = element;
    01669     switch (token) {
    01670     case AppletAlign:           return String(applet.align());
    01671     case AppletAlt:             return String(applet.alt());
    01672     case AppletArchive:         return String(applet.archive());
    01673     case AppletCode:            return String(applet.code());
    01674     case AppletCodeBase:        return String(applet.codeBase());
    01675     case AppletHeight:          return String(applet.height());
    01676     case AppletHspace:          return Number(applet.getHspace());
    01677     case AppletName:            return String(applet.name());
    01678     case AppletObject:          return String(applet.object());
    01679     case AppletVspace:          return Number(applet.getVspace());
    01680     case AppletWidth:           return String(applet.width());
    01681     }
    01682   }
    01683   break;
    01684   case ID_MAP: {
    01685     DOM::HTMLMapElement map = element;
    01686     switch (token) {
    01687     case MapAreas:           return getHTMLCollection(exec, map.areas()); // type HTMLCollection
    01688     case MapName:            return String(map.name());
    01689     }
    01690   }
    01691   break;
    01692   case ID_AREA: {
    01693     DOM::HTMLAreaElement area = element;
    01694     switch (token) {
    01695     case AreaAccessKey:       return String(area.accessKey());
    01696     case AreaAlt:             return String(area.alt());
    01697     case AreaCoords:          return String(area.coords());
    01698     // Group everything that needs href
    01699     case AreaHref:
    01700     case AreaHash:
    01701     case AreaHost:
    01702     case AreaHostName:
    01703     case AreaPathName:
    01704     case AreaPort:
    01705     case AreaProtocol:
    01706     case AreaSearch:
    01707     {
    01708       DOM::Document doc = area.ownerDocument();
    01709       DOM::DOMString href = area.href();
    01710       KURL url;
    01711       if ( !href.isNull() ) {
    01712         url = doc.completeURL( href ).string();
    01713         if ( href.isEmpty() )
    01714           url.setFileName( QString::null ); // href="" clears the filename (in IE)
    01715       }
    01716       switch(token) {
    01717       case AreaHref:
    01718         return String(url.url());
    01719       case AreaHash:            return String(url.isEmpty() ? "" : '#'+url.ref());
    01720       case AreaHost:            return String(url.host());
    01721       case AreaHostName: {
    01722         if (url.port()==0)
    01723           return String(url.host());
    01724         else
    01725           return String(url.host() + ":" + QString::number(url.port()));
    01726       }
    01727       case AreaPathName:        {
    01728         return String(url.path());
    01729       }
    01730       case AreaPort:            return String(QString::number(url.port()));
    01731       case AreaProtocol:        return String(url.isEmpty() ? "" : url.protocol()+":");
    01732       case AreaSearch:          return String(url.query());
    01733       }
    01734     }
    01735     case AreaNoHref:          return Boolean(area.noHref());
    01736     case AreaShape:           return String(area.shape());
    01737     case AreaTabIndex:        return Number(area.tabIndex());
    01738     case AreaTarget:          return String(area.target());
    01739     }
    01740   }
    01741   break;
    01742   case ID_SCRIPT: {
    01743     DOM::HTMLScriptElement script = element;
    01744     switch (token) {
    01745     case ScriptText:            return String(script.text());
    01746     case ScriptHtmlFor:         return String(script.htmlFor());
    01747     case ScriptEvent:           return String(script.event());
    01748     case ScriptCharset:         return String(script.charset());
    01749     case ScriptDefer:           return Boolean(script.defer());
    01750     case ScriptSrc:             return String(script.src());
    01751     case ScriptType:            return String(script.type());
    01752     }
    01753   }
    01754   break;
    01755   case ID_TABLE: {
    01756     DOM::HTMLTableElement table = element;
    01757     switch (token) {
    01758     case TableCaption:         return getDOMNode(exec,table.caption()); // type HTMLTableCaptionElement
    01759     case TableTHead:           return getDOMNode(exec,table.tHead()); // type HTMLTableSectionElement
    01760     case TableTFoot:           return getDOMNode(exec,table.tFoot()); // type HTMLTableSectionElement
    01761     case TableRows:            return getHTMLCollection(exec,table.rows()); // type HTMLCollection
    01762     case TableTBodies:         return getHTMLCollection(exec,table.tBodies()); // type HTMLCollection
    01763     case TableAlign:           return String(table.align());
    01764     case TableBgColor:         return String(table.bgColor());
    01765     case TableBorder:          return String(table.border());
    01766     case TableCellPadding:     return String(table.cellPadding());
    01767     case TableCellSpacing:     return String(table.cellSpacing());
    01768     case TableFrame:           return String(table.frame());
    01769     case TableRules:           return String(table.rules());
    01770     case TableSummary:         return String(table.summary());
    01771     case TableWidth:           return String(table.width());
    01772     }
    01773   }
    01774   break;
    01775   case ID_CAPTION: {
    01776     DOM::HTMLTableCaptionElement tableCaption = element;
    01777     switch (token) {
    01778     case TableCaptionAlign:       return String(tableCaption.align());
    01779     }
    01780   }
    01781   break;
    01782   case ID_COL:
    01783   case ID_COLGROUP: {
    01784     DOM::HTMLTableColElement tableCol = element;
    01785     switch (token) {
    01786     case TableColAlign:           return String(tableCol.align());
    01787     case TableColCh:              return String(tableCol.ch());
    01788     case TableColChOff:           return String(tableCol.chOff());
    01789     case TableColSpan:            return Number(tableCol.span());
    01790     case TableColVAlign:          return String(tableCol.vAlign());
    01791     case TableColWidth:           return String(tableCol.width());
    01792     }
    01793   }
    01794   break;
    01795   case ID_THEAD:
    01796   case ID_TBODY:
    01797   case ID_TFOOT: {
    01798     DOM::HTMLTableSectionElement tableSection = element;
    01799     switch (token) {
    01800     case TableSectionAlign:           return String(tableSection.align());
    01801     case TableSectionCh:              return String(tableSection.ch());
    01802     case TableSectionChOff:           return String(tableSection.chOff());
    01803     case TableSectionVAlign:          return String(tableSection.vAlign());
    01804     case TableSectionRows:            return getHTMLCollection(exec,tableSection.rows()); // type HTMLCollection
    01805     }
    01806   }
    01807   break;
    01808   case ID_TR: {
    01809    DOM::HTMLTableRowElement tableRow = element;
    01810    switch (token) {
    01811    case TableRowRowIndex:        return Number(tableRow.rowIndex());
    01812    case TableRowSectionRowIndex: return Number(tableRow.sectionRowIndex());
    01813    case TableRowCells:           return getHTMLCollection(exec,tableRow.cells()); // type HTMLCollection
    01814    case TableRowAlign:           return String(tableRow.align());
    01815    case TableRowBgColor:         return String(tableRow.bgColor());
    01816    case TableRowCh:              return String(tableRow.ch());
    01817    case TableRowChOff:           return String(tableRow.chOff());
    01818    case TableRowVAlign:          return String(tableRow.vAlign());
    01819    }
    01820   }
    01821   break;
    01822   case ID_TH:
    01823   case ID_TD: {
    01824     DOM::HTMLTableCellElement tableCell = element;
    01825     switch (token) {
    01826     case TableCellCellIndex:       return Number(tableCell.cellIndex());
    01827     case TableCellAbbr:            return String(tableCell.abbr());
    01828     case TableCellAlign:           return String(tableCell.align());
    01829     case TableCellAxis:            return String(tableCell.axis());
    01830     case TableCellBgColor:         return String(tableCell.bgColor());
    01831     case TableCellCh:              return String(tableCell.ch());
    01832     case TableCellChOff:           return String(tableCell.chOff());
    01833     case TableCellColSpan:         return Number(tableCell.colSpan());
    01834     case TableCellHeaders:         return String(tableCell.headers());
    01835     case TableCellHeight:          return String(tableCell.height());
    01836     case TableCellNoWrap:          return Boolean(tableCell.noWrap());
    01837     case TableCellRowSpan:         return Number(tableCell.rowSpan());
    01838     case TableCellScope:           return String(tableCell.scope());
    01839     case TableCellVAlign:          return String(tableCell.vAlign());
    01840     case TableCellWidth:           return String(tableCell.width());
    01841     }
    01842   }
    01843   break;
    01844   case ID_FRAMESET: {
    01845     DOM::HTMLFrameSetElement frameSet = element;
    01846     switch (token) {
    01847     case FrameSetCols:            return String(frameSet.cols());
    01848     case FrameSetRows:            return String(frameSet.rows());
    01849     }
    01850   }
    01851   break;
    01852   case ID_LAYER: {
    01853     DOM::HTMLLayerElement layerElement = element;
    01854     switch (token) {
    01855     case LayerTop:            return Number(layerElement.top());
    01856     case LayerLeft:           return Number(layerElement.left());
    01857     case LayerVisibility:     return getString(layerElement.visibility());
    01858     case LayerBgColor:        return getString(layerElement.bgColor());
    01859     /*case LayerClip:           return getLayerClip(exec, layerElement); */
    01860     case LayerDocument:       return Undefined();
    01861     case LayerLayers:         return getHTMLCollection(exec,layerElement.layers());
    01862     }
    01863   }
    01864   break;
    01865   case ID_FRAME: {
    01866     DOM::HTMLFrameElement frameElement = element;
    01867     switch (token) {
    01868     case FrameContentDocument: return checkNodeSecurity(exec,frameElement.contentDocument()) ?
    01869                       getDOMNode(exec, frameElement.contentDocument()) : Undefined();
    01870     case FrameFrameBorder:     return String(frameElement.frameBorder());
    01871     case FrameLongDesc:        return String(frameElement.longDesc());
    01872     case FrameMarginHeight:    return String(frameElement.marginHeight());
    01873     case FrameMarginWidth:     return String(frameElement.marginWidth());
    01874     case FrameName:            return String(frameElement.name());
    01875     case FrameNoResize:        return Boolean(frameElement.noResize());
    01876     case FrameScrolling:       return String(frameElement.scrolling());
    01877     case FrameSrc:
    01878     case FrameLocation:        return String(frameElement.src());
    01879     }
    01880   }
    01881   break;
    01882   case ID_IFRAME: {
    01883     DOM::HTMLIFrameElement iFrame = element;
    01884     switch (token) {
    01885     case IFrameAlign:           return String(iFrame.align());
    01886     case IFrameContentDocument: return checkNodeSecurity(exec,iFrame.contentDocument()) ?
    01887                        getDOMNode(exec, iFrame.contentDocument()) : Undefined();
    01888     case IFrameFrameBorder:     return String(iFrame.frameBorder());
    01889     case IFrameHeight:          return String(iFrame.height());
    01890     case IFrameLongDesc:        return String(iFrame.longDesc());
    01891     case IFrameMarginHeight:    return String(iFrame.marginHeight());
    01892     case IFrameMarginWidth:     return String(iFrame.marginWidth());
    01893     case IFrameName:            return String(iFrame.name());
    01894     case IFrameScrolling:       return String(iFrame.scrolling());
    01895     case IFrameSrc:             return String(iFrame.src());
    01896     case IFrameWidth:           return String(iFrame.width());
    01897     }
    01898     break;
    01899   }
    01900   } // xemacs (or arnt) could be a bit smarter when it comes to indenting switch()es ;)
    01901   // its not arnt to blame - its the original Stroustrup style we like :) (Dirk)
    01902
    01903   // generic properties
    01904   switch (token) {
    01905   case ElementId:
    01906     return String(element.id()); // String is wrong here. Other browsers return empty string if no id specified.
    01907   case ElementTitle:
    01908     return String(element.title());
    01909   case ElementLang:
    01910     return String(element.lang());
    01911   case ElementDir:
    01912     return String(element.dir());
    01913   case ElementClassName:
    01914     return String(element.className());
    01915   case ElementInnerHTML:
    01916     return String(element.innerHTML());
    01917   case ElementInnerText:
    01918     return String(element.innerText());
    01919   case ElementDocument:
    01920     return getDOMNode(exec,element.ownerDocument());
    01921   case ElementChildren:
    01922     return getHTMLCollection(exec,element.children());
    01923   case ElementAll:
    01924     // Disable element.all when we try to be Netscape-compatible
    01925     if ( exec->interpreter()->compatMode() == Interpreter::NetscapeCompat )
    01926       return Undefined();
    01927     else
    01928     if ( exec->interpreter()->compatMode() == Interpreter::IECompat )
    01929       return getHTMLCollection(exec,element.all());
    01930     else // Enabled but hidden by default
    01931       return getHTMLCollection(exec,element.all(), true);
    01932   // ### what about style? or is this used instead for DOM2 stylesheets?
    01933   }
    01934   kdError() << "HTMLElement::getValueProperty unhandled token " << token << endl;
    01935   return Undefined();
    01936 }
    01937
    01938 bool KJS::HTMLElement::hasProperty(ExecState *exec, const Identifier &propertyName) const
    01939 {
    01940 #ifdef KJS_VERBOSE
    01941   //kdDebug(6070) << "HTMLElement::hasProperty " << propertyName.qstring() << endl;
    01942 #endif
    01943   DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);
    01944   // First look at dynamic properties - keep this in sync with tryGet
    01945   switch (element.elementId()) {
    01946     case ID_FORM: {
    01947       DOM::HTMLFormElement form = element;
    01948       // Check if we're retrieving an element (by index or by name)
    01949       bool ok;
    01950       uint u = propertyName.toULong(&ok);
    01951       if (ok && !(form.elements().item(u).isNull()))
    01952         return true;
    01953       DOM::Node testnode = form.elements().namedItem(propertyName.string());
    01954       if (!testnode.isNull())
    01955         return true;
    01956     }
    01957     case ID_SELECT: {
    01958       DOM::HTMLSelectElement select = element;
    01959       bool ok;
    01960       uint u = propertyName.toULong(&ok);
    01961       if (ok && !(select.options().item(u).isNull()))
    01962         return true;
    01963     }
    01964     default:
    01965       break;
    01966   }
    01967
    01968   return DOMElement::hasProperty(exec, propertyName);
    01969 }
    01970
    01971 UString KJS::HTMLElement::toString(ExecState *exec) const
    01972 {
    01973   if (node.elementId() == ID_A)
    01974     return UString(static_cast<const DOM::HTMLAnchorElement&>(node).href());
    01975   else if (node.elementId() == ID_APPLET) {
    01976     KParts::LiveConnectExtension *lc = getLiveConnectExtension(node);
    01977     QStringList qargs;
    01978     QString retvalue;
    01979     KParts::LiveConnectExtension::Type rettype;
    01980     unsigned long retobjid;
    01981     if (lc && lc->call(0, "hashCode", qargs, rettype, retobjid, retvalue)) {
    01982       QString str("[object APPLET ref=");
    01983       return UString(str + retvalue + QString("]"));
    01984     }
    01985   } else if (node.elementId() == ID_IMG) {
    01986     DOM::HTMLImageElement image(node);
    01987     if (!image.alt().isEmpty())
    01988       return UString(image.alt()) + " " + DOMElement::toString(exec);
    01989   }
    01990   return DOMElement::toString(exec);
    01991 }
    01992
    01993 static void getForm(DOM::HTMLFormElement* form, const DOM::HTMLElement& element)
    01994 {
    01995     switch (element.elementId()) {
    01996         case ID_ISINDEX: {
    01997             DOM::HTMLIsIndexElement isindex = element;
    01998             *form = isindex.form();
    01999             break;
    02000         }
    02001         case ID_SELECT: {
    02002             DOM::HTMLSelectElement select = element;
    02003             *form = select.form();
    02004             break;
    02005         }
    02006         case ID_OPTION: {
    02007             DOM::HTMLOptionElement option = element;
    02008             *form = option.form();
    02009             break;
    02010         }
    02011         case ID_INPUT: {
    02012             DOM::HTMLInputElement input = element;
    02013             *form = input.form();
    02014             break;
    02015         }
    02016         case ID_TEXTAREA: {
    02017             DOM::HTMLTextAreaElement textarea = element;
    02018             *form = textarea.form();
    02019             break;
    02020         }
    02021         case ID_LABEL: {
    02022             DOM::HTMLLabelElement label = element;
    02023             *form = label.form();
    02024             break;
    02025         }
    02026         case ID_FIELDSET: {
    02027             DOM::HTMLFieldSetElement fieldset = element;
    02028             *form = fieldset.form();
    02029             break;
    02030         }
    02031         case ID_LEGEND: {
    02032             DOM::HTMLLegendElement legend = element;
    02033             *form = legend.form();
    02034             break;
    02035         }
    02036         case ID_OBJECT: {
    02037             DOM::HTMLObjectElement object = element;
    02038             *form = object.form();
    02039             break;
    02040         }
    02041         default:
    02042             break;
    02043     }
    02044 }
    02045
    02046 void KJS::HTMLElement::pushEventHandlerScope(ExecState *exec, ScopeChain &scope) const
    02047 {
    02048   DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);
    02049
    02050   // The document is put on first, fall back to searching it only after the element and form.
    02051   scope.push(static_cast<ObjectImp *>(getDOMNode(exec, element.ownerDocument()).imp()));
    02052
    02053   // The form is next, searched before the document, but after the element itself.
    02054   DOM::HTMLFormElement formElt;
    02055
    02056   // First try to obtain the form from the element itself.  We do this to deal with
    02057   // the malformed case where <form>s aren't in our parent chain (e.g., when they were inside
    02058   // <table> or <tbody>.
    02059   getForm(&formElt, element);
    02060   if (!formElt.isNull())
    02061     scope.push(static_cast<ObjectImp *>(getDOMNode(exec, formElt).imp()));
    02062   else {
    02063     DOM::Node form = element.parentNode();
    02064     while (!form.isNull() && form.elementId() != ID_FORM)
    02065         form = form.parentNode();
    02066
    02067     if (!form.isNull())
    02068         scope.push(static_cast<ObjectImp *>(getDOMNode(exec, form).imp()));
    02069   }
    02070
    02071   // The element is on top, searched first.
    02072   scope.push(static_cast<ObjectImp *>(getDOMNode(exec, element).imp()));
    02073 }
    02074
    02075 HTMLElementFunction::HTMLElementFunction(ExecState *exec, int i, int len)
    02076   : DOMFunction(exec), id(i)
    02077 {
    02078   Value protect(this);
    02079   put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
    02080 }
    02081
    02082 Value KJS::HTMLElementFunction::tryCall(ExecState *exec, Object &thisObj, const List &args)
    02083 {
    02084   KJS_CHECK_THIS( HTMLElement, thisObj );
    02085
    02086 #ifdef KJS_VERBOSE
    02087   kdDebug(6070) << "KJS::HTMLElementFunction::tryCall " << endl;
    02088 #endif
    02089   DOM::HTMLElement element = static_cast<KJS::HTMLElement *>(thisObj.imp())->toElement();
    02090
    02091   switch (element.elementId()) {
    02092     case ID_FORM: {
    02093       DOM::HTMLFormElement form = element;
    02094       if (id == KJS::HTMLElement::FormSubmit) {
    02095
    02096
    02097         DOM::HTMLDocument doc = element.ownerDocument();
    02098         KHTMLView *view = static_cast<DOM::DocumentImpl*>(doc.handle())->view();
    02099         KHTMLSettings::KJSWindowOpenPolicy policy = KHTMLSettings::KJSWindowOpenAllow;
    02100     if (view)
    02101         policy = view->part()->settings()->windowOpenPolicy(view->part()->url().host());
    02102
    02103         bool block = false;
    02104
    02105         if ( policy != KHTMLSettings::KJSWindowOpenAllow ) {
    02106           block = true;
    02107
    02108          // if this is a form without a target, or a special target, don't block
    02109           QString trg = form.target().lower().string();
    02110           if( trg.isEmpty() || trg == "_top" || trg == "_self" ||
    02111               trg == "_parent")
    02112             block = false;
    02113
    02114           QString caption;
    02115
    02116           // if there is a frame with the target name, don't block
    02117           if ( view && view->part() )  {
    02118             if (!view->part()->url().host().isEmpty())
    02119               caption = view->part()->url().host() + " - ";
    02120             // search all (possibly nested) framesets
    02121             KHTMLPart *currentPart = view->part()->parentPart();
    02122             while( currentPart != 0L ) {
    02123               if( currentPart->frameExists( form.target().string() ) )
    02124                 block = false;
    02125               currentPart = currentPart->parentPart();
    02126             }
    02127           }
    02128
    02129           if ( block && policy == KHTMLSettings::KJSWindowOpenAsk && view ) {
    02130             if (view && view->part())
    02131             emit view->part()->browserExtension()->requestFocus(view->part());
    02132             caption += i18n( "Confirmation: JavaScript Popup" );
    02133             if ( KMessageBox::questionYesNo(view, form.action().isEmpty() ?
    02134                    i18n( "This site is submitting a form which will open up a new browser "
    02135                          "window via JavaScript.\n"
    02136                          "Do you want to allow the form to be submitted?" ) :
    02137                    i18n( "<qt>This site is submitting a form which will open <p>%1</p> in a new browser window via JavaScript.<br />"
    02138                          "Do you want to allow the form to be submitted?</qt>").arg(KStringHandler::csqueeze(form.action().string(),  100)),
    02139                    caption ) == KMessageBox::Yes )
    02140               block = false;
    02141
    02142           } else if ( block && policy == KHTMLSettings::KJSWindowOpenSmart ) {
    02143             if( static_cast<KJS::ScriptInterpreter *>(exec->interpreter())->isWindowOpenAllowed() ) {
    02144               // This submission has been triggered by the user
    02145               block = false;
    02146             }
    02147           }
    02148         }
    02149
    02150         if( !block )
    02151           form.submit();
    02152
    02153         return Undefined();
    02154       }
    02155       else if (id == KJS::HTMLElement::FormReset) {
    02156         form.reset();
    02157         return Undefined();
    02158       }
    02159     }
    02160     break;
    02161     case ID_SELECT: {
    02162       DOM::HTMLSelectElement select = element;
    02163       if (id == KJS::HTMLElement::SelectAdd) {
    02164         select.add(KJS::toNode(args[0]),KJS::toNode(args[1]));
    02165         return Undefined();
    02166       }
    02167       else if (id == KJS::HTMLElement::SelectRemove) {
    02168         select.remove(int(args[0].toNumber(exec)));
    02169         return Undefined();
    02170       }
    02171       else if (id == KJS::HTMLElement::SelectBlur) {
    02172         select.blur();
    02173         return Undefined();
    02174       }
    02175       else if (id == KJS::HTMLElement::SelectFocus) {
    02176         select.focus();
    02177         return Undefined();
    02178       }
    02179     }
    02180     break;
    02181     case ID_INPUT: {
    02182       DOM::HTMLInputElement input = element;
    02183       if (id == KJS::HTMLElement::InputBlur) {
    02184         input.blur();
    02185         return Undefined();
    02186       }
    02187       else if (id == KJS::HTMLElement::InputFocus) {
    02188         input.focus();
    02189         return Undefined();
    02190       }
    02191       else if (id == KJS::HTMLElement::InputSelect) {
    02192         input.select();
    02193         return Undefined();
    02194       }
    02195       else if (id == KJS::HTMLElement::InputClick) {
    02196         input.click();
    02197         return Undefined();
    02198       }
    02199     }
    02200     break;
    02201     case ID_TEXTAREA: {
    02202       DOM::HTMLTextAreaElement textarea = element;
    02203       if (id == KJS::HTMLElement::TextAreaBlur) {
    02204         textarea.blur();
    02205         return Undefined();
    02206       }
    02207       else if (id == KJS::HTMLElement::TextAreaFocus) {
    02208         textarea.focus();
    02209         return Undefined();
    02210       }
    02211       else if (id == KJS::HTMLElement::TextAreaSelect) {
    02212         textarea.select();
    02213         return Undefined();
    02214       }
    02215     }
    02216     break;
    02217     case ID_A: {
    02218       DOM::HTMLAnchorElement anchor = element;
    02219       if (id == KJS::HTMLElement::AnchorBlur) {
    02220         anchor.blur();
    02221         return Undefined();
    02222       }
    02223       else if (id == KJS::HTMLElement::AnchorFocus) {
    02224         anchor.focus();
    02225         return Undefined();
    02226       }
    02227     }
    02228     break;
    02229     case ID_TABLE: {
    02230       DOM::HTMLTableElement table = element;
    02231       if (id == KJS::HTMLElement::TableCreateTHead)
    02232         return getDOMNode(exec,table.createTHead());
    02233       else if (id == KJS::HTMLElement::TableDeleteTHead) {
    02234         table.deleteTHead();
    02235         return Undefined();
    02236       }
    02237       else if (id == KJS::HTMLElement::TableCreateTFoot)
    02238         return getDOMNode(exec,table.createTFoot());
    02239       else if (id == KJS::HTMLElement::TableDeleteTFoot) {
    02240         table.deleteTFoot();
    02241         return Undefined();
    02242       }
    02243       else if (id == KJS::HTMLElement::TableCreateCaption)
    02244         return getDOMNode(exec,table.createCaption());
    02245       else if (id == KJS::HTMLElement::TableDeleteCaption) {
    02246         table.deleteCaption();
    02247         return Undefined();
    02248       }
    02249       else if (id == KJS::HTMLElement::TableInsertRow)
    02250         return getDOMNode(exec,table.insertRow(args[0].toInteger(exec)));
    02251       else if (id == KJS::HTMLElement::TableDeleteRow) {
    02252         table.deleteRow(args[0].toInteger(exec));
    02253         return Undefined();
    02254       }
    02255     }
    02256     break;
    02257     case ID_THEAD:
    02258     case ID_TBODY:
    02259     case ID_TFOOT: {
    02260       DOM::HTMLTableSectionElement tableSection = element;
    02261       if (id == KJS::HTMLElement::TableSectionInsertRow)
    02262         return getDOMNode(exec,tableSection.insertRow(args[0].toInteger(exec)));
    02263       else if (id == KJS::HTMLElement::TableSectionDeleteRow) {
    02264         tableSection.deleteRow(args[0].toInteger(exec));
    02265         return Undefined();
    02266       }
    02267     }
    02268     break;
    02269     case ID_TR: {
    02270       DOM::HTMLTableRowElement tableRow = element;
    02271       if (id == KJS::HTMLElement::TableRowInsertCell)
    02272         return getDOMNode(exec,tableRow.insertCell(args[0].toInteger(exec)));
    02273       else if (id == KJS::HTMLElement::TableRowDeleteCell) {
    02274         tableRow.deleteCell(args[0].toInteger(exec));
    02275         return Undefined();
    02276       }
    02277       break;
    02278     }
    02279     case ID_MARQUEE: {
    02280       if (id == KJS::HTMLElement::MarqueeStart && element.handle()->renderer() &&
    02281         element.handle()->renderer()->layer() &&
    02282         element.handle()->renderer()->layer()->marquee()) {
    02283         element.handle()->renderer()->layer()->marquee()->start();
    02284         return Undefined();
    02285       }
    02286       else if (id == KJS::HTMLElement::MarqueeStop && element.handle()->renderer() &&
    02287               element.handle()->renderer()->layer() &&
    02288               element.handle()->renderer()->layer()->marquee()) {
    02289         element.handle()->renderer()->layer()->marquee()->stop();
    02290         return Undefined();
    02291       }
    02292       break;
    02293     }
    02294   }
    02295
    02296   return Undefined();
    02297 }
    02298
    02299 void KJS::HTMLElement::tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
    02300 {
    02301 #ifdef KJS_VERBOSE
    02302   DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
    02303 #endif
    02304   DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);
    02305 #ifdef KJS_VERBOSE
    02306   kdDebug(6070) << "KJS::HTMLElement::tryPut " << propertyName.qstring()
    02307                 << " thisTag=" << element.tagName().string()
    02308                 << " str=" << str.string() << endl;
    02309 #endif
    02310   // First look at dynamic properties
    02311   switch (element.elementId()) {
    02312     case ID_SELECT: {
    02313       DOM::HTMLSelectElement select = element;
    02314       bool ok;
    02315       /*uint u =*/ propertyName.toULong(&ok);
    02316       if (ok) {
    02317         Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.options(), select) );
    02318         if ( !coll.isNull() )
    02319           coll.put(exec,propertyName,value);
    02320         return;
    02321       }
    02322       break;
    02323     }
    02324     case ID_APPLET:
    02325     case ID_OBJECT:
    02326     case ID_EMBED: {
    02327       KParts::LiveConnectExtension *lc = getLiveConnectExtension(element);
    02328       if (lc && lc->put(0, propertyName.qstring(), value.toString(exec).qstring()))
    02329         return;
    02330       break;
    02331     }
    02332     default:
    02333       break;
    02334   }
    02335
    02336   const HashTable* table = classInfo()->propHashTable; // get the right hashtable
    02337   const HashEntry* entry = Lookup::findEntry(table, propertyName);
    02338   if (entry) {
    02339     if (entry->attr & Function) // function: put as override property
    02340     {
    02341       ObjectImp::put(exec, propertyName, value, attr);
    02342       return;
    02343     }
    02344     else if ((entry->attr & ReadOnly) == 0) // let DOMObjectLookupPut print the warning if not
    02345     {
    02346       putValueProperty(exec, entry->value, value, attr);
    02347       return;
    02348     }
    02349   }
    02350   DOMObjectLookupPut<KJS::HTMLElement, DOMElement>(exec, propertyName, value, attr, &KJS::HTMLElementTable, this);
    02351 }
    02352
    02353 void KJS::HTMLElement::putValueProperty(ExecState *exec, int token, const Value& value, int)
    02354 {
    02355   DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
    02356   DOMNode *kjsNode = new DOMNode(exec, KJS::toNode(value));
    02357   // Need to create a Value wrapper to avoid leaking the KJS::DOMNode
    02358   Value nodeValue(kjsNode);
    02359   DOM::Node n = kjsNode->toNode();
    02360   DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);
    02361 #ifdef KJS_VERBOSE
    02362   kdDebug(6070) << "KJS::HTMLElement::putValueProperty "
    02363                 << " thisTag=" << element.tagName().string()
    02364                 << " token=" << token << endl;
    02365 #endif
    02366
    02367   switch (element.elementId()) {
    02368   case ID_HTML: {
    02369       DOM::HTMLHtmlElement html = element;
    02370       switch (token) {
    02371       case HtmlVersion:         { html.setVersion(str); return; }
    02372       }
    02373   }
    02374   break;
    02375   case ID_HEAD: {
    02376     DOM::HTMLHeadElement head = element;
    02377     switch (token) {
    02378     case HeadProfile:         { head.setProfile(str); return; }
    02379     }
    02380   }
    02381   break;
    02382   case ID_LINK: {
    02383     DOM::HTMLLinkElement link = element;
    02384     switch (token) {
    02385       case LinkDisabled:        { link.setDisabled(value.toBoolean(exec)); return; }
    02386       case LinkCharset:         { link.setCharset(str); return; }
    02387       case LinkHref:            { link.setHref(str); return; }
    02388       case LinkHrefLang:        { link.setHreflang(str); return; }
    02389       case LinkMedia:           { link.setMedia(str); return; }
    02390       case LinkRel:             { link.setRel(str); return; }
    02391       case LinkRev:             { link.setRev(str); return; }
    02392       case LinkTarget:          { link.setTarget(str); return; }
    02393       case LinkType:            { link.setType(str); return; }
    02394       }
    02395     }
    02396     break;
    02397     case ID_TITLE: {
    02398       DOM::HTMLTitleElement title = element;
    02399       switch (token) {
    02400       case TitleText:                 { title.setText(str); return; }
    02401       }
    02402     }
    02403     break;
    02404     case ID_META: {
    02405       DOM::HTMLMetaElement meta = element;
    02406       switch (token) {
    02407       case MetaContent:         { meta.setContent(str); return; }
    02408       case MetaHttpEquiv:       { meta.setHttpEquiv(str); return; }
    02409       case MetaName:            { meta.setName(str); return; }
    02410       case MetaScheme:          { meta.setScheme(str); return; }
    02411       }
    02412     }
    02413     break;
    02414     case ID_BASE: {
    02415       DOM::HTMLBaseElement base = element;
    02416       switch (token) {
    02417       case BaseHref:            { base.setHref(str); return; }
    02418       case BaseTarget:          { base.setTarget(str); return; }
    02419       }
    02420     }
    02421     break;
    02422     case ID_ISINDEX: {
    02423       DOM::HTMLIsIndexElement isindex = element;
    02424       switch (token) {
    02425       // read-only: form
    02426       case IsIndexPrompt:               { isindex.setPrompt(str); return; }
    02427       }
    02428     }
    02429     break;
    02430     case ID_STYLE: {
    02431       DOM::HTMLStyleElement style = element;
    02432       switch (token) {
    02433       case StyleDisabled:        { style.setDisabled(value.toBoolean(exec)); return; }
    02434       case StyleMedia:           { style.setMedia(str); return; }
    02435       case StyleType:            { style.setType(str); return; }
    02436       }
    02437     }
    02438     break;
    02439     case ID_BODY: {
    02440       DOM::HTMLBodyElement body = element;
    02441       switch (token) {
    02442       case BodyALink:           { body.setALink(str); return; }
    02443       case BodyBackground:      { body.setBackground(str); return; }
    02444       case BodyBgColor:         { body.setBgColor(str); return; }
    02445       case BodyLink:            { body.setLink(str); return; }
    02446       case BodyText:            { body.setText(str); return; }
    02447       case BodyVLink:           { body.setVLink(str); return; }
    02448       case BodyScrollLeft:
    02449       case BodyScrollTop: {
    02450         QScrollView* sview = body.ownerDocument().view();
    02451         if (sview) {
    02452           // Update the document's layout before we compute these attributes.
    02453           DOM::DocumentImpl* docimpl = body.handle()->getDocument();
    02454           if (docimpl)
    02455             docimpl->updateLayout();
    02456           if (token == BodyScrollLeft)
    02457             sview->setContentsPos(value.toInteger(exec), sview->contentsY());
    02458           else
    02459             sview->setContentsPos(sview->contentsX(), value.toInteger(exec));
    02460           }
    02461         return;
    02462       }
    02463       case BodyOnLoad:
    02464         DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl *>(node.ownerDocument().handle());
    02465         if (doc && checkNodeSecurity(exec, node))
    02466         {
    02467           DOMNode* kjsDocNode = new DOMNode(exec, doc);
    02468           // Need to create a Value wrapper to avoid leaking the KJS::DOMNode
    02469           Value nodeValue(kjsDocNode);
    02470           kjsDocNode->setListener(exec,DOM::EventImpl::LOAD_EVENT,value);
    02471         }
    02472         return;
    02473       }
    02474     }
    02475     break;
    02476     case ID_FORM: {
    02477       DOM::HTMLFormElement form = element;
    02478       switch (token) {
    02479       // read-only: elements
    02480       // read-only: length
    02481       case FormName:            { form.setName(str); return; }
    02482       case FormAcceptCharset:   { form.setAcceptCharset(str); return; }
    02483       case FormAction:          { form.setAction(str.string()); return; }
    02484       case FormEncType:         { form.setEnctype(str); return; }
    02485       case FormMethod:          { form.setMethod(str); return; }
    02486       case FormTarget:          { form.setTarget(str); return; }
    02487       }
    02488     }
    02489     break;
    02490     case ID_SELECT: {
    02491       DOM::HTMLSelectElement select = element;
    02492       switch (token) {
    02493       // read-only: type
    02494       case SelectSelectedIndex:   { select.setSelectedIndex(value.toInteger(exec)); return; }
    02495       case SelectValue:           { select.setValue(str); return; }
    02496       case SelectLength:          { // read-only according to the NS spec, but webpages need it writeable
    02497                                          Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.options(), select) );
    02498                                          if ( !coll.isNull() )
    02499                                            coll.put(exec,"length",value);
    02500                                          return;
    02501                                        }
    02502       // read-only: form
    02503       // read-only: options
    02504       case SelectDisabled:        { select.setDisabled(value.toBoolean(exec)); return; }
    02505       case SelectMultiple:        { select.setMultiple(value.toBoolean(exec)); return; }
    02506       case SelectName:            { select.setName(str); return; }
    02507       case SelectSize:            { select.setSize(value.toInteger(exec)); return; }
    02508       case SelectTabIndex:        { select.setTabIndex(value.toInteger(exec)); return; }
    02509       }
    02510     }
    02511     break;
    02512     case ID_OPTGROUP: {
    02513       DOM::HTMLOptGroupElement optgroup = element;
    02514       switch (token) {
    02515       case OptGroupDisabled:        { optgroup.setDisabled(value.toBoolean(exec)); return; }
    02516       case OptGroupLabel:           { optgroup.setLabel(str); return; }
    02517       }
    02518     }
    02519     break;
    02520     case ID_OPTION: {
    02521       DOM::HTMLOptionElement option = element;
    02522       switch (token) {
    02523       // read-only: form
    02524       case OptionDefaultSelected: { option.setDefaultSelected(value.toBoolean(exec)); return; }
    02525       // read-only: text  <--- According to the DOM, but JavaScript and JScript both allow changes.
    02526       // So, we'll do it here and not add it to our DOM headers.
    02527       case OptionText:            { DOM::NodeList nl(option.childNodes());
    02528                                     for (unsigned int i = 0; i < nl.length(); i++) {
    02529                                         if (nl.item(i).nodeType() == DOM::Node::TEXT_NODE) {
    02530                                             static_cast<DOM::Text>(nl.item(i)).setData(str);
    02531                                             return;
    02532                                         }
    02533                                   }
    02534                                   // No child text node found, creating one
    02535                                   DOM::Text t = option.ownerDocument().createTextNode(str);
    02536                                   try { option.appendChild(t); }
    02537                                   catch(DOM::DOMException& e) {
    02538                                     // #### exec->setException ?
    02539                                   }
    02540
    02541                                   return;
    02542       }
    02543       // read-only: index
    02544       case OptionDisabled:        { option.setDisabled(value.toBoolean(exec)); return; }
    02545       case OptionLabel:           { option.setLabel(str); return; }
    02546       case OptionSelected:        { option.setSelected(value.toBoolean(exec)); return; }
    02547       case OptionValue:           { option.setValue(str); return; }
    02548       }
    02549     }
    02550     break;
    02551     case ID_INPUT: {
    02552       DOM::HTMLInputElement input = element;
    02553       switch (token) {
    02554       case InputDefaultValue:    { input.setDefaultValue(str); return; }
    02555       case InputDefaultChecked:  { input.setDefaultChecked(value.toBoolean(exec)); return; }
    02556       // read-only: form
    02557       case InputAccept:          { input.setAccept(str); return; }
    02558       case InputAccessKey:       { input.setAccessKey(str); return; }
    02559       case InputAlign:           { input.setAlign(str); return; }
    02560       case InputAlt:             { input.setAlt(str); return; }
    02561       case InputChecked:         { input.setChecked(value.toBoolean(exec)); return; }
    02562       case InputDisabled:        { input.setDisabled(value.toBoolean(exec)); return; }
    02563       case InputMaxLength:       { input.setMaxLength(value.toInteger(exec)); return; }
    02564       case InputName:            { input.setName(str); return; }
    02565       case InputReadOnly:        { input.setReadOnly(value.toBoolean(exec)); return; }
    02566       case InputSize:            { input.setSize(value.toInteger(exec)); return; }
    02567       case InputSrc:             { input.setSrc(str); return; }
    02568       case InputTabIndex:        { input.setTabIndex(value.toInteger(exec)); return; }
    02569       case InputType:            { input.setType(str); return; }
    02570       case InputUseMap:          { input.setUseMap(str); return; }
    02571       case InputValue:           { input.setValue(str); return; }
    02572       }
    02573     }
    02574     break;
    02575     case ID_TEXTAREA: {
    02576       DOM::HTMLTextAreaElement textarea = element;
    02577       switch (token) {
    02578       case TextAreaDefaultValue:    { textarea.setDefaultValue(str); return; }
    02579       // read-only: form
    02580       case TextAreaAccessKey:       { textarea.setAccessKey(str); return; }
    02581       case TextAreaCols:            { textarea.setCols(value.toInteger(exec)); return; }
    02582       case TextAreaDisabled:        { textarea.setDisabled(value.toBoolean(exec)); return; }
    02583       case TextAreaName:            { textarea.setName(str); return; }
    02584       case TextAreaReadOnly:        { textarea.setReadOnly(value.toBoolean(exec)); return; }
    02585       case TextAreaRows:            { textarea.setRows(value.toInteger(exec)); return; }
    02586       case TextAreaTabIndex:        { textarea.setTabIndex(value.toInteger(exec)); return; }
    02587       // read-only: type
    02588       case TextAreaValue:           { textarea.setValue(str); return; }
    02589       }
    02590     }
    02591     break;
    02592     case ID_BUTTON: {
    02593       DOM::HTMLButtonElement button = element;
    02594       switch (token) {
    02595       // read-only: form
    02596       case ButtonAccessKey:       { button.setAccessKey(str); return; }
    02597       case ButtonDisabled:        { button.setDisabled(value.toBoolean(exec)); return; }
    02598       case ButtonName:            { button.setName(str); return; }
    02599       case ButtonTabIndex:        { button.setTabIndex(value.toInteger(exec)); return; }
    02600       // read-only: type
    02601       case ButtonValue:           { button.setValue(str); return; }
    02602       }
    02603     }
    02604     break;
    02605     case ID_LABEL: {
    02606       DOM::HTMLLabelElement label = element;
    02607       switch (token) {
    02608       // read-only: form
    02609       case LabelAccessKey:       { label.setAccessKey(str); return; }
    02610       case LabelHtmlFor:         { label.setHtmlFor(str); return; }
    02611       }
    02612     }
    02613     break;
    02614 //    case ID_FIELDSET: {
    02615 //      DOM::HTMLFieldSetElement fieldSet = element;
    02616 //      // read-only: form
    02617 //    }
    02618 //    break;
    02619     case ID_LEGEND: {
    02620       DOM::HTMLLegendElement legend = element;
    02621       switch (token) {
    02622       // read-only: form
    02623       case LegendAccessKey:       { legend.setAccessKey(str); return; }
    02624       case LegendAlign:           { legend.setAlign(str); return; }
    02625       }
    02626     }
    02627     break;
    02628     case ID_UL: {
    02629       DOM::HTMLUListElement uList = element;
    02630       switch (token) {
    02631       case UListCompact:         { uList.setCompact(value.toBoolean(exec)); return; }
    02632       case UListType:            { uList.setType(str); return; }
    02633       }
    02634     }
    02635     break;
    02636     case ID_OL: {
    02637       DOM::HTMLOListElement oList = element;
    02638       switch (token) {
    02639       case OListCompact:         { oList.setCompact(value.toBoolean(exec)); return; }
    02640       case OListStart:           { oList.setStart(value.toInteger(exec)); return; }
    02641       case OListType:            { oList.setType(str); return; }
    02642       }
    02643     }
    02644     break;
    02645     case ID_DL: {
    02646       DOM::HTMLDListElement dList = element;
    02647       switch (token) {
    02648       case DListCompact:         { dList.setCompact(value.toBoolean(exec)); return; }
    02649       }
    02650     }
    02651     break;
    02652     case ID_DIR: {
    02653       DOM::HTMLDirectoryElement directory = element;
    02654       switch (token) {
    02655       case DirectoryCompact:     { directory.setCompact(value.toBoolean(exec)); return; }
    02656       }
    02657     }
    02658     break;
    02659     case ID_MENU: {
    02660       DOM::HTMLMenuElement menu = element;
    02661       switch (token) {
    02662       case MenuCompact:         { menu.setCompact(value.toBoolean(exec)); return; }
    02663       }
    02664     }
    02665     break;
    02666     case ID_LI: {
    02667       DOM::HTMLLIElement li = element;
    02668       switch (token) {
    02669       case LIType:            { li.setType(str); return; }
    02670       case LIValue:           { li.setValue(value.toInteger(exec)); return; }
    02671       }
    02672     }
    02673     break;
    02674     case ID_DIV: {
    02675       DOM::HTMLDivElement div = element;
    02676       switch (token) {
    02677       case DivAlign:           { div.setAlign(str); return; }
    02678       }
    02679     }
    02680     break;
    02681     case ID_P: {
    02682       DOM::HTMLParagraphElement paragraph = element;
    02683       switch (token) {
    02684       case ParagraphAlign:     { paragraph.setAlign(str); return; }
    02685       }
    02686     }
    02687     break;
    02688     case ID_H1:
    02689     case ID_H2:
    02690     case ID_H3:
    02691     case ID_H4:
    02692     case ID_H5:
    02693     case ID_H6: {
    02694       DOM::HTMLHeadingElement heading = element;
    02695       switch (token) {
    02696       case HeadingAlign:         { heading.setAlign(str); return; }
    02697       }
    02698     }
    02699     break;
    02700     case ID_BLOCKQUOTE: {
    02701       DOM::HTMLBlockquoteElement blockquote = element;
    02702       switch (token) {
    02703       case BlockQuoteCite:       { blockquote.setCite(str); return; }
    02704       }
    02705     }
    02706     break;
    02707     case ID_Q: {
    02708       DOM::HTMLQuoteElement quote = element;
    02709       switch (token) {
    02710       case QuoteCite:            { quote.setCite(str); return; }
    02711       }
    02712     }
    02713     break;
    02714     case ID_PRE: {
    02715       DOM::HTMLPreElement pre = element;
    02716       switch (token) {
    02717       case PreWidth:           { pre.setWidth(value.toInteger(exec)); return; }
    02718       }
    02719     }
    02720     break;
    02721     case ID_BR: {
    02722       DOM::HTMLBRElement br = element;
    02723       switch (token) {
    02724       case BRClear:           { br.setClear(str); return; }
    02725       }
    02726     }
    02727     break;
    02728     case ID_BASEFONT: {
    02729       DOM::HTMLBaseFontElement baseFont = element;
    02730       switch (token) {
    02731       case BaseFontColor:           { baseFont.setColor(str); return; }
    02732       case BaseFontFace:            { baseFont.setFace(str); return; }
    02733       case BaseFontSize:            { baseFont.setSize(value.toInteger(exec)); return; }
    02734       }
    02735     }
    02736     break;
    02737     case ID_FONT: {
    02738       DOM::HTMLFontElement font = element;
    02739       switch (token) {
    02740       case FontColor:           { font.setColor(str); return; }
    02741       case FontFace:            { font.setFace(str); return; }
    02742       case FontSize:            { font.setSize(str); return; }
    02743       }
    02744     }
    02745     break;
    02746     case ID_HR: {
    02747       DOM::HTMLHRElement hr = element;
    02748       switch (token) {
    02749       case HRAlign:           { hr.setAlign(str); return; }
    02750       case HRNoShade:         { hr.setNoShade(value.toBoolean(exec)); return; }
    02751       case HRSize:            { hr.setSize(str); return; }
    02752       case HRWidth:           { hr.setWidth(str); return; }
    02753       }
    02754     }
    02755     break;
    02756     case ID_INS:
    02757     case ID_DEL: {
    02758       DOM::HTMLModElement mod = element;
    02759       switch (token) {
    02760       case ModCite:            { mod.setCite(str); return; }
    02761       case ModDateTime:        { mod.setDateTime(str); return; }
    02762       }
    02763     }
    02764     break;
    02765     case ID_A: {
    02766       DOM::HTMLAnchorElement anchor = element;
    02767       switch (token) {
    02768       case AnchorAccessKey:       { anchor.setAccessKey(str); return; }
    02769       case AnchorCharset:         { anchor.setCharset(str); return; }
    02770       case AnchorCoords:          { anchor.setCoords(str); return; }
    02771       case AnchorHref:            { anchor.setHref(str); return; }
    02772       case AnchorHrefLang:        { anchor.setHreflang(str); return; }
    02773       case AnchorName:            { anchor.setName(str); return; }
    02774       case AnchorRel:             { anchor.setRel(str); return; }
    02775       case AnchorRev:             { anchor.setRev(str); return; }
    02776       case AnchorShape:           { anchor.setShape(str); return; }
    02777       case AnchorTabIndex:        { anchor.setTabIndex(value.toInteger(exec)); return; }
    02778       case AnchorTarget:          { anchor.setTarget(str); return; }
    02779       case AnchorType:            { anchor.setType(str); return; }
    02780       }
    02781     }
    02782     break;
    02783     case ID_IMG: {
    02784       DOM::HTMLImageElement image = element;
    02785       switch (token) {
    02786       case ImageName:            { image.setName(str); return; }
    02787       case ImageAlign:           { image.setAlign(str); return; }
    02788       case ImageAlt:             { image.setAlt(str); return; }
    02789       case ImageBorder:          { image.setBorder(str); return; }
    02790       case ImageHeight:          { image.setHeight(value.toInteger(exec)); return; }
    02791       case ImageHspace:          { image.setHspace(value.toInteger(exec)); return; }
    02792       case ImageIsMap:           { image.setIsMap(value.toBoolean(exec)); return; }
    02793       case ImageLongDesc:        { image.setLongDesc(str); return; }
    02794       case ImageSrc:             { image.setSrc(str); return; }
    02795       case ImageUseMap:          { image.setUseMap(str); return; }
    02796       case ImageVspace:          { image.setVspace(value.toInteger(exec)); return; }
    02797       case ImageWidth:           { image.setWidth(value.toInteger(exec)); return; }
    02798       }
    02799     }
    02800     break;
    02801     case ID_OBJECT: {
    02802       DOM::HTMLObjectElement object = element;
    02803       switch (token) {
    02804       // read-only: form
    02805       case ObjectCode:                 { object.setCode(str); return; }
    02806       case ObjectAlign:           { object.setAlign(str); return; }
    02807       case ObjectArchive:         { object.setArchive(str); return; }
    02808       case ObjectBorder:          { object.setBorder(str); return; }
    02809       case ObjectCodeBase:        { object.setCodeBase(str); return; }
    02810       case ObjectCodeType:        { object.setCodeType(str); return; }
    02811       // read-only: ObjectContentDocument
    02812       case ObjectData:            { object.setData(str); return; }
    02813       case ObjectDeclare:         { object.setDeclare(value.toBoolean(exec)); return; }
    02814       case ObjectHeight:          { object.setHeight(str); return; }
    02815       case ObjectHspace:          { object.setHspace(value.toInteger(exec)); return; }
    02816       case ObjectName:            { object.setName(str); return; }
    02817       case ObjectStandby:         { object.setStandby(str); return; }
    02818       case ObjectTabIndex:        { object.setTabIndex(value.toInteger(exec)); return; }
    02819       case ObjectType:            { object.setType(str); return; }
    02820       case ObjectUseMap:          { object.setUseMap(str); return; }
    02821       case ObjectVspace:          { object.setVspace(value.toInteger(exec)); return; }
    02822       case ObjectWidth:           { object.setWidth(str); return; }
    02823       }
    02824     }
    02825     break;
    02826     case ID_PARAM: {
    02827       DOM::HTMLParamElement param = element;
    02828       switch (token) {
    02829       case ParamName:            { param.setName(str); return; }
    02830       case ParamType:            { param.setType(str); return; }
    02831       case ParamValue:           { param.setValue(str); return; }
    02832       case ParamValueType:       { param.setValueType(str); return; }
    02833       }
    02834     }
    02835     break;
    02836     case ID_APPLET: {
    02837       DOM::HTMLAppletElement applet = element;
    02838       switch (token) {
    02839       case AppletAlign:           { applet.setAlign(str); return; }
    02840       case AppletAlt:             { applet.setAlt(str); return; }
    02841       case AppletArchive:         { applet.setArchive(str); return; }
    02842       case AppletCode:            { applet.setCode(str); return; }
    02843       case AppletCodeBase:        { applet.setCodeBase(str); return; }
    02844       case AppletHeight:          { applet.setHeight(str); return; }
    02845       case AppletHspace:          { applet.setHspace(value.toInteger(exec)); return; }
    02846       case AppletName:            { applet.setName(str); return; }
    02847       case AppletObject:          { applet.setObject(str); return; }
    02848       case AppletVspace:          { applet.setVspace(value.toInteger(exec)); return; }
    02849       case AppletWidth:           { applet.setWidth(str); return; }
    02850       }
    02851     }
    02852     break;
    02853     case ID_MAP: {
    02854       DOM::HTMLMapElement map = element;
    02855       switch (token) {
    02856       // read-only: areas
    02857       case MapName:                 { map.setName(str); return; }
    02858      }
    02859     }
    02860     break;
    02861     case ID_AREA: {
    02862       DOM::HTMLAreaElement area = element;
    02863       switch (token) {
    02864       case AreaAccessKey:       { area.setAccessKey(str); return; }
    02865       case AreaAlt:             { area.setAlt(str); return; }
    02866       case AreaCoords:          { area.setCoords(str); return; }
    02867       case AreaHref:            { area.setHref(str); return; }
    02868       case AreaNoHref:          { area.setNoHref(value.toBoolean(exec)); return; }
    02869       case AreaShape:           { area.setShape(str); return; }
    02870       case AreaTabIndex:        { area.setTabIndex(value.toInteger(exec)); return; }
    02871       case AreaTarget:          { area.setTarget(str); return; }
    02872       }
    02873     }
    02874     break;
    02875     case ID_SCRIPT: {
    02876       DOM::HTMLScriptElement script = element;
    02877       switch (token) {
    02878       case ScriptText:            { script.setText(str); return; }
    02879       case ScriptHtmlFor:         { script.setHtmlFor(str); return; }
    02880       case ScriptEvent:           { script.setEvent(str); return; }
    02881       case ScriptCharset:         { script.setCharset(str); return; }
    02882       case ScriptDefer:           { script.setDefer(value.toBoolean(exec)); return; }
    02883       case ScriptSrc:             { script.setSrc(str); return; }
    02884       case ScriptType:            { script.setType(str); return; }
    02885       }
    02886     }
    02887     break;
    02888     case ID_TABLE: {
    02889       DOM::HTMLTableElement table = element;
    02890       switch (token) {
    02891       case TableCaption:         { table.setCaption(n); return; } // type HTMLTableCaptionElement
    02892       case TableTHead:           { table.setTHead(n); return; } // type HTMLTableSectionElement
    02893       case TableTFoot:           { table.setTFoot(n); return; } // type HTMLTableSectionElement
    02894       // read-only: rows
    02895       // read-only: tbodies
    02896       case TableAlign:           { table.setAlign(str); return; }
    02897       case TableBgColor:         { table.setBgColor(str); return; }
    02898       case TableBorder:          { table.setBorder(str); return; }
    02899       case TableCellPadding:     { table.setCellPadding(str); return; }
    02900       case TableCellSpacing:     { table.setCellSpacing(str); return; }
    02901       case TableFrame:           { table.setFrame(str); return; }
    02902       case TableRules:           { table.setRules(str); return; }
    02903       case TableSummary:         { table.setSummary(str); return; }
    02904       case TableWidth:           { table.setWidth(str); return; }
    02905       }
    02906     }
    02907     break;
    02908     case ID_CAPTION: {
    02909       DOM::HTMLTableCaptionElement tableCaption = element;
    02910       switch (token) {
    02911       case TableAlign:           { tableCaption.setAlign(str); return; }
    02912       }
    02913     }
    02914     break;
    02915     case ID_COL:
    02916     case ID_COLGROUP: {
    02917       DOM::HTMLTableColElement tableCol = element;
    02918       switch (token) {
    02919       case TableColAlign:           { tableCol.setAlign(str); return; }
    02920       case TableColCh:              { tableCol.setCh(str); return; }
    02921       case TableColChOff:           { tableCol.setChOff(str); return; }
    02922       case TableColSpan:            { tableCol.setSpan(value.toInteger(exec)); return; }
    02923       case TableColVAlign:          { tableCol.setVAlign(str); return; }
    02924       case TableColWidth:           { tableCol.setWidth(str); return; }
    02925       }
    02926     }
    02927     break;
    02928     case ID_THEAD:
    02929     case ID_TBODY:
    02930     case ID_TFOOT: {
    02931       DOM::HTMLTableSectionElement tableSection = element;
    02932       switch (token) {
    02933       case TableSectionAlign:           { tableSection.setAlign(str); return; }
    02934       case TableSectionCh:              { tableSection.setCh(str); return; }
    02935       case TableSectionChOff:           { tableSection.setChOff(str); return; }
    02936       case TableSectionVAlign:          { tableSection.setVAlign(str); return; }
    02937       // read-only: rows
    02938       }
    02939     }
    02940     break;
    02941     case ID_TR: {
    02942       DOM::HTMLTableRowElement tableRow = element;
    02943       switch (token) {
    02944       // read-only: rowIndex
    02945       // read-only: sectionRowIndex
    02946       // read-only: cells
    02947       case TableRowAlign:           { tableRow.setAlign(str); return; }
    02948       case TableRowBgColor:         { tableRow.setBgColor(str); return; }
    02949       case TableRowCh:              { tableRow.setCh(str); return; }
    02950       case TableRowChOff:           { tableRow.setChOff(str); return; }
    02951       case TableRowVAlign:          { tableRow.setVAlign(str); return; }
    02952       }
    02953     }
    02954     break;
    02955     case ID_TH:
    02956     case ID_TD: {
    02957       DOM::HTMLTableCellElement tableCell = element;
    02958       switch (token) {
    02959       // read-only: cellIndex
    02960       case TableCellAbbr:            { tableCell.setAbbr(str); return; }
    02961       case TableCellAlign:           { tableCell.setAlign(str); return; }
    02962       case TableCellAxis:            { tableCell.setAxis(str); return; }
    02963       case TableCellBgColor:         { tableCell.setBgColor(str); return; }
    02964       case TableCellCh:              { tableCell.setCh(str); return; }
    02965       case TableCellChOff:           { tableCell.setChOff(str); return; }
    02966       case TableCellColSpan:         { tableCell.setColSpan(value.toInteger(exec)); return; }
    02967       case TableCellHeaders:         { tableCell.setHeaders(str); return; }
    02968       case TableCellHeight:          { tableCell.setHeight(str); return; }
    02969       case TableCellNoWrap:          { tableCell.setNoWrap(value.toBoolean(exec)); return; }
    02970       case TableCellRowSpan:         { tableCell.setRowSpan(value.toInteger(exec)); return; }
    02971       case TableCellScope:           { tableCell.setScope(str); return; }
    02972       case TableCellVAlign:          { tableCell.setVAlign(str); return; }
    02973       case TableCellWidth:           { tableCell.setWidth(str); return; }
    02974       }
    02975     }
    02976     break;
    02977     case ID_FRAMESET: {
    02978       DOM::HTMLFrameSetElement frameSet = element;
    02979       switch (token) {
    02980       case FrameSetCols:            { frameSet.setCols(str); return; }
    02981       case FrameSetRows:            { frameSet.setRows(str); return; }
    02982       }
    02983     }
    02984     break;
    02985     case ID_LAYER: {
    02986       DOM::HTMLLayerElement layerElement = element;
    02987       switch (token) {
    02988       case LayerTop:                   { layerElement.setTop(value.toInteger(exec)); return; }
    02989       case LayerLeft:                  { layerElement.setLeft(value.toInteger(exec)); return; }
    02990       case LayerVisibility:            { layerElement.setVisibility(str); return; }
    02991       case LayerBgColor:               { layerElement.setBgColor(str); return; }
    02992       // read-only: layers, clip
    02993       }
    02994     }
    02995     break;
    02996     case ID_FRAME: {
    02997       DOM::HTMLFrameElement frameElement = element;
    02998       switch (token) {
    02999        // read-only: FrameContentDocument:
    03000       case FrameFrameBorder:     { frameElement.setFrameBorder(str); return; }
    03001       case FrameLongDesc:        { frameElement.setLongDesc(str); return; }
    03002       case FrameMarginHeight:    { frameElement.setMarginHeight(str); return; }
    03003       case FrameMarginWidth:     { frameElement.setMarginWidth(str); return; }
    03004       case FrameName:            { frameElement.setName(str); return; }
    03005       case FrameNoResize:        { frameElement.setNoResize(value.toBoolean(exec)); return; }
    03006       case FrameScrolling:       { frameElement.setScrolling(str); return; }
    03007       case FrameSrc:             { frameElement.setSrc(str); return; }
    03008       case FrameLocation:        {
    03009                                    static_cast<DOM::HTMLFrameElementImpl *>(frameElement.handle())->setLocation(str);
    03010                                    return;
    03011                                  }
    03012       }
    03013     }
    03014     break;
    03015     case ID_IFRAME: {
    03016       DOM::HTMLIFrameElement iFrame = element;
    03017       switch (token) {
    03018       case IFrameAlign:           { iFrame.setAlign(str); return; }
    03019       // read-only: IFrameContentDocument
    03020       case IFrameFrameBorder:     { iFrame.setFrameBorder(str); return; }
    03021       case IFrameHeight:          { iFrame.setHeight(str); return; }
    03022       case IFrameLongDesc:        { iFrame.setLongDesc(str); return; }
    03023       case IFrameMarginHeight:    { iFrame.setMarginHeight(str); return; }
    03024       case IFrameMarginWidth:     { iFrame.setMarginWidth(str); return; }
    03025       case IFrameName:            { iFrame.setName(str); return; }
    03026       case IFrameScrolling:       { iFrame.setScrolling(str); return; }
    03027       case IFrameSrc:             { iFrame.setSrc(str); return; }
    03028       case IFrameWidth:           { iFrame.setWidth(str); return; }
    03029       }
    03030       break;
    03031     }
    03032   }
    03033
    03034   // generic properties
    03035   switch (token) {
    03036   case ElementId:
    03037     element.setId(str);
    03038     return;
    03039   case ElementTitle:
    03040     element.setTitle(str);
    03041     return;
    03042   case ElementLang:
    03043     element.setLang(str);
    03044     return;
    03045   case ElementDir:
    03046     element.setDir(str);
    03047     return;
    03048   case ElementClassName:
    03049     element.setClassName(str);
    03050     return;
    03051   case ElementInnerHTML:
    03052     element.setInnerHTML(str);
    03053     return;
    03054   case ElementInnerText:
    03055     element.setInnerText(str);
    03056     return;
    03057   default:
    03058     kdDebug(6070) << "WARNING: KJS::HTMLElement::putValueProperty unhandled token " << token << " thisTag=" << element.tagName().string() << " str=" << str.string() << endl;
    03059   }
    03060 }
    03061
    03062 // -------------------------------------------------------------------------
    03063 /* Source for HTMLCollectionProtoTable.
    03064 @begin HTMLCollectionProtoTable 3
    03065   item      HTMLCollection::Item        DontDelete|Function 1
    03066   namedItem HTMLCollection::NamedItem   DontDelete|Function 1
    03067   tags      HTMLCollection::Tags        DontDelete|Function 1
    03068 @end
    03069 */
    03070 DEFINE_PROTOTYPE("HTMLCollection", HTMLCollectionProto)
    03071 IMPLEMENT_PROTOFUNC_DOM(HTMLCollectionProtoFunc)
    03072 IMPLEMENT_PROTOTYPE(HTMLCollectionProto,HTMLCollectionProtoFunc)
    03073
    03074 const ClassInfo KJS::HTMLCollection::info = { "HTMLCollection", 0, 0, 0 };
    03075
    03076 KJS::HTMLCollection::HTMLCollection(ExecState *exec, const DOM::HTMLCollection& c)
    03077   : DOMObject(HTMLCollectionProto::self(exec)), collection(c), hidden(false) {}
    03078
    03079 KJS::HTMLCollection::~HTMLCollection()
    03080 {
    03081   ScriptInterpreter::forgetDOMObject(collection.handle());
    03082 }
    03083
    03084 bool KJS::HTMLCollection::toBoolean(ExecState *) const {
    03085     return !hidden;
    03086 }
    03087
    03088 // We have to implement hasProperty since we don't use a hashtable for 'selectedIndex' and 'length'
    03089 // ## this breaks "for (..in..)" though.
    03090 bool KJS::HTMLCollection::hasProperty(ExecState *exec, const Identifier &p) const
    03091 {
    03092   if (p == lengthPropertyName)
    03093     return true;
    03094   if ( collection.item(0).elementId() == ID_OPTION &&
    03095        ( p == "selectedIndex" || p == "value" ) )
    03096     return true;
    03097   return DOMObject::hasProperty(exec, p);
    03098 }
    03099
    03100 Value KJS::HTMLCollection::tryGet(ExecState *exec, const Identifier &propertyName) const
    03101 {
    03102 #ifdef KJS_VERBOSE
    03103   kdDebug(6070) << "KJS::HTMLCollection::tryGet " << propertyName.ascii() << endl;
    03104 #endif
    03105   if (propertyName == lengthPropertyName)
    03106   {
    03107 #ifdef KJS_VERBOSE
    03108     kdDebug(6070) << "  collection length is " << collection.length() << endl;
    03109 #endif
    03110     return Number(collection.length());
    03111   }
    03112
    03113   if (collection.item(0).elementId() == ID_OPTION) {
    03114     DOM::HTMLSelectElement parentSelect;
    03115     DOM::Node node = collection.item(0).parentNode();
    03116     while(!node.isNull() && parentSelect.isNull()) {
    03117       if(node.elementId() == ID_SELECT)
    03118         parentSelect = static_cast<DOM::HTMLSelectElement>(node);
    03119       node = node.parentNode();
    03120     }
    03121     if ( parentSelect.isNull() )
    03122       return Undefined();
    03123     if (propertyName == "selectedIndex") {
    03124       // NON-STANDARD options.selectedIndex
    03125       return Number(parentSelect.selectedIndex());
    03126     } else if ( propertyName == "value" ) {
    03127       // NON-STANDARD options.value
    03128       return String(parentSelect.value());
    03129     }
    03130   }
    03131
    03132   // Look in the prototype (for functions) before assuming it's an item's name
    03133   Object proto = Object::dynamicCast(prototype());
    03134   if (!proto.isNull() && proto.hasProperty(exec,propertyName))
    03135     return proto.get(exec,propertyName);
    03136
    03137   // name or index ?
    03138   bool ok;
    03139   unsigned int u = propertyName.toULong(&ok);
    03140   if (ok) {
    03141     if ( u < collection.length() ) {
    03142       DOM::Node node = collection.item(u);
    03143       return getDOMNode(exec,node);
    03144     } else
    03145       return Undefined();
    03146   }
    03147   else
    03148     return getNamedItems(exec,propertyName);
    03149 }
    03150
    03151 // HTMLCollections are strange objects, they support both get and call,
    03152 // so that document.forms.item(0) and document.forms(0) both work.
    03153 Value KJS::HTMLCollection::call(ExecState *exec, Object &thisObj, const List &args)
    03154 {
    03155   // This code duplication is necessary, HTMLCollection isn't a DOMFunction
    03156   Value val;
    03157   try {
    03158     val = tryCall(exec, thisObj, args);
    03159   }
    03160   // pity there's no way to distinguish between these in JS code
    03161   catch (...) {
    03162     Object err = Error::create(exec, GeneralError, "Exception from HTMLCollection");
    03163     exec->setException(err);
    03164   }
    03165   return val;
    03166 }
    03167
    03168 Value KJS::HTMLCollection::tryCall(ExecState *exec, Object &, const List &args)
    03169 {
    03170   // Do not use thisObj here. It can be the HTMLDocument, in the document.forms(i) case.
    03171   /*if( thisObj.imp() != this )
    03172   {
    03173     kdDebug(6070) << "WARNING: thisObj.imp() != this in HTMLCollection::tryCall" << endl;
    03174     KJS::printInfo(exec,"KJS::HTMLCollection::tryCall thisObj",thisObj,-1);
    03175     KJS::printInfo(exec,"KJS::HTMLCollection::tryCall this",Value(this),-1);
    03176   }*/
    03177   // Also, do we need the TypeError test here ?
    03178
    03179   if (args.size() == 1) {
    03180     // support for document.all(<index>) etc.
    03181     bool ok;
    03182     UString s = args[0].toString(exec);
    03183     unsigned int u = s.toULong(&ok);
    03184     if (ok) {
    03185       DOM::Element element = collection.item(u);
    03186       return getDOMNode(exec,element);
    03187     }
    03188     // support for document.images('<name>') etc.
    03189     return getNamedItems(exec,Identifier(s));
    03190   }
    03191   else if (args.size() >= 1) // the second arg, if set, is the index of the item we want
    03192   {
    03193     bool ok;
    03194     UString s = args[0].toString(exec);
    03195     unsigned int u = args[1].toString(exec).toULong(&ok);
    03196     if (ok)
    03197     {
    03198       DOM::DOMString pstr = s.string();
    03199       DOM::Node node = collection.namedItem(pstr);
    03200       while (!node.isNull()) {
    03201         if (!u)
    03202           return getDOMNode(exec,node);
    03203         node = collection.nextNamedItem(pstr);
    03204         --u;
    03205       }
    03206     }
    03207   }
    03208   return Undefined();
    03209 }
    03210
    03211 Value KJS::HTMLCollection::getNamedItems(ExecState *exec, const Identifier &propertyName) const
    03212 {
    03213 #ifdef KJS_VERBOSE
    03214   kdDebug(6070) << "KJS::HTMLCollection::getNamedItems " << propertyName.ascii() << endl;
    03215 #endif
    03216   DOM::DOMString pstr = propertyName.string();
    03217   DOM::Node node = collection.namedItem(pstr);
    03218   if(!node.isNull())
    03219   {
    03220     DOM::Node next = collection.nextNamedItem(pstr);
    03221     if (next.isNull()) // single item
    03222     {
    03223 #ifdef KJS_VERBOSE
    03224       kdDebug(6070) << "returning single node" << endl;
    03225 #endif
    03226       return getDOMNode(exec,node);
    03227     }
    03228     else // multiple items, return a collection
    03229     {
    03230       QValueList<DOM::Node> nodes;
    03231       nodes.append(node);
    03232       do {
    03233         nodes.append(next);
    03234         next = collection.nextNamedItem(pstr);
    03235       } while (!next.isNull());
    03236 #ifdef KJS_VERBOSE
    03237       kdDebug(6070) << "returning list of " << nodes.count() << " nodes" << endl;
    03238 #endif
    03239       return Value(new DOMNamedNodesCollection(exec, nodes));
    03240     }
    03241   }
    03242 #ifdef KJS_VERBOSE
    03243   kdDebug(6070) << "not found" << endl;
    03244 #endif
    03245   return Undefined();
    03246 }
    03247
    03248 Value KJS::HTMLCollectionProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
    03249 {
    03250   KJS_CHECK_THIS( KJS::HTMLCollection, thisObj );
    03251   DOM::HTMLCollection coll = static_cast<KJS::HTMLCollection *>(thisObj.imp())->toCollection();
    03252
    03253   switch (id) {
    03254   case KJS::HTMLCollection::Item:
    03255     return getDOMNode(exec,coll.item(args[0].toUInt32(exec)));
    03256   case KJS::HTMLCollection::Tags:
    03257   {
    03258     DOM::DOMString tagName = args[0].toString(exec).string();
    03259     DOM::NodeList list;
    03260     // getElementsByTagName exists in Document and in Element, pick up the right one
    03261     if ( coll.base().nodeType() == DOM::Node::DOCUMENT_NODE )
    03262     {
    03263       DOM::Document doc = coll.base();
    03264       list = doc.getElementsByTagName(tagName);
    03265 #ifdef KJS_VERBOSE
    03266       kdDebug(6070) << "KJS::HTMLCollectionProtoFunc::tryCall document.tags(" << tagName.string() << ") -> " << list.length() << " items in node list" << endl;
    03267 #endif
    03268     } else
    03269     {
    03270       DOM::Element e = coll.base();
    03271       list = e.getElementsByTagName(tagName);
    03272 #ifdef KJS_VERBOSE
    03273       kdDebug(6070) << "KJS::HTMLCollectionProtoFunc::tryCall element.tags(" << tagName.string() << ") -> " << list.length() << " items in node list" << endl;
    03274 #endif
    03275     }
    03276     return getDOMNodeList(exec, list);
    03277   }
    03278   case KJS::HTMLCollection::NamedItem:
    03279   {
    03280     Value val = static_cast<HTMLCollection *>(thisObj.imp())->getNamedItems(exec, Identifier(args[0].toString(exec)));
    03281     // Must return null when asking for a named item that isn't in the collection
    03282     // (DOM2 testsuite, HTMLCollection12 test)
    03283     if ( val.type() == KJS::UndefinedType )
    03284       return Null();
    03285     else
    03286       return val;
    03287   }
    03288   default:
    03289     return Undefined();
    03290   }
    03291 }
    03292
    03293 Value KJS::HTMLSelectCollection::tryGet(ExecState *exec, const Identifier &p) const
    03294 {
    03295   if (p == "selectedIndex")
    03296     return Number(element.selectedIndex());
    03297
    03298   return  HTMLCollection::tryGet(exec, p);
    03299 }
    03300
    03301 void KJS::HTMLSelectCollection::tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int)
    03302 {
    03303 #ifdef KJS_VERBOSE
    03304   kdDebug(6070) << "KJS::HTMLSelectCollection::tryPut " << propertyName.qstring() << endl;
    03305 #endif
    03306   if ( propertyName == "selectedIndex" ) {
    03307     element.setSelectedIndex( value.toInteger( exec ) );
    03308     return;
    03309   }
    03310   // resize ?
    03311   else if (propertyName == lengthPropertyName) {
    03312     unsigned newLen;
    03313     bool converted = value.toUInt32(newLen);
    03314
    03315     if (!converted) {
    03316       return;
    03317     }
    03318
    03319     long diff = element.length() - newLen;
    03320
    03321     if (diff < 0) { // add dummy elements
    03322       do {
    03323         element.add(element.ownerDocument().createElement("OPTION"), DOM::HTMLElement());
    03324       } while (++diff);
    03325     }
    03326     else // remove elements
    03327       while (diff-- > 0)
    03328         element.remove(newLen);
    03329
    03330     return;
    03331   }
    03332   // an index ?
    03333   bool ok;
    03334   unsigned int u = propertyName.toULong(&ok);
    03335   if (!ok)
    03336     return;
    03337
    03338   if (value.isA(NullType) || value.isA(UndefinedType)) {
    03339     // null and undefined delete. others, too ?
    03340     element.remove(u);
    03341     return;
    03342   }
    03343
    03344   // is v an option element ?
    03345   DOM::Node node = KJS::toNode(value);
    03346   if (node.isNull() || node.elementId() != ID_OPTION)
    03347     return;
    03348
    03349   DOM::HTMLOptionElement option = static_cast<DOM::HTMLOptionElement>(node);
    03350   if ( option.ownerDocument() != element.ownerDocument() )
    03351     option = static_cast<DOM::HTMLOptionElement>(element.ownerDocument().importNode(option, true));
    03352   long diff = long(u) - element.length();
    03353   DOM::HTMLElement before;
    03354   // out of array bounds ? first insert empty dummies
    03355   if (diff > 0) {
    03356     while (diff--) {
    03357       element.add(element.ownerDocument().createElement("OPTION"), before);
    03358     }
    03359     // replace an existing entry ?
    03360   } else if (diff < 0) {
    03361     before = element.options().item(u+1);
    03362     element.remove(u);
    03363   }
    03364   // finally add the new element
    03365   element.add(option, before);
    03366 }
    03367
    03369
    03370 OptionConstructorImp::OptionConstructorImp(ExecState *exec, const DOM::Document &d)
    03371     : ObjectImp(), doc(d)
    03372 {
    03373   // ## isn't there some redundancy between ObjectImp::_proto and the "prototype" property ?
    03374   //put(exec,"prototype", ...,DontEnum|DontDelete|ReadOnly);
    03375
    03376   // no. of arguments for constructor
    03377   // ## is 4 correct ? 0 to 4, it seems to be
    03378   put(exec,lengthPropertyName, Number(4), ReadOnly|DontDelete|DontEnum);
    03379 }
    03380
    03381 bool OptionConstructorImp::implementsConstruct() const
    03382 {
    03383   return true;
    03384 }
    03385
    03386 Object OptionConstructorImp::construct(ExecState *exec, const List &args)
    03387 {
    03388   DOM::Element el = doc.createElement("OPTION");
    03389   DOM::HTMLOptionElement opt = static_cast<DOM::HTMLOptionElement>(el);
    03390   int sz = args.size();
    03391   DOM::Text t = doc.createTextNode("");
    03392   try { opt.appendChild(t); }
    03393   catch(DOM::DOMException& e) {
    03394     // #### exec->setException ?
    03395   }
    03396   if (sz > 0)
    03397     t.setData(args[0].toString(exec).string()); // set the text
    03398   if (sz > 1)
    03399     opt.setValue(args[1].toString(exec).string());
    03400   if (sz > 2)
    03401     opt.setDefaultSelected(args[2].toBoolean(exec));
    03402   if (sz > 3)
    03403     opt.setSelected(args[3].toBoolean(exec));
    03404
    03405   return Object::dynamicCast(getDOMNode(exec,opt));
    03406 }
    03407
    03409
    03410 ImageConstructorImp::ImageConstructorImp(ExecState *, const DOM::Document &d)
    03411     : ObjectImp(), doc(d)
    03412 {
    03413 }
    03414
    03415 bool ImageConstructorImp::implementsConstruct() const
    03416 {
    03417   return true;
    03418 }
    03419
    03420 Object ImageConstructorImp::construct(ExecState *exec, const List &)
    03421 {
    03422   /* TODO: fetch optional height & width from arguments */
    03423
    03424   Object result(new Image(exec, doc));
    03425   /* TODO: do we need a prototype ? */
    03426
    03427   return result;
    03428 }
    03429
    03430 const ClassInfo KJS::Image::info = { "Image", 0, &ImageTable, 0 };
    03431
    03432 /* Source for ImageTable.
    03433 @begin ImageTable 5
    03434   src       Image::Src      DontDelete
    03435   width     Image::Width        DontDelete|ReadOnly
    03436   height    Image::Height       DontDelete|ReadOnly
    03437   complete  Image::Complete     DontDelete|ReadOnly
    03438   onload    Image::OnLoad       DontDelete
    03439 @end
    03440 */
    03441 Image::Image(ExecState* exec, const DOM::Document &d)
    03442   : DOMObject(exec->interpreter()->builtinObjectPrototype()), doc(d), img(0),
    03443   m_onLoadListener(0L)
    03444 {
    03445 }
    03446
    03447 Value Image::tryGet(ExecState *exec, const Identifier &propertyName) const
    03448 {
    03449   return DOMObjectLookupGetValue<Image,DOMObject>(exec, propertyName, &ImageTable, this);
    03450 }
    03451
    03452 Value Image::getValueProperty(ExecState *, int token) const
    03453 {
    03454   switch (token) {
    03455   case Src:
    03456     return String(src);
    03457   case Complete:
    03458     return Boolean(!img || img->status() >= khtml::CachedObject::Persistent);
    03459   case Width:
    03460     if ( !img )
    03461       return Undefined();
    03462     return Number(img->pixmap_size().width());
    03463   case Height:
    03464     if ( !img )
    03465       return Undefined();
    03466     return Number(img->pixmap_size().height());
    03467   case OnLoad:
    03468     if ( m_onLoadListener && m_onLoadListener->listenerObjImp())
    03469       return m_onLoadListener->listenerObj();
    03470     return Undefined();
    03471   default:
    03472     kdDebug(6070) << "WARNING: Image::getValueProperty unhandled token " << token << endl;
    03473     return Value();
    03474   }
    03475 }
    03476
    03477 void Image::tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
    03478 {
    03479   DOMObjectLookupPut<Image, DOMObject>( exec, propertyName, value, attr, &ImageTable, this );
    03480 }
    03481
    03482 void Image::putValueProperty(ExecState *exec, int token, const Value& value, int)
    03483 {
    03484   switch (token) {
    03485   case Src:
    03486     src = value.toString(exec);
    03487     if ( img ) img->deref(this);
    03488     img = static_cast<DOM::DocumentImpl*>( doc.handle() )->docLoader()->requestImage( src.string() );
    03489 // ### img = doc ? doc->docLoader()->requestImage( src.string() ) : 0;
    03490     if ( img ) {
    03491       img->ref(this);
    03492       src = img->url();
    03493     }
    03494     break;
    03495   case OnLoad:
    03496     if ( m_onLoadListener )
    03497         m_onLoadListener->deref();
    03498     m_onLoadListener = Window::retrieveActive(exec)->getJSEventListener(value,true);
    03499     if ( m_onLoadListener )
    03500         m_onLoadListener->ref();
    03501     break;
    03502   default:
    03503     kdDebug(6070) << "WARNING: Image::putValueProperty unhandled token " << token << endl;
    03504   }
    03505 }
    03506
    03507 void Image::notifyFinished(khtml::CachedObject * finishedObj)
    03508 {
    03509   if (img == finishedObj /*&& !loadEventSent*/ && m_onLoadListener ) {
    03510     //loadEventSent = true;
    03511     DOM::EventImpl *evt = new DOM::EventImpl( (DOM::EventImpl::EventId)ATTR_ONLOAD, false, false );
    03512     evt->setTarget( 0 );
    03513     evt->ref();
    03514     DOM::Event e(evt);
    03515     Object thisObj( this );
    03516     m_onLoadListener->hackSetThisObj( thisObj );
    03517     m_onLoadListener->handleEvent( e );
    03518     if ( m_onLoadListener ) // #57195
    03519         m_onLoadListener->hackUnsetThisObj();
    03520     evt->deref();
    03521   }
    03522 }
    03523
    03524 Image::~Image()
    03525 {
    03526   if ( img ) img->deref(this);
    03527   if ( m_onLoadListener )
    03528       m_onLoadListener->deref();
    03529 }
    03530
    03531 Value KJS::getHTMLCollection(ExecState *exec, const DOM::HTMLCollection& c, bool hide)
    03532 {
    03533   Value coll = cacheDOMObject<DOM::HTMLCollection, KJS::HTMLCollection>(exec, c);
    03534   if (hide) {
    03535     KJS::HTMLCollection *impl = static_cast<KJS::HTMLCollection*>(coll.imp());
    03536     impl->hide();
    03537   }
    03538   return coll;
    03539 }
    03540
    03541 Value KJS::getSelectHTMLCollection(ExecState *exec, const DOM::HTMLCollection& c, const DOM::HTMLSelectElement& e)
    03542 {
    03543   DOMObject *ret;
    03544   if (c.isNull())
    03545     return Null();
    03546   ScriptInterpreter* interp = static_cast<ScriptInterpreter *>(exec->interpreter());
    03547   if ((ret = interp->getDOMObject(c.handle())))
    03548     return Value(ret);
    03549   else {
    03550     ret = new HTMLSelectCollection(exec, c, e);
    03551     interp->putDOMObject(c.handle(),ret);
    03552     return Value(ret);
    03553   }
    03554 }

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:18 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003