« Return to Thread: document.ready firing too early within iframe
Re: document.ready firing too early within iframe
@weepy,
in your last test4 the script and jquery itself are in the body...put
them in the head
section or the tests will drive us away...and defeat all your good
debugging... :)
I have kept this back, for cases like this...hope it solves for you
(and iframes in general).
I tested it working. Sorry for the compression but have no time to
pretty-print it.
var IECheck;
function IEContentLoaded(w,f){
// document has loaded (IE method 2) using behavior
var load=false,d=w.document,s=d.createStyleSheet().owningElement;
s.styleSheet.cssText='body{behavior:expression(IECheck(this));}';
var fire=function(e){if(!load)
{load=true;f.call(d,e);setTimeout(function()
{s.parentNode.removeChild(s);},10);}};
IECheck=function(n)
{try{d.documentElement.doScroll('left');n.runtimeStyle.behavior='none';}catch(e)
{return;}fire(null);};
}
Call this by passing window and function references.
I will let John implement a patch for current SVN
if he find it adequate, my knowledge ends here.
I just cut it out from my works on events see here (nearly at bottom
of file):
http://javascript.nwbox.com/NWEvents/examples/nwevents-20070916.js
It is a mix of the "doScroll" trick driven by an IE CSS Expression.
This is more complex but also more powerful, more precise
and less intrusive than the previous setTimout trick and
work also with "iframes". Just hope so at the moment...
Diego
On Oct 24, 1:01 am, weepy <jonah...@...> wrote:
> >I know that it would be great if we could use the same trick, but apparently the main "window" is not completely comparable in behavior with a "window" contained in an "iframe".
>
> yes i completely see what u mean. The old IE method seemed to work ok
> tho - what was the reason to move away from it ? perhaps in an iframe
> we could fall back to that ?!
>
> it's a shame not to have this as it means bye bye facebook for
> jquery !
>
> On Oct 23, 6:15 pm, Diego Perini <diego.per...@...> wrote:
>
> > @David,
> > all your comments about this are correct.
>
> > The original scope of the "doScroll" seems defeated inside "iframes".
> > I can't get the same error in an "iframe" as in a normal "window".
>
> > Using "body" may seems to work but I am nearly sure it does not...
> > I believe it just worked in the tests above because tests are
> > so short and because there are no images in them.
>
> > Diego
>
> > On Oct 23, 10:30 pm, David Serduke <davidserd...@...> wrote:
>
> > > Hmm, it seems to work now but for a different reason. Before the
> > > error.message with document.documentElement.doScroll was
>
> > > "The data necessary to complete this operation is not yet available."
>
> > > once the body change is in the error.message is
>
> > > 'document.body' is null or not an object
>
> > > In fact, with document.body the doScroll doesn't matter at all. You
> > > can replace the line with
>
> > > document.body.title;
>
> > > to get the same effect. Maybe that's fine, I don't know. But some
> > > more investigation should probably be done to see when it actually
> > > fires when graphics are loading and such. Unfortunately I have to go
> > > in to a meeting now so can't do it. I'll try later if I get the
> > > chance and if someone else hasn't done so yet.
>
> > > David
>
> > > On Oct 23, 12:25 pm, weepy <jonah...@...> wrote:
>
> > > >www.parkerfox.co.uk/tmp/test/test3.html
> > > > uses the svn jquery.js with Diego's alteration
>
> > > >www.parkerfox.co.uk/tmp/test/embed3.html
> > > > embeds test3.html in an iframe
>
> > > > Both work as expected in both IE7 and IE6 !
>
> > > > Was there any reason for using 'documentElement' ?
--~--~---------~--~----~------------~-------~--~----~
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@...
To unsubscribe from this group, send email to jquery-dev-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
« Return to Thread: document.ready firing too early within iframe
| Free embeddable forum powered by Nabble | Forum Help |