Matze
2007-Aug-02 14:03 UTC
Problems with Element.extend() on responseXML elements with IE
I have the following code in the "onSuccess" function of an Ajax.Request() call. The content type of the response message is "text/ xml". function interactionSuccess(request) { var root = $(request.responseXML.documentElement); ... So more or less I extend the root element of my XML response. This call triggers the onException callback. The exception is a "TypeError: Object doesn''t support this property or method" exception. I tracked it down to the following line in Element.extend(): element[property] = cache.findOrStore(value); The property in this case is "visible". This is with latest prototype release (1.5.1.1) and IE 6. Probably IE does not want to extend XML nodes with "visual" functionality. This problem is so obvious, that I am almost sure, that the error is on my side. Any help is greatly appreciated. If you need more information, just ask. Best regards, Matze --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Matt Foster
2007-Aug-02 16:00 UTC
Re: Problems with Element.extend() on responseXML elements with IE
Greetings Matze, That is an issue I have run into as well, my problem was I wanted to be able to collect elements via prototype''s CSS selector methods as its completely cross browser and i am already very familiar with it. http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/7ab88758e366a468/ac57ea038b8d6558?lnk=st&q=&rnum=46#ac57ea038b8d6558 I have devised a rather dirty hack to do what i wanted anyways. You can create an empty div or span, whatever. Then stuff the responseText into your dummy div and then parse from there, make sure to extend your div right off the bat var myDiv = Element.extend(document.createElement("div")); myDiv.innerHTML = request.responseText; myDiv.getElementsBySelectors("menu item"); Its dirty but it works! On Aug 2, 10:03 am, Matze <ma...-cIcoPB2EKMNBDgjK7y7TUQ@public.gmane.org> wrote:> I have the following code in the "onSuccess" function of an > Ajax.Request() call. The content type of the response message is "text/ > xml". > > function interactionSuccess(request) { > var root = $(request.responseXML.documentElement); > ... > > So more or less I extend the root element of my XML response. > > This call triggers the onException callback. The exception is a > "TypeError: Object doesn''t support this property or method" exception. > > I tracked it down to the following line in Element.extend(): > element[property] = cache.findOrStore(value); > > The property in this case is "visible". This is with latest prototype > release (1.5.1.1) and IE 6. Probably IE does not want to extend XML > nodes with "visual" functionality. > > This problem is so obvious, that I am almost sure, that the error is > on my side. > > Any help is greatly appreciated. If you need more information, just > ask. > > Best regards, > Matze--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Matze
2007-Aug-03 05:28 UTC
Re: Problems with Element.extend() on responseXML elements with IE
Hi Matt, thanks for your answer. Yes, this sounds really dirty :). But I will try if it works. On the other hand, I am thinking switching to JSON as suggested in the thread you refer to. I seem to bet on a dead horse with XML responses. Anyway, this helped me a lot. Best regards, Matze --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Matze
2007-Aug-03 07:09 UTC
Re: Problems with Element.extend() on responseXML elements with IE
Just for your interest. After I converted response to JSON, my use case works now in every browser I tested. As a side effect the new code is much cleaner now. Thanks again for the inspiration. Best regards, Matze --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---