Brandon,
thanks so much for the addition.

I will leave part of the code I tried to fix here, maybe you can see
something different from your impl.

        jQuery.fn[ type ] = function( size ) {

                var doc, root, value;
                doc = this[0].ownerDocument || this[0].document || this
[0];
                root = doc.compatMode == "CSS1Compat" ?
doc.documentElement : doc.body;
                value =
                        // Get window width or height
                        'frameElement' in this[0] ?
                                root["client" + name] ||
                                root["offset" + name] :
                        // Get document width or height
                        'documentElement' in this[0] ? Math.max(
                                root["client" + name],
                                root["scroll" + name],
                                root["offset" + name]) :

                        // Get or set width or height on the element
                        size === undefined ?
                                // Get width or height on the element
                                (this.length ? jQuery.css( this[0],
type ) : null) :

                                // Set the width or height on the
element (default to pixels if value is unitless)
                                this.css( type, typeof size ===
"string" ? size : size + "px" );
                doc = root = null;
                return value;
        };

Have the best.


Diego


On 9 Mag, 01:37, Jed Schmidt <[email protected]> wrote:
> That's great news, Brandon, thanks for your hard work! This will
> surely make doing iframe development much more reliable.
>
> Jed Schmidt
>
> On May 8, 4:28 pm, Brandon Aaron <[email protected]> wrote:
>
> > Sorry for the late reply. No need to file a ticket for this as it has
> > already been fixed in SVN and will be in 1.3.3. The .css(), .width(), and
> > .height() methods now work for other windows and documents.
> > --
> > Brandon Aaron
>
> > On Fri, May 8, 2009 at 4:45 PM, Jed Schmidt <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to