Hi Hassan,

On Wed, 2009-02-18 at 09:50 -0800, Hassan Schroeder wrote:
> On Wed, Feb 18, 2009 at 8:38 AM, bill walton <[email protected]> wrote:
> 
> > We've got three 'identifiers' to work with: id, name, and class.  CSS
> > uses id and class.  Javascript uses id and name.  So, to keep the issues
> > as separate as possible, I try to avoid using id for CSS.
> 
> Huh??  JavaScript offers various ways to access elements of the
> DOM, and 'class' is certainly one of them. 

I probably should have said JS libraries, specifically the Prototype /
Scriptaculous libraries, which is what I was thinking of.  I think it's
accurate to say that in those libraries, identification via id / name
predominates.

> Can you be more specific
> about what "issues" you're trying to "keep separate"?

My focus at this point is refactoring an Ajax application.  My CSS has
gotten out of hand size-wise, primarily as a result of using id to
identify elements.  As I refactor back to classes, every modification /
elimination of id in the html requires examination / testing of the JS
to make sure I haven't eliminated a needed reference. The same isn't
required when making changes to classes.

> 
> And if you have *one* of an element that needs styling, why not use
> an ID to target your CSS?
> 

Absolutely agree.  The OP asked about guidelines.  Just trying to
communicate what I've found helpful.  Sorry if I struck a nerve.

Best regards,
Bill


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to