Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4100550
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:34:54+00:00 2026-05-20T20:34:54+00:00

The question is regarding the http://labjs.com – an awesome library for non-blocking JavaScript loading

  • 0

The question is regarding the http://labjs.com – an awesome library for non-blocking JavaScript loading and dependencies managing.

I’ve read the docs, but I must be too tired or something – I couldn’t find anything regarding DOM ready event. Are the scripts executed after the DOM’s ready or not?

Perhaps if I do:

$LAB.script('my-library.js').wait(function(){ 
  // interacting with DOM 
});

Will it be safe? Or should I use some kind of $(function() {}) etc.?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:34:54+00:00Added an answer on May 20, 2026 at 8:34 pm

    Any script loader, by default, acts to unblock script loading from the page’s DOM-ready and onload events, at least by intent/definition.

    So, the straightforward answer is, NO, LABjs will not block script execution until DOM-ready. Some scripts loaded by LABjs may run before DOM-ready, while others may run after DOM-ready.

    If you truly have cases where your code needs to wait for the DOM, you should use a framework like jQuery and use its built-in DOM-ready wrapper $(document).ready(...) to make that logic DOM-ready-safe.

    However, there are many cases where people think they need to wait for DOM-ready, when they really don’t:

    1. Most people conflate DOM-ready with “all scripts are done loading”. If you are simply waiting for DOM-ready because you need to ensure that all your scripts have loaded, this is a mistaken and incorrect assumption to be making. Instead, use the facility of your script loader to determine when all scripts are loaded, and run them at the appropriate time, regardless of the DOM loading. With LABjs, this is as simple as having all your scripts in a single $LAB chain, and having a final .wait() at the end of the chain — you can be assured that your code in that .wait() callback will not run until all the scripts have loaded and run.

    2. Most people think they need to wait for DOM-ready to do things like attaching event handlers, or firing off Ajax requests. This is also an incorrect assumption. If your code simply queries the DOM for elements to attach event handlers to, or if you are doing nothing with the DOM at all, but are instead making Ajax calls, don’t wrap your logic in a DOM-ready wrapper.

    3. On the flip side, many people assume that if your code runs at the end of the body tag, then you don’t need to wait for DOM-ready. Wrong. DOM-ready is DOM-ready, regardless where your code is specified.

    In general, the only time your code really needs to be wrapped in a DOM-ready wrapper is if it is going to modify the DOM. Otherwise, don’t wait for DOM-ready to run your code. Be smart about what is wrapped and what isn’t.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question regarding a window style hexadecimal. According to http://support.microsoft.com/kb/111011/en-us , 0x16CF0000
Following my question regarding a .NET YAML Library ... as there doesn't seem to
Again I have a question regarding this plugin: http://t.wits.sg/2008/06/20/jquery-progress-bar-11/ What I want to achieve
This is a question regarding the timezone specified in the Expires and Last-Modified HTTP
Right now I'm reading this article regarding Java Garbage Collection: http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html ? Here is
I have a question regarding JavaScript and methods by which its code can be
I have a question regarding the javascript includes and css includes. What happens if
I am reading this http://docs.python.org/dev/library/multiprocessing.html In particular this p = multiprocessing.Process(target=time.sleep, args=(1000,)) I tried
Question regarding how to setup dbase relationships (newbie, this may be trivial) Followed the
A question regarding a DB development project. The database already exist and is rather

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.