[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-26 Thread Michael Geary
If that's true, shouldn't my test case fail in Firefox? http://mg.to/test/jquery/dynamic-nightly/jquery-dynamic-onload.html The page does use a nightly from several weeks ago and I haven't tested with a more recent version - but hopefully it hasn't gotten broken since then. -Mike On Mon, Oct 26

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-26 Thread Server Herder
Under the latest nightly release bindReady() first checks for document.readyState === 'complete'. Browsers that support the readySTate property will then execute the jQuery.ready() function and this case will be handled properly. IE, Safari and Chrome all appear to have this; however, Firefox do

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-09 Thread Michael Geary
It works fine for me in the current nightly. Here are a couple of test cases: http://mg.to/test/jquery/dynamic-nightly/jquery-dynamic.html http://mg.to/test/jquery/dynamic-nightly/jquery-dynamic-onload.html The first one loads jQuery when you click a button; the second does it from an onload att

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-09 Thread Sasha Sklar
Is this known to be fixed in the nightly? I wrote a quick test, seems like document.ready still doesn't fire if jQuery is loaded after DOM Ready: // make sure dom ready has already occured by attaching an event to old school window.onload window.onload = function() { console.log('window o

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-09 Thread Sasha Sklar
I came across this issue while looking at LAB.js. Is this known to be fixed in latest nightly? From what I can tell document.ready still won't fire if jQuery is loaded after DOM Ready has occurred. Here's my test code: // make sure dom ready has already happened by attaching an event to old schoo

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-08 Thread Michael Geary
Failing to run the document ready functions is a bug in jQuery 1.3.2 that is fixed in the current svn. It now calls document.ready listeners even if you load jQuery and subsequent document ready functions dynamically. At least I *assume* that it's a bug that was fixed, and not just an accidental i

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-08 Thread KeeganWatkins
Hi Ryan, The reason you are having problems is likely due to the way jQuery determines DOM readiness. As noted above, if functions are passed to $ () or $(document).ready() after the DOM has loaded, they are executed immediately. This produces the behavior you are expecting. But when jQuery loads

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-08 Thread Ryan Crumley
Rob, Point taken about using onLoad for a script tag possibly not being supported. In this case however that part of the code is working fine. The issue I am having is related to jQuery being added to a page after the page has completed loading. When this happens ready listeners are never execute

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-08 Thread Ryan Crumley
> But that's the issue, It's way way waaay too late at this point, as > the document was "ready" (and fired that event) once the HTML was sent > to the browser and ready for DOM manipulation, which was forever ago > at this point (right from the docs: "Binds a function to be executed > whenever th

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-07 Thread RobG
On Oct 8, 10:04 am, Ryan Crumley wrote: > I am experiencing unexpected behavior using $(document).ready() on a > page where I inject jQuery after the page has loaded and then attach > listeners to the ready event. The ready() event is never called using > Firefox and Safari however it is called

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-07 Thread MorningZ
You've got a super serious flaw in your logic 1) It appears you have this sitting on the page... no JS has been "loaded" or executed at this point 2) someone clicks the button, you call "loadjquery" 3) in there, you seemingly want to add the script tag to the , at which point you seem to *ho

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-07 Thread Ryan Crumley
I put together that example because it is the most simple piece of code I could create to reproduce the problem. My real process is actually more complicated and there are real gains to be had for using document.ready() in this way. Consider the following two cases: 1. If instead of dynamically l

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-07 Thread MorningZ
While i don't know the answer to your strange issue... as "document.ready" fires when, well, when the document is ready i do wonder: why the complexity? You aren't gaining anything except on the first load of the library (and then the browser caches it), heck even that first load is probably