Jed, glad it helped show you were the problem is...and yes I suggest you file a ticket out of the bug you found so it doesn't get lost.
Just a couple of extra thoughts on this fix...the two lines I changed above are not enough...you will have realized by looking at it ! All those "document.body" and "document.documentElement" pointing to fixed objects should be changed to using the "this[0]" object to have meaningful values when working cross-frames. If it is necessary to have checks on the "body" in that part of the code, it should be stated clearly in the DOCS that dimensions should not be read/tried before they contain some useful value, eg: waiting for a ready or onload event (on the host object we are going to get dimensions from). The IE "readystatchange" event was the only one I could make to work to listen for when the parent is "ready". That's the reason I included it, alert should block processing anyway but I know some browser not being synchronous in that. So to be safe on the IE test. Diego On 8 Mag, 23:45, Jed Schmidt <t...@nslator.jp> wrote: > Thanks for checking on this, Diego. It seems there are still a lot of > current window/document assumptions in the jQuery code base. > > (Thanks also for the readystatechange information, though I can't > really put it to use because I'm using this in a bookmarklet.) > > Anyway, I'm very grateful for your working fixes, so let me know if > you think I should file a ticket, okay? > > Jed Schmidt > > On May 8, 11:13 am, Diego Perini <diego.per...@gmail.com> wrote: > > > Jed, > > forgot to say that you probably have to wrap those alert inside a > > "readystatechange" for IE or similar for other browsers. > > > You have to wait for all the elements to be loaded in the parent > > window before getting dimensions. > > > Here is the code I used to test: > > > <html> > > <head> > > <script type="text/javascript" src="jquery-1.3.2.js"></script> > > <script type="text/javascript"> > > > window.parent.document.onreadystatechange = function() { > > > if (window.parent.document.readyState == 'complete') { > > > alert( $( window.parent.document ) ); > > // CORRECT: alerts "[object Object]" > > > alert( $( window.parent.document.body ).height() ); > > // CORRECT: alerts "154" > > > alert( $( window.parent.document ).height() ); > > // ERROR: "Could not convert JavaScript argument arg 0" > > > alert( $( window.parent ).height() ); > > // ERROR: "Could not convert JavaScript argument arg 0" > > > } > > > }; > > > </script> > > </head> > > </html> > > > And it seems to me something is wrong with the numbers I get. As said > > above a full review of that code part is needed. > > > Diego > > > On 8 Mag, 06:34, Jed Schmidt <t...@nslator.jp> wrote: > > > > Hello all. > > > > I have two html documents. > > > > (1) parent.html > > > > <html> > > > <body> > > > <iframe src="child.html"/> > > > </body> > > > </html> > > > > (2) child.html > > > > <html> > > > <head> > > > <script type="text/javascript" src="http://ajax.googleapis.com/ > > > ajax/libs/jquery/1.3.2/jquery.min.js"></script> > > > <script type="text/javascript"> > > > alert( $( window.parent.document ) ); > > > // CORRECT: alerts "[object Object]" > > > > alert( $( window.parent.document.body ).height() ); > > > // CORRECT: alerts "154" > > > > alert( $( window.parent.document ).height() ); > > > // ERROR: "Could not convert JavaScript argument arg 0" > > > > alert( $( window.parent ).height() ); > > > // ERROR: "Could not convert JavaScript argument arg 0" > > > </script> > > > </head> > > > </html> > > > > As is visible from the code, I'm having trouble getting the height of > > > the document in the parent window. I can access the window, document, > > > and body of the parent without issue, but can only access the height > > > of the parent's body. An error is thrown when I try to access the > > > height of the parent window or document. > > > > Is there something I'm missing here, or does this need a ticket? > > > > Jed Schmidt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---