Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Child element being passed to handler?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jon  
View profile  
 More options Jun 22 2006, 10:34 am
From: "Jon" <jdelStrot...@gmail.com>
Date: Thu, 22 Jun 2006 07:34:56 -0700
Local: Thurs, Jun 22 2006 10:34 am
Subject: Child element being passed to handler?
I have something like this on my page :
<div id="container">
        <h1 id="innertext">HELLO!</h1>
</div>

and this event-selector rule:

        '#container:mouseover' : function(element) {
                new Insertion.After($('container'), "Mouse over "+element.id+"<br/>")
        }

I would expect the element that gets passed into that function to
always be $('container'), but it's not - I usually get the child
element ( $('innertext') )

Is there any way of getting the element that the rule was originally
applied to?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam  
View profile  
(1 user)  More options Jun 22 2006, 11:20 am
From: "Sam" <sam.goo...@iness.com>
Date: Thu, 22 Jun 2006 11:20:21 -0400
Local: Thurs, Jun 22 2006 11:20 am
Subject: RE: Child element being passed to handler?
Here's a modification I made to Event Selectors that solves this problem:

Change:

            observer = function(event) {
              var element = Event.element(event);
              if (element.nodeType == 3) // Safari Bug (Fixed in Webkit)
                        element = element.parentNode;
              rule.value($(element), event);
            }

To:

            observer = function(event) {
              var eventElement = Event.element(event);
              if (eventElement.nodeType == 3) // Safari Bug (Fixed in
Webkit)
                        eventElement = eventElement.parentNode;
              rule.value($(element), event, element);
            }

This change adds an optional 3rd parameter "element" which will always be
the element selected by your selector.

Sam


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam  
View profile  
 More options Jun 22 2006, 11:24 am
From: "Sam" <sam.goo...@iness.com>
Date: Thu, 22 Jun 2006 11:24:27 -0400
Local: Thurs, Jun 22 2006 11:24 am
Subject: RE: Child element being passed to handler?
My mistake.  The last line should be

              rule.value($(eventElement), event, element);

Sam


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
SCREECH  
View profile  
 More options Jun 30 2006, 12:09 pm
From: "SCREECH" <scre...@supergroove-records.com>
Date: Fri, 30 Jun 2006 09:09:19 -0700
Local: Fri, Jun 30 2006 12:09 pm
Subject: Re: Child element being passed to handler?
SAM,

thank you ...
you saved my day...

please put this into the normal event:selectors release...
otherwise it is not useable for complex web design...

best regards,
Screech


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff  
View profile  
 More options Jul 9 2006, 9:26 am
From: "Jeff" <kunkl...@gmail.com>
Date: Sun, 09 Jul 2006 06:26:06 -0700
Local: Sun, Jul 9 2006 9:26 am
Subject: Re: Child element being passed to handler?
Simply commenting out the line

var element = Event.element(event);

worked great for me. It doesn't appear that it's necessary.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Schwarz  
View profile  
 More options Jul 10 2006, 12:09 am
From: "Ben Schwarz" <ben.schw...@gmail.com>
Date: Sun, 09 Jul 2006 21:09:51 -0700
Local: Mon, Jul 10 2006 12:09 am
Subject: Re: Child element being passed to handler?
This also worked for me.
I haven't checked cross browser yet - I'll post any issues I find.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google