- Screen name: cowboy.ben
cowboy.ben's Profile
5 Posts
52 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- I'm on the repo, so I see a lot of issues being posted regarding the back button not working, but I've yet to be pinged about this.. Is there anything specific I can help with? I want to make sure that there aren't any issues with the hashchange event plugin, for starters.Also, I'm happy to help with any kind of fragment params serialization / deserialization stuff, but I don't know if any help is needed there.Either way, please let me know if I can help.
- I wrote a (rather in-depth) article on jQuery special events recently but forgot to link it in the forums, so I'm going to mention it here. I apologize in advance for its length, but I had a lot to say!The jQuery special events API is a fairly flexible system by which you can specify bind and unbind hooks as well as default actions for custom events. In using this API, you can create custom events that do more than just execute bound event handlers when triggered—these “special” events can modify the event object passed to event handlers, trigger other entirely different events, or execute complex setup and teardown code when event handlers are bound to or unbound from elements.Note that this article uses some advanced jQuery techniques and assumes you understand the concepts of custom events and event delegation using bubbling.Also, because this article is rather long, it has been broken up into sections. I’d recommend reading it in order, one section at a time, because techniques used in subsequent examples often reference those used in previous examples. Also, your brain is going to need a rest here and there, so take it slow.That being said, I do hope that you stick with it, because there is a lot of useful information here.
- 02-Mar-2010 12:43 PM
- Forum: Developing jQuery Core
So, you can get the .bind event namespace via event.handleObj.namespace, but what about the .trigger namespace? I don't see any way to get that value inside an event handler.Right now, you can use event.type to have one callback handle multiple events. Now, imagine that you could use event.namespace to have one callback handle multiple namespaces as well... You could just $(elem).bind( 'event', fn ); and throw any number of namespaces at a function that programatically handles them all.Like, do $(elem).trigger( 'event.foo' ); and fn could be all like "let's do something with this magical 'foo' value that i didn't have to know about in advance"So, that being said, I propose a new event property: event.namespace.Is there any value to doing this? Is this crazy talk?- Ben
--
http://bit.ly/benalmandotcom - "There's a Ben Alman jQuery plugin for that"Perhaps I'm missing something, but an jQuery.event.special add method returns a function, namespacing no longer works.
This image represents what "should" work, but notice that namespacing seems to have no effect when triggering or unbinding: http://benalman.com/grab/150c27.png
If add doesn't return a function, namespacing seems to work.. but of course the event object is no longer being augmented: http://benalman.com/grab/ac7431.png
I've actually been working on an article explaining a bit about how Special Events work. This screenshot may help explain what the expected behavior of the setup, teardown, add and remove methods should be (please correct me if I've got something wrong!)
Can anyone confirm this? i've created a ticket http://dev.jquery.com/ticket/5834 in the hopes that this can be resolved soon!
- Ben
http://benalman.com/ - jQuery BBQ, doTimeout, hashchange event, Message Queuing, postMessage, replaceText, Star Wipe, Untils, unwrap, urlInternal.. and more!- In case anyone is curious, I've written up a post on how $.param has
changed in 1.4. Please check it out and post there if you have any
feedback or comments, thanks!
http://benalman.com/news/2009/12/jquery-14-param-demystified/
- Ben
--- «Prev
- Next »
Moderate user : cowboy.ben
© 2013 jQuery Foundation
Sponsored by and others.

