rgrove / jquery-yui3-rosetta-stone

A guide to idioms in YUI 3 and jQuery.
BSD 3-Clause "New" or "Revised" License
65 stars 20 forks source link

Include .live() and .delegate()? #9

Open stevenbedrick opened 13 years ago

stevenbedrick commented 13 years ago

It seems like it would be handy to include an example of going between JQuery's .live() and YUI3's node-event-delegate. I'd do it myself, but don't feel like I understand either one well enough to give a definitive example.

rgrove commented 13 years ago

jQuery's $('#foo').delegate() seems like the closest match for YUI's Y.one('#foo').delegate().

I think $('.foo').live() would be more like doing event delegation from the document in YUI, but I'm not sure whether jQuery does other stuff under the hood.

I'd be happy to write the YUI side if someone who knows more about jQuery wants to write the jQuery side.

derek commented 13 years ago

@danbeam was actually talking about submitting a patch for this yesterday. Dan, step up to the plate, dawg.

derek commented 13 years ago

Today I learned that when you nominate someone else to take a bug in a F/OSS project, you instead are nominating yourself. Fair enough. :)

I'll patch with some examples of jQuery's live(), bind(), and delgate() vs YUI. When jQuery 1.3 got live(), I shit a brick because it was so magical.