It is true we are attaching functions (and state) directly to the jQuery object which also means we have to keep a reference to that object. Although this isn't the official way of doing things, it allows us to quickly make simple, encapsulated controls. I do see how we could use $.data to solve our problem but attaching everything to the actual DOM element is not something we really need (or want) to do.
On Mar 7, 5:16 pm, ajpiano <[email protected]> wrote: > It seems like you are attaching information directly to arbitrary > jQuery objects, rather than using the .data() method, which from a > cursory read seems like it would be appropriate. > > --adam > > On Mar 7, 10:02 am, Dave Methvin <[email protected]> wrote: > > > > var button = makeNewButton().addClass('TestButton').appendTo(parent); > > > > Later we might want to disable the button with button.disable(). As > > > of 1.3.2, this is no longer possible as appendTo does not return the > > > original object. > > > But it in that case, the button variable has the element(s) that were > > appended to parent. Isn't that what you want? It's true that they're > > clones, but does that hurt anything? If you've added a .disable() > > plugin to jQuery it should still work on the button object. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
