Interesting. I guess it has to do with order of operations. It's first looking for the remove() function as a member of itself (the element), which it finds because of the prototype extension (prototype's Element functions must now be applied automatically to all new elements... I'm still on an old version due to lack of time for upgrading, but I think that's the case in the latest release)

So basically it's equating to "this.remove()".

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 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)...

var MPeters = {};

MPeters.remove = function() {...}

<input type="button" value="Delete" />

On 10/20/06, Michael Peters <[EMAIL PROTECTED]> wrote:

So prototype provides Element.remove(). In an html file I also have a function
named remove(). Why do these clash when I do the following:

  <input type="button" value="Delete" />

Instead of calling the remove function I defined, it actually removes the delete
button.

--
Michael Peters
Developer
Plus Three, LP


Athena Group, Inc.
Inquire: 1-920-955-1457
Blog: http://www.someElement.com
--~--~---------~--~----~------------~-------~--~----~
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