Thank You Jeremy!

Yes, i did understand that e.src() is not nessesarily e.target() -
target() could
be a child DOM element of src(). scr() is the DOM element the event is
connected to.

But what i did expect was, that when i send a signal to the target via
the
"signal" function - "myImg" in your example - the event object "e"
should
contain both e.target() ("myImg") and e.src() ("myP"). The later as
the
DOM element the function is connected to the event, target as the
element the signal was sent to..

My intention was to "simulate" an event, just as i would have been
clicked (for instance) on "myImg". Isn't that (at least one reason)
what "signal" was made for?

In my case the e.src() is not very useful because e.src()
is a "form" element which contains "input" and "textarea" elements.
The event is only connected to the form element.

Of course for a workaround i could step through all relevant child
elements of the form and directly connet the event to the single
elements. But in my eyes this is an inelegant (ugly) solution..

Wouldn't you consider this as reasonable?
If yes, could i set this behaviour onto a "wish list"?
Is there such a list?

Thanks again
Helmut


On 26 Sep., 19:32, machineghost <[EMAIL PROTECTED]> wrote:
> Short answer: I think you want e.src(), not e.target()
> Longer answer: The target of an event is the element that triggered
> the event.  This is NOT the same as the element the event was attached
> to.
>
> For instance, let's say you had:
>     <p id="myP"><img id="myImg" src="whatever.jpg"/></p>
> and you hooked up an "onclick" event to myP:
>     connect("myP", "onclick", someFunction);
> If someone clicks on myImg, it will trigger myP's onclick event.  In
> that case, the target would be myImg, but the src would be myP.
>
> When you manually trigger an event, it should have no target, because
> there was no element responsible for triggering it.  However, it
> should still have a src(), which I believe is what you want.
>
> Hope that helps,
> Jeremy
>
> On Sep 20, 11:19 pm, hzlabs <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > the situation:
>
> > a <textarea id="ta"> element is connected to the "onchange" event via
>
> > connect ("ta", "onchange", function (e) {alert (e.target())});
>
> > when a enter some text into the field and leave the textarea, the
> > event is triggered
> > and the message with the target info appears.
>
> > However when i trigger the event by
>
> > singal ("ta", "onchange");
>
> > "e.target" seems to be undefined / missing
> > (JS-Console Message:
>
> > "Fehler: this._event has no properties
> > Quelldatei:http://unsinn-intranet/js/MochiKit/MochiKit.js
> > Zeile: 5057")
>
> > What could be wrong / what could i have missunderstood?
>
> > (MochiKit Version = 1.4 Revision 1314)
>
> > Thank you!
> > Helmut


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to