View Full Version : Gecko version of event.srcElement
Skyzyx
02-19-2003, 07:18 AM
I was checking out this post: http://www.codingforums.com/showthread.php?s=&threadid=13941
IE's event.srcElement.drag pretty much makes sense, but how would I do the same thing with Gecko browsers?
ahosang
02-19-2003, 12:56 PM
After obtaining the event object e, which can be tricky, use:
e.target
or
e.currentTarget
depending on whether the object is the registered handler for the function caller or in the bubbling phase.
That gives you the object, then e.target.drag may give yo the same.
To obtain the event object initially, could be tricky depending on how it's registered. I'll have to lok later
It's called W3C DOM Level 2 Events interface.
The event object will be passed in as an argument to the listener, and then like ahosang said, event.target refers to the deepest possible node the event object will capture/bubble through, while event.currentTarget refers to the node is the event is currently at.
This isn't Gecko-only, but Opera 7 and probably Safari/Konqueror compatible as well, since these browsers actually implement some DOM2.
Skyzyx
02-20-2003, 01:26 AM
Could you perhaps suggest a URL with documentation on the syntax for the Gecko/KHTML method? I know I can check MSDN for IE documentation.
W3C's site doesn't have much info on syntax, so I was hoping for another address or two to learn events from.
Err, W3C's site has all the info you could want.
IDL is pretty self-explanatory, and they adequately describe the various properties and methods:
http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/
Skyzyx
02-20-2003, 05:49 PM
This IDL Definition looks more like C++ or Java than JavaScript...
const unsigned short CAPTURING_PHASE = 1;
const unsigned short AT_TARGET = 2;
const unsigned short BUBBLING_PHASE = 3;
readonly attribute DOMString type;
readonly attribute EventTarget target;
readonly attribute EventTarget target;
... etc.
Unless... oooohhhhhhh... they're just explanations...
I'll take a look again and see what I can figure out. Thanks.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.