deniz.adrian-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2007-Jun-05 10:36 UTC
extended methods in IE
Hey, I have a problem using prototype with internet explorer 7. it seems like the extended methods for "Element" don''t work right. [code] var div= document.createElement("div"); /* drops a "[object-error]" */ div.addClassName("foo"); /* works, but is not really nice... */ Element.addClassName(div, "foo"); document.body.appendChild(div); [/code] Could it be that the extended methods are only available to objects already append''ed to the page? Any suggestions appreciated! regards deniz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
IE doesn''t prototype dom elements like firefox. If you wrap your createElement in a $ or use the new Element method in 1.5.2(i think, which isn''t realised yet) then the element will be extended. [code] var div= $(document.createElement("div")); /* drops a "[object-error]" */ div.addClassName("foo"); /* works, but is not really nice... */ Element.addClassName(div, "foo"); document.body.appendChild(div); [/code] On 6/5/07, deniz.adrian-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org <deniz.adrian-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > > Hey, > > I have a problem using prototype with internet explorer 7. it seems > like the extended methods for "Element" don''t work right. > > [code] > > var div= document.createElement("div"); > > /* drops a "[object-error]" */ > div.addClassName("foo"); > > /* works, but is not really nice... */ > Element.addClassName(div, "foo"); > > document.body.appendChild(div); > > [/code] > > Could it be that the extended methods are only available to objects > already append''ed to the page? > Any suggestions appreciated! > > regards > deniz > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
deniz.adrian-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2007-Jun-05 11:29 UTC
Re: extended methods in IE
Hey Gareth, thank you for the quick response. if i use $(document.create....); it works... great piece of code! regards deniz On 5 Jun., 12:38, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> IE doesn''t prototype dom elements like firefox. > If you wrap your createElement in a $ or use the new Element method in > 1.5.2(i think, which isn''t realised yet) then the element will be > extended. > > [code] > > var div= $(document.createElement("div")); > > /* drops a "[object-error]" */ > div.addClassName("foo"); > > /* works, but is not really nice... */ > Element.addClassName(div, "foo"); > > document.body.appendChild(div); > > [/code] > > On 6/5/07, deniz.adr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org <deniz.adr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > Hey, > > > I have a problem using prototype with internet explorer 7. it seems > > like the extended methods for "Element" don''t work right. > > > [code] > > > var div= document.createElement("div"); > > > /* drops a "[object-error]" */ > > div.addClassName("foo"); > > > /* works, but is not really nice... */ > > Element.addClassName(div, "foo"); > > > document.body.appendChild(div); > > > [/code] > > > Could it be that the extended methods are only available to objects > > already append''ed to the page? > > Any suggestions appreciated! > > > regards > > deniz--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---