That line is intentional. It's for cases where jQuery is being dynamically loaded and you wish to execute the ready event immediately. **We make no guarantees about this happening in all the browsers that we support.** (Namely this is because of the problem that you mentioned in Firefox < 3.6.) As of right now this is a forward-looking addition to the time in which it'll work in all browsers - but it doesn't negatively affect the code otherwise.
--John On Tue, Nov 17, 2009 at 11:12 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > John I am not that familiar with github yet, I did a mess wven with last > PureDom for taskspeed so please forgive me ... but there is another problem > there, if I am not wrong. > > Line 826 of the same file: > > > > // Catch cases where $(document).ready() is called after the > // browser event has already occurred. > if ( document.readyState === "complete" ) { > > return jQuery.ready(); > > We got a problem here, Firefox < 3.6 (beta included) does not have the > readyState proeprty. > Everybody else seems to have it. There is a massive bug in MDC for this > missed property which apparently now is into HTML5 > > For an event handler I am creating for other reasons I have solved in this > way: > > if(document.readyState == null && > document.addEventListener)(function(){ > document.addEventListener("DOMContentLoaded", function > DOMContentLoaded(){ > document.removeEventListener("DOMContentLoaded", > DOMContentLoaded, false); > document.readyState = "complete"; > }, false); > document.readyState = "loading"; > })(); > > With above code we are sure that if jQuery or a plugin is evaluated after > the onload event (lazy load) Firefox will directly fire the events as every > other browser does. > > being document a first class node without attributes, above snippet will > make readyState behavior a bit more consistent. > > Please let me know if I have missed something in the bindReady stuff. > > Regards > > > > On Tue, Nov 17, 2009 at 3:46 PM, John Resig <jere...@gmail.com> wrote: > >> Good suggestion, just landed it: >> >> http://github.com/jquery/jquery/commit/3a23a5c17dd0522da06db8f36890f134f9004de6 >> >> You should mention stuff like this as comments on the commits - and file >> follow-up patches through Github. It makes it super-easy to manage (on my >> end, at least). >> >> --John >> >> >> On Tue, Nov 17, 2009 at 6:33 AM, Andrea Giammarchi < >> andrea.giammar...@gmail.com> wrote: >> >>> AFAIK top window frameElement returns null and not undefined, as is for >>> document.body when not present yet. >>> >>> Moreover we can use the JavaScript weird case where null == undefined but >>> while null is static, undefined can be redefined or in any case it needs to >>> be discovered in the scope chain. >>> >>> On line 857 of this event.js >>> http://github.com/jquery/jquery/blob/master/src/event.js >>> >>> I can spot this: >>> >>> toplevel = window.frameElement === undefined; >>> >>> In few words and at least in my IE8 that doScroll try/catch is never >>> performed at all since the condition >>> >>> if( document.documentElement.doScroll && toplevel) >>> >>> cannot be true. >>> >>> Is that file part of the release? I did not check but you can quickly fix >>> via >>> >>> toplevel = window.frameElement == null; >>> >>> Regards >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "jQuery Development" group. >>> To post to this group, send email to jquery-...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> jquery-dev+unsubscr...@googlegroups.com<jquery-dev%2bunsubscr...@googlegroups.com> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/jquery-dev?hl=. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jQuery Development" group. >> To post to this group, send email to jquery-...@googlegroups.com. >> To unsubscribe from this group, send email to >> jquery-dev+unsubscr...@googlegroups.com<jquery-dev%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/jquery-dev?hl=. >> > > -- > You received this message because you are subscribed to the Google Groups > "jQuery Development" group. > To post to this group, send email to jquery-...@googlegroups.com. > To unsubscribe from this group, send email to > jquery-dev+unsubscr...@googlegroups.com<jquery-dev%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/jquery-dev?hl=. > -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@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=.