Hi there. I have very specific problem with Prototype. I''m getting selection of document and make a range from it. It''s simple. But I''m receiving not extended elements from <range.startContainer>. Ok. That''s fine. I would like to add prototype''s functions to this element. var container = range.startContainer; container = Element.extend(container); // NOT WORKS! // container still not have Prototype function, like childElements ;-( How to extend DOM element with Prototype properly? P.S. In any case, I can live without this feature, but, as for me, it''s better to use Prototype anywhere ;-) but not browser specific features ;-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
What is range.startContainer? Are you sure it''s an element? -Fred On Tue, Jul 1, 2008 at 8:50 AM, AlannY <m@alanny.ru> wrote:> > Hi there. I have very specific problem with Prototype. > > I''m getting selection of document and make a range from it. It''s > simple. But I''m receiving not extended elements from > <range.startContainer>. Ok. That''s fine. I would like to add > prototype''s functions to this element.-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yes, it''s an element var container = range.startContainer; alert(container.tagName); // OK This elements from iframe, where Prototype is not loaded, so, I want to extend element manually ;-) On Jul 1, 6:04 pm, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote:> What is range.startContainer? Are you sure it''s an element? > > -Fred > > On Tue, Jul 1, 2008 at 8:50 AM, AlannY <m...-I/IS3f7Pe4GHXe+LvDLADg@public.gmane.org> wrote: > > > Hi there. I have very specific problem with Prototype. > > > I''m getting selection of document and make a range from it. It''s > > simple. But I''m receiving not extended elements from > > <range.startContainer>. Ok. That''s fine. I would like to add > > prototype''s functions to this element. > > -- > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
This should work in browsers which expose "prototype" of host objects (e.g. any recent gecko, webkit, etc.): var r = document.createRange(); var proto = r.startContainer.constructor.prototype; for (var prop in Element.Methods) { if (!Object.isFunction(Element.Methods[prop])) continue; proto[prop] = Element.Methods[prop].methodize(); } -- kangax On Jul 1, 11:38 am, AlannY <m...-I/IS3f7Pe4GHXe+LvDLADg@public.gmane.org> wrote:> Yes, it''s an element > > var container = range.startContainer; > alert(container.tagName); // OK > > This elements from iframe, where Prototype is not loaded, so, I want > to extend element manually ;-) > > On Jul 1, 6:04 pm, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > What is range.startContainer? Are you sure it''s an element? > > > -Fred > > > On Tue, Jul 1, 2008 at 8:50 AM, AlannY <m...-I/IS3f7Pe4GHXe+LvDLADg@public.gmane.org> wrote: > > > > Hi there. I have very specific problem with Prototype. > > > > I''m getting selection of document and make a range from it. It''s > > > simple. But I''m receiving not extended elements from > > > <range.startContainer>. Ok. That''s fine. I would like to add > > > prototype''s functions to this element. > > > -- > > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks, will try soon ;-) On Jul 1, 11:54 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This should work in browsers which expose "prototype" of host objects > (e.g. any recent gecko, webkit, etc.): > > var r = document.createRange(); > var proto = r.startContainer.constructor.prototype; > > for (var prop in Element.Methods) { > if (!Object.isFunction(Element.Methods[prop])) continue; > proto[prop] = Element.Methods[prop].methodize(); > > } > > -- kangax > > On Jul 1, 11:38 am, AlannY <m...-I/IS3f7Pe4GHXe+LvDLADg@public.gmane.org> wrote: > > > Yes, it''s an element > > > var container = range.startContainer; > > alert(container.tagName); // OK > > > This elements from iframe, where Prototype is not loaded, so, I want > > to extend element manually ;-) > > > On Jul 1, 6:04 pm, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > > What is range.startContainer? Are you sure it''s an element? > > > > -Fred > > > > On Tue, Jul 1, 2008 at 8:50 AM, AlannY <m...-I/IS3f7Pe4GHXe+LvDLADg@public.gmane.org> wrote: > > > > > Hi there. I have very specific problem with Prototype. > > > > > I''m getting selection of document and make a range from it. It''s > > > > simple. But I''m receiving not extended elements from > > > > <range.startContainer>. Ok. That''s fine. I would like to add > > > > prototype''s functions to this element. > > > > -- > > > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---