DOM::Node extension

Peter Kelly pmk at kde.org
Sat Apr 12 02:36:09 BST 2003


On Fri, 11 Apr 2003, Josef Weidendorfer wrote:

> On Saturday 12 April 2003 15:36, Deschildre Nicolas wrote:
> > hi!
> > I'm currently working on the kafkapart (the WYSIWYG editor) for Quanta
> > and i would like to submit you a change in khtml: In the kafkapart,
> > extra information is needed for each DOM::Node to handle the events, and
> > when an event is raised, the only way i have to get theses extra
> > informations is to look the quanta node(where the extra infos are
> > stored) one after one to see if it is the corresponding quanta node.
> > [...]
> > Any comments?
> 
> Hi!
> 
> I can't decide this, but some comments...
> If you add a pointer to DOM::Node, make it a QGuardedPtr to never ever get any 
> dangling pointers.
> 
> > I can do and commit this, but first, isn't there one simpler way to do
> > this that i've missed?
> 
> Use a hash table (QPtrDict<QuantaNode>) for the lookup of the quanta node 
> instead a linear search.

This is the best method IMHO, and this is how the ECMAScript bindings 
handle the same situation (they maintain a separate set of objects 
corresponding to DOM nodes). Have a look at the ScriptInterpreter class 
and methods like KJS::getDOMNode() in khtml/ecma to see how to do this.

> 
> Josef
> 
> 
> > ++
> > Nicolas
> >
> > _____________________________________________________________________
> > Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
> > http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France
> 

-- 
Peter Kelly
pmk at kde.org





More information about the kfm-devel mailing list