On Thursday 03 September 2009 06:51:19 kangax wrote: > On Sep 2, 2:23 pm, Mojito <tokyot...@gmail.com> wrote: > > What's the Prototyped syntax equivalent of: > > > > window.frames['iFrameID'].document.getElementById > > ('elementInsideIFrame'); > > Current version of Prototype doesn't really support programmatic > context extension (such as that of `window.frames['iframeID']` in your > example). Instead, Prototype initialization for a given frame is > usually accomplished by inserting script referencing prototype.js > directly into that frame's document. Once loaded, parsed and executed, > that script automatically extends frame's context with all of the > prototype goodness. It's then possible to do something like - > `window.frames['iframeID'].$$('...')`. > > Also, don't forget that most of the Prototype DOM abstractions do not > play well with elements originating from different documents (since > internally, Prototype practically always operates on "original" > document - that which exists in a context where Prototype was > initialized, not an actual document of an element).
Yes, It gets really confusing sometimes. "So... which document is this Node from?" "Is $ here the $ using the top frame's document or the iframe's document?" "Ok, so this node is from the other document, which also loads Prototype, but when I extended it with $ I added in functions which were scoped in this document so it breaks, but since Prototype extends Element in Firefox, if I hadn't have done that, it might have worked" Some of this could be fixed if Prototype used element.ownerDocument instead of just document (implicitly, window.document) for the Element methods. Any support for this change? Jim -- Jim my wiki ajaxification thing: http://wikizzle.org my blog: http://jimhigson.blogspot.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to firstname.lastname@example.org To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---