> Ryan Gahl wrote:
>
>> So basically it's equating to "this.remove()".
>
> That's what we thought too, but for some reason I didn't think  
> those Element.*
> methods were added to each element.

I believe this is new for Prototype 1.5.

>> This is why creating global functions on a page has gone the way  
>> of the
>> dinosaurs (namespace collisions, or also called "polluting the global
>> namespace").
>
> I also thought Prototype had fixed all of these issues.

Prototype doesn't pollute the global namespace. It only extends HTML  
Element objects. If you call "remove()" from anywhere other than in  
the context of that element (such as from a <script> block), you will  
not get that function. It only appears to pollute the global  
namespace because JS automatically tries "this" as the first receiver  
for the "remove" method, because you are calling it from the onclick  
handler.

>
>> I recommend that you consider authoring all your home grown functions
>> inside your own namespace object to avoid these problems (with  
>> prototype
>> or any other library you end up using)...
>
> Yeah, we temporarily renamed the offending sub and we'll be making  
> project
> specific namespaces for them later on.

This is really the way to go for anything even moderately complicated.

Brad


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to