On May 15, 7:56 am, "Justin Perkins" <[EMAIL PROTECTED]> wrote:
> For the OP, 'attr' is clearly a bad choice, but all I would suggest is
> prefix/suffix like 'foo_attr' as opposed to just not using them
> altogether.
(accidentally replied directly to Justin. here it is again:)
I was just using 'attr' as an example meaning 'any attribute'. The
one I actually ran into trouble with was 'show', since Prototype
creates a show() method on every element, so everything was being
selected by the '*[show]' selector. Using
Object.isFunction(el.readAttribute('show')) works to filter the
elements down to the ones I want, but it's a lame solution since I'm
effectively looping through every element on the form.
It's clear to me now that 'show' is a bad name for the attribute, for
the reasons pointed out by Rob and Justin. But not using custom
attributes isn't a good solution for me, because I don't want to
include javascript on every element that should do something. Instead
I'd rather be able to use css selector to get a list of the elements
that want to register themselves for certain events. I'm using XHTML
strict mode, so it shouldn't be a problem for the browser. It works
great in FF and IE, except for the caveats already discussed.
Thanks for your help Rob, Justin, Anthyon and Kangax
byron
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---