Eric Harrison wrote:
> I'm fairly certain that in Prototype 1.5.0_rc0 and up, you just have
> to call Element.addMethods(). The
> Object.extend(Element,Element.Methods); is redundant. Every time
> Element.addMethods() is called, all elements accessed via $() (or any
> other prototype specific element selector (like Event.element(event),
> etc) all will have their own methods applied as well as any methods
> you've provided via Element.addMethods()
>
> My example:
>
> Element.addMethods({
> visible: function(element) {
> return $(element).getStyle('display') == 'none' ? false : true;
> }
> });
>
> That's all it takes in our scripts to have the visible() method of an
> element be overwritten to actually use the getStyle() method instead
> of the manual .style.display attribute.
Prototype 1.5.0_rc1 already has that method:
Element.Methods = {
visible: function(element) {
return $(element).style.display != 'none';
},
...
Surely a method that returns the value of the element's CSS display
property should be called "display"? Or 'elementDisplayNone'?
The name is misleading, not only does it not test the visibility
property, it doesn't actually test if the element is visible or not.
--
Fred
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---