My bad, I confused myself. In my post previously I meant to be talking about setProperty. setAttribute is a native method:
https://developer.mozilla.org/en/DOM/element.setAttribute setProperty is MooTools' wrapper for that method that helps you manage removing properties (setting them to null) as well as ensuring that properties that should be booleans (like checked) are set propertly. So set and setProperty are both used to set attributes, but set has additional functionality and should always be used. On Mon, Dec 29, 2008 at 10:57 AM, Michal-2 (via Nabble) < [email protected]<ml-user%[email protected]> > wrote: > > What about "setProperty"? The example at > http://mootools.net/docs/Element/Element#Element:setProperty > uses it to set img.src . So now there seem to be three ways of setting > the src of an image: > > set > setAttribute > setProperty > > When should setProperty be used? > > Michal. > > > On Dec 29, 6:45 pm, nutron > <anut...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089837&i=0>> > wrote: > > > setAttribute is a specific method for setting an element attribute that's > > > native. > > You can use set and setAttribute to the same effect for, say, img.src, > but > > you couldn't use setAttribute for innerHTML because it isn't an > attribute. > > > > For all intents and purposes, you should always use .set. > > > > On Mon, Dec 29, 2008 at 10:37 AM, Michal-2 (via Nabble) < > > ml-user+55915-776128...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089837&i=1> > <ml-user%2b55915-776128...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089837&i=2>> > > > > > > > > > > wrote: > > > > > Ah! Thanks, that makes it clear. But what about "setAttribute" in > > > custom get/setters? > > > > > Michal. > > > > > On Dec 29, 6:31 pm, nutron <anut...@...< > http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089764&i=0>> > > > wrote: > > > > > > retrieve and store are useful for storing data *on a specific > element*, > > > > while getters and setters are applied to *all* elements. > > > > i.e. > > > > myElement.store('myeffect', myInstanceOfFxTween); > > > > > > This is useful for storing a specific property with a specific > element. > > > > Getters/setters are useful for defining behavior for all elements: > > > > > > el.set('tween', options).tween('opacity', 0); <<an instance of > Fx.Tween > > > for > > > > el is *implied* > > > > > > On Mon, Dec 29, 2008 at 10:10 AM, Michal-2 (via Nabble) < > > > > ml-user+55915-776128...@...< > http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089764&i=1> > > > <ml-user%2b55915-776128...@...< > http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089764&i=2>> > > > > > > > wrote: > > > > > > > If it's ok, I have related questions: what about creating custom > > > > > properties returned by "get" and "set": when should it be done? At > > > > > > >http://mootools.net/docs/Element/Element#Element-Properties > > > > > > > the example uses the "setAttribute" method: what is that for? When > > > > > should that be used? Also, the fact that the Tween is returned by > > > > > "get" rather than "retrieve" confuses me. Why is it get and not > > > > > retrieve? Is it that "get" allows for some custom actions upon > "get"? > > > > > > > Michal. > > > > > > > On Dec 29, 4:30 pm, nutron <anut...@...< > > >http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089676&i=0>> > > > > > wrote: > > > > > > > > I just went ahead and posted this to my blog, as my answer, I > > > thought, > > > > > might > > > > > > be useful to others to read. Includes code examples and whatnot. > > > > > > > > > http://www.clientcide.com/your-questions/the-difference-between-eleme... > > > > > > > > On Mon, Dec 29, 2008 at 2:26 AM, stratboy (via Nabble) < > > > > > > ml-user+89945-1375813...@...< > > >http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089676&i=1> > > > > > <ml-user%2b89945-1375813...@...< > > >http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089676&i=2>> > > > > > > > > > wrote: > > > > > > > > > Hi! > > > > > > > > > after a lot of mootools programming and docs studies, I still > have > > > a > > > > > > > little question: > > > > > > > > > when should I use get/set and when store/retrieve? Or, in other > > > > words, > > > > > > > what's the best use for get/set and what's the best for store/ > > > > > > > retrieve? > > > > > > > > > ------------------------------ > > > > > > > View message @ > > > > >http://n2.nabble.com/get-set-vs.-store-retrieve-tp2077828p2077828.html > > > > > > > To start a new topic under MooTools Users, email > > > > > > > ml-node+660466-1583815...@...< > > >http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089676&i=3> > > > > > <ml-node%2b660466-1583815...@...< > > >http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089676&i=4>> > > > > > > > > > To unsubscribe from MooTools Users, click here< (link removed) > >. > > > > > > > > ----- > > > > > > The MooTools Tutorial: > http://www.mootorial.comwww.mootorial.com > > > > > > Clientcide: http://www.clientcide.comwww.clientcide.com > > > > > > -- > > > > > > View this message in context: > > > > > > http://n2.nabble.com/get-set-vs.-store-retrieve-tp2077828p2089367.html > > > > > > Sent from the MooTools Users mailing list archive at Nabble.com. > > > > > > > ------------------------------ > > > > > View message @ > > > > > > http://n2.nabble.com/get-set-vs.-store-retrieve-tp2077828p2089676.html > > > > > To start a new topic under MooTools Users, email > > > > > ml-node+660466-1583815...@...< > http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089764&i=3> > > > <ml-node%2b660466-1583815...@...< > http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089764&i=4>> > > > > > > > To unsubscribe from MooTools Users, click here< (link removed) >. > > > > > > ----- > > > > The MooTools Tutorial: http://www.mootorial.comwww.mootorial.com > > > > Clientcide: http://www.clientcide.comwww.clientcide.com > > > > -- > > > > View this message in context: > > >http://n2.nabble.com/get-set-vs.-store-retrieve-tp2077828p2089751.html > > > > Sent from the MooTools Users mailing list archive at Nabble.com. > > > > > ------------------------------ > > > View message @ > > >http://n2.nabble.com/get-set-vs.-store-retrieve-tp2077828p2089764.html > > > To start a new topic under MooTools Users, email > > > ml-node+660466-1583815...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089837&i=3> > <ml-node%2b660466-1583815...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2089837&i=4>> > > > > To unsubscribe from MooTools Users, click here< (link removed) >. > > > > ----- > > The MooTools Tutorial: http://www.mootorial.comwww.mootorial.com > > Clientcide: http://www.clientcide.comwww.clientcide.com > > -- > > View this message in context: > http://n2.nabble.com/get-set-vs.-store-retrieve-tp2077828p2089799.html > > Sent from the MooTools Users mailing list archive at Nabble.com. > > > ------------------------------ > View message @ > http://n2.nabble.com/get-set-vs.-store-retrieve-tp2077828p2089837.html > To start a new topic under MooTools Users, email > [email protected]<ml-node%[email protected]> > To unsubscribe from MooTools Users, click here< (link removed) >. > > > ----- The MooTools Tutorial: http://www.mootorial.com www.mootorial.com Clientcide: http://www.clientcide.com www.clientcide.com -- View this message in context: http://n2.nabble.com/get-set-vs.-store-retrieve-tp2077828p2089851.html Sent from the MooTools Users mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MooTools Users" 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/mootools-users?hl=en -~----------~----~----~----~------~----~------~--~---
