I am scratching my head about this one... I have a script that is trying to remove a <SELECT> node from the DOM using the remove() function. It chokes when the script runs, though. To be more specific, Firefox is kicking out the following error: uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://127.0.0.1/javascript/selectTest.html :: go :: line 85" data: no] It can be very easily replicated with the following: <a href=''javascript:$("select").remove();''>run</a> <select id=''select'' name=''browser''> <option value=''ie''>IE</option> <option value=''ff''>FireFox</option> <option value=''o''>Opera</option> </select> I am using a build from the latest SVN version. Does anyone have any ideas? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Is ''select'' a reserved word perhaps? -justin --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Element.remove(''select'') should work --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 29, 5:32 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Element.remove(''select'') should workThat did the trick, thank you For anyone interested, I also managed to figure out why the method doesn''t work as I was using it. It turns out that Select nodes have a pre-existing function named "remove" used to manipulate the list of options in the menu. Prototype detects that the function already exists and doesn''t over-write it. Kind of a pain, but the function can easily be overwritten in favor of the Prototype function. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I believe this should be mentioned in the docs. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 29, 2008 10:04 PM, Nycto <NyctoFixer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> For anyone interested, I also managed to figure out why the method > doesn''t work as I was using it. It turns out that Select nodes have a > pre-existing function named "remove"Ahh, good catch. Thanks for posting the follow-up. -justin --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hmmm... my reply didn''t post for some reason (most likely because of some idiot mistake on my part :p ) On Jan 29, 8:29 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I believe this should be mentioned in the docs.I took a look through the docs and didn''t see this caveat mentioned. I have submitted a ticket: http://dev.rubyonrails.org/ticket/10962 After thinking about it, though, it seems to me that this is something that should be accounted for in the library, and not simply documented as a gotcha. Because of this, one cannot call the "remove" method on an anonymous node without the possibility of an error being thrown. One option would be to create an alias for the "remove" function. Another might be to rename the native remove function and replace it with the Prototype method. Just a though --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 30, 2008 2:03 PM, Nycto <NyctoFixer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Another might be to rename the native remove function and replace it > with the Prototype method.I''m not positive, but I think that would be a no-go in IE. -justin --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I''m not saying it''s the best solution, but this code works for me in FF, IE6, IE7 and Opera: <script type=''text/javascript''> function go () { $("select").remove(); } Event.observe(window, ''load'', function () { $(''select'').removeOption = $(''select'').remove; $(''select'').remove = Element.remove.methodize(); $(''select'').removeOption(0); }); </script> <a href=''javascript:go()''>run</a> <select id=''select'' name=''browser''> <option value=''ie''>IE</option> <option value=''ff''>FireFox</option> <option value=''o''>Opera</option> </select> It is obviously not exactly how it would work in the prototype library, but it shows that the function can be successfully aliased and changed. On Jan 30, 12:10 pm, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 30, 2008 2:03 PM, Nycto <NyctoFi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Another might be to rename the native remove function and replace it > > with the Prototype method. > > I''m not positive, but I think that would be a no-go in IE. > > -justin--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Maybe Matching Threads
- getDimensions() fails for elements with ancestors with display: none
- Styling an Anchor Tag With Prototype
- inheriting static/class methods with new prototype.js class creation
- Scriptaculous Help (page exit effects)
- TypeError : transport.responseText has no properties