I have just looked into the code and have found out where it goes
wrong.

It is at this line: 
http://github.com/jquery/jquery/blob/master/src/event.js#L102
where it overwrites the original handler with a modified one even for
other types.

On Jan 10, 12:24 pm, John Arrowwood <jarro...@gmail.com> wrote:
> First thing I'd like to know is, in the special handler where it says
> "special add handler for type: click", replace click with event.type like in
> the bind() call, and see if anything changes.  It shouldn't, but it's a data
> point.  Also, try doing the bind as 'keydown click' and see if the problem
> goes away.
>
> Also, try it again with jQuery 1.3.2 and see if it behaves the same way.  If
> not, it is a regression that somebody needs to look at.
>
> -- John
>
> On Sat, Jan 9, 2010 at 6:46 PM, helianthus 
> <project.heliant...@gmail.com>wrote:
>
>
>
>
>
> > Here is the test page:http://jsbin.com/ajuxi
>
> > Notice when a keyboard key is pressed the special add handler message
> > is shown.
>
> > On Jan 10, 5:54 am, John Arrowwood <jarro...@gmail.com> wrote:
> > > Okay, so I read the article.  I get the basic idea.  I've also read the
> > > code.  Based on what you have said, I still think you have not provided
> > > enough information to understand what the problem is.
>
> > > Let's see some sample code.  A test page that shows the problem.
>
> > > On Sat, Jan 9, 2010 at 12:39 AM, helianthus <
> > project.heliant...@gmail.com>wrote:
>
> > > > jQuery.event.special.click.add does not do what you think it does,
> > > > perhaps this article will help you understand my problem:
> > > >http://brandonaaron.net/blog/2009/06/4/jquery-edge-new-special-event-.
> > ..
>
> > > > I expect it to add an event listener to 'anothertype' event, but
> > > > without modifying the handler for 'anothertype' event, which is
> > > > intended for 'click' event only.
>
> > > > On Jan 9, 4:15 pm, John Arrowwood <jarro...@gmail.com> wrote:
> > > > > I've never used that feature, but I'm looking through the jQuery
> > code...
>
> > > > > If you have defined jQuery.event.special.click, then you later call
> > > > > bind('click',fn), it will first call your
> > > > jQuery.event.special.click.setup()
> > > > > function, and will only add the function as an event handler if your
> > > > setup
> > > > > function returns false.
>
> > > > > In your example, as the code loops through 'click' and then on to
> > > > > 'anothertype,' it will not find a special handler for 'anothertype'
> > and
> > > > so
> > > > > it will do the 'normal' thing of adding an event listener to the
> > element.
>
> > > > > Your question implies that you expect it not to.  Why would you
> > expect it
> > > > > not to add an event listener to the 'anothertype' event?  What should
> > be
> > > > > stopping it from doing so?
>
> > > > > On Sat, Jan 9, 2010 at 12:03 AM, helianthus <
> > > > project.heliant...@gmail.com>wrote:
>
> > > > > > Sorry for not being clear enough.
> > > > > > That is because in my example the special add handler is supposed
> > to
> > > > > > modify click event handlers only.
> > > > > > A special event add handler is something like this:
> > > > > > jQuery.event.special.click = {
> > > > > >   add: function() { return function() { ... }; }
> > > > > > };
>
> > > > > > On Jan 9, 3:48 pm, John Arrowwood <jarro...@gmail.com> wrote:
> > > > > > > Your question is not clear.  When you do .bind('event1
> > event2',fn)
> > > > you
> > > > > > add
> > > > > > > an event handler for both events.  This is to be expected.  So
> > why
> > > > would
> > > > > > you
> > > > > > > think that the code below would not modify the 'anothertype'
> > event?
>
> > > > > > > On Fri, Jan 8, 2010 at 10:58 PM, helianthus <
> > > > > > project.heliant...@gmail.com>wrote:
>
> > > > > > > > For example,
> > > > > > > > if I had created a special add handler for click event,
> > > > > > > > when I do something like jQuery.bind('click anothertype',
> > > > function()
> > > > > > > > {...}),
> > > > > > > > the handler of anothertype is also modified.
>
> > > > > > > > If the above is not clear enough I can write a test case.
>
> > > > > > > > --
> > > > > > > > You received this message because you are subscribed to the
> > Google
> > > > > > Groups
> > > > > > > > "jQuery Development" group.
> > > > > > > > To post to this group, send email to
> > jquery-...@googlegroups.com.
> > > > > > > > To unsubscribe from this group, send email to
> > > > > > > > jquery-dev+unsubscr...@googlegroups.com<jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > <jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > > > <jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > > > > > <jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > > > > > > > .
> > > > > > > > For more options, visit this group at
> > > > > > > >http://groups.google.com/group/jquery-dev?hl=en.
>
> > > > > > > --
> > > > > > > John Arrowwood
> > > > > > > John (at) Irie (dash) Inc (dot) com
> > > > > > > John (at) Arrowwood Photography (dot) com
> > > > > > > John (at) Hanlons Razor (dot) com
> > > > > > > --
> >http://www.irie-inc.com/http://arrowwood.blogspot.com/-Hidequoted
> > > > > > text -
>
> > > > > > > - Show quoted text -
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups
> > > > > > "jQuery Development" group.
> > > > > > To post to this group, send email to jquery-...@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > > > > jquery-dev+unsubscr...@googlegroups.com<jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > <jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > > > <jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/jquery-dev?hl=en.
>
> > > > > --
> > > > > John Arrowwood
> > > > > John (at) Irie (dash) Inc (dot) com
> > > > > John (at) Arrowwood Photography (dot) com
> > > > > John (at) Hanlons Razor (dot) com
> > > > > --http://www.irie-inc.com/http://arrowwood.blogspot.com/-Hidequoted
> > > > text -
>
> > > > > - Show quoted text -
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "jQuery Development" group.
> > > > To post to this group, send email to jquery-...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > jquery-dev+unsubscr...@googlegroups.com<jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > <jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/jquery-dev?hl=en.
>
> > > --
> > > John Arrowwood
> > > John (at) Irie (dash) Inc (dot) com
> > > John (at) Arrowwood Photography (dot) com
> > > John (at) Hanlons Razor (dot) com
> > > --http://www.irie-inc.com/http://arrowwood.blogspot.com/-Hide quoted
> > text -
>
> > > - Show quoted text -
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "jQuery Development" group.
> > To post to this group, send email to jquery-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > jquery-dev+unsubscr...@googlegroups.com<jquery-dev%2bunsubscr...@googlegrou­ps.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/jquery-dev?hl=en.
>
> --
> John Arrowwood
> John (at) Irie (dash) Inc (dot) com
> John (at) Arrowwood Photography (dot) com
> John (at) Hanlons Razor (dot) com
> --http://www.irie-inc.com/http://arrowwood.blogspot.com/- Hide quoted text -
>
> - Show quoted text -
-- 
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to