kangax,

Thanks for the quick reply.  Attribute differentiation is obviously
less crucial than the tag differentiation already supported by
Element.addMethods().  I can understand the inherent complexity in the
element extension mechanism, so I will gladly accept "no" as the
answer to my question.  However, I can see the following advantages to
tag type (attribute) differentiation:

1. Better use (i.e less consumption) of memory by not extending
certain types of tags with extensions that really are not meant to
operate on those types of tags (e.g. TEXT versus RADIO).

2. Prevention of extensions that really are not meant to operate on
those types of tags (e.g. TEXT versus RADIO) from being called and
yielding unexpected results or even JavaScript errors.   Of course, it
could be argued that each extension should be "smart enough" to hold
its own, but I think it could be argued either way.

On Feb 7, 4:59 pm, kangax <[EMAIL PROTECTED]> wrote:
> Nope - that is not supported.
> Element extension mechanism has to go through quite some pain to do
> what it does now. Supporting attributes would make things even more
> complicated. Besides, I'm not seeing practical advantage for such
> narrow differentiation.
>
> Best,
> kangax
>
> On Feb 7, 5:40 pm, broberts <[EMAIL PROTECTED]> wrote:
>
> > I understand that.  However, what if I only want to extend a specific
> > type of INPUT tag (e.g. RADIO, CHECKBOX or TEXT) and not every type of
> > INPUT tag?
>
> > On Feb 7, 4:30 pm, kangax <[EMAIL PROTECTED]> wrote:
>
> > > Just specify the tagName:
>
> > > Element.addMethods('input', {
> > >   isNumeric: function(element) {
> > >     return /\s*\d+\s*/.test($F(element));
> > >   }
>
> > > })
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to