Steve you just beat me too it. Personally, I usually follow Aaron's logic.
Classes seem to make sense and work for me 99% of the time. It is also handy
when something does change in the presentation layer because the hooks for
css is already in place. This wouldn't be an issue if all browsers supported
div[locked=true]. When I have complex models I hate the aspect of using
namespaced XML in my document, for me it seems messy. In these cases I load
everything in a JSON object in the head of the page and process on domready.


On Wed, Jul 15, 2009 at 5:57 PM, Steve Onnis <st...@cfcentral.com.au> wrote:

>
> Seriously would you be waiting for HTML5 to be released?  How many years
> now
> has it been "in the works"?
>
> I don’t see the issue of using JS to store this information in the page
> itself.  Ondomready says the page dom has loaded but not everything on the
> page has loaded and rendered so any script you have on your pages will be
> available when domready is triggered.  If you have extended information for
> elements why not store it as JS objects?
>
> Steve
>
> -----Original Message-----
> From: Ryan Florence [mailto:rpflore...@gmail.com]
> Sent: Thursday, 16 July 2009 9:57 AM
> To: mootools-users@googlegroups.com
> Subject: [Moo] Re: custom attributes, (css) classes.. what to use?
>
>
> You nailed it all, so people can only really say ditto.  You obviusly
> know enough to make a good decision. Maybe thts why there aren't a lot
> of replies? I dunno.
>
> I personally use data-locked once I learned about html 5's implementation
> of
> it.
>
> Unless something that's locked has a lot to do with how it looks
> relative to other locked, unlocked elements--then I use classes like
> aaron.
>
> Right now I've got a page that stores a pyramid of children and
> parents on each element (network marketing chart tool). Classes would
> be a mess, the logic is already done server side (otherwise I'd use
> el.store) so I drop it all in data-children and data-parents.
>
> Valid html 5 is good enough for me.
>
>
>
> On 7/15/09, Rolf <plentyofr...@gmail.com> wrote:
> >
> > Hmm grmbl.. hoped on more responses and what others normally use :)
> > I guess I will stick to (css) classes now and move to data-*
> > attributes in a couple of months.
> > Using other custom attributes looks neat, but maybe just awkward,
> > since its not xml (and you kinda make it look like it with more custom
> > than standard attributes).
> >
> >
> > On Jul 14, 12:47 am, anutron <aa...@iminta.com> wrote:
> >> I use css classes. In my mind, saying that a div is of class "locked"
> >> makes
> >> sense to me. it's not <div css="locked"> it's class="locked" and the
> >> notion
> >> that I have numerous elements of that class makes sense to me, even if I
> >> don't style them. It makes it easy to style them later if I decide to,
> >> though.
> >> -aaron
> >>
> >> 2009/7/13 Fábio M. Costa (via Nabble) <
> >>
> ml-user+98816-1760363...@n2.nabble.com<ml-user%2b98816-1760363...@n2.nabble.com>
> <ml-user%2b98816-1760363...@n2.nabble.
> com>
> >>
> >>
> >>
> >>
> >>
> >> > on html5 there will be suport for custom attributes.
> >> > If the attribute starts with "data-" it will be valid.
> >> > Ex:
> >>
> >> > data-locked="true"
> >>
> >> > Its for sure what will be done for now on (if you want custom
> >> > attributes).
> >>
> >> > Fábio Miranda Costa
> >> > Solucione Sistemas
> >> > Front-End Engineer
> >> >http://meiocodigo.com
> >>
> >> > On Mon, Jul 13, 2009 at 6:32 PM, Rolf -nl
> >> >
> <plentyofr...@...<
> http://n2.nabble.com/user/SendEmail.jtp?type=node&node=325
> 3430&i=0<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=325%0A3430&i=0>
> >
> >> > > wrote:
> >>
> >> >> This has been talked about before here (search for "custom
> attributes"
> >> >> or "custom properties") but without some sort of conclusion. Could
> try
> >> >> and revive an old post, but ok... let's start a fresh one in 2009 ;).
> >>
> >> >> When working with javascript+moo you have the possibility to use
> store/
> >> >> retrieve for custom data "attached" to an element. This works dead
> >> >> easy and is a no brainer basically.
> >>
> >> >> But what do you do when you have an html page (either created
> >> >> dynamically or not) and you apply javascript logic to various
> elements
> >> >> after the page is loaded (ondomready) in an unobtrusive way, and you
> >> >> need some "start up" data from the elements to use store to begin
> >> >> with.
> >>
> >> >> A simple case: a div element that is locked or not (the locked state
> >> >> is just an example, dunno what's it for ;)).
> >>
> >> >> So you could add a custom attribute:
> >> >> <div locked="true"></div>
> >>
> >> >> Or you could use a class:
> >> >> <div class="locked"></div>
> >>
> >> >> Or you could use rel (but hey, it's already in use for other stuff),
> >> >> let's just assume all valid attributes are already "filled".
> >>
> >> >> Solutions:
> >> >> - The custom attribute is not valid. You can enhance a standard DTD
> >> >> and create your own custom one. Ok, sounds tedious.
> >> >> - You could just use the custom attribute and forget about
> validation.
> >> >> - You could just use classes.. easy.. but hey, those are meant for
> css
> >> >> styling really, so could be confusing.
> >>
> >> >> What do you advise? I used css classes to "describe" this sort of
> >> >> stuff, but now I think about just adding some custom attributes to
> set
> >> >> "start up data", as it creates better looking html, and I can add
> more
> >> >> detailed "start up data" (e.g. the desired fx transition and length
> >> >> for each element).. and just forget about w3c.
> >>
> >> >> Any input?
> >>
> >> > ------------------------------
> >> >  View message @
> >> >http://n2.nabble.com/-Moo--custom-attributes%2C-%28css%29-classes..-w.
> ..
> >> > To start a new topic under MooTools Users, email
> >> >
> ml-node+660466-1583815...@n2.nabble.com<ml-node%2b660466-1583815...@n2.nabble.com>
> <ml-node%2b660466-1583815...@n2.nabbl
> e.com>
> >> > 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/-Moo--custom-attributes%2C-%28css%29-classes..-
> w...
> >> Sent from the MooTools Users mailing list archive at Nabble.com.
>
> --
> Sent from Gmail for mobile | mobile.google.com
>
>

Reply via email to