www.webdeveloper.com
Results 1 to 4 of 4

Thread: DOM Ready

  1. #1
    Join Date
    Oct 2010
    Posts
    36

    DOM Ready

    This is a DOM Ready function I wrote, I think it's pretty small and simple but works pretty well. Tested in IE 8, Chrome, and Opera. All working 100%

    function domReady(){
    if(d.body){
    //DOM is ready, execute whatever you want here
    }else{
    setTimeout("domReady()",10);
    }
    };
    domReady();
    What do you think?

    PS: Wrapped in "quote" for better reading

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Too simple to be bullet-proof or load fast enough in all browsers: http://code.google.com/p/domready/downloads/list


    PS: Wrapped in "quote" for better reading
    Wrapped in "code" would be more appropriate.
    http://www.webdeveloper.com/forum/misc.php?do=bbcode
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Code:
    if(d.body)
    Never heard about the DOM node called d

  4. #4
    Join Date
    Oct 2010
    Posts
    36
    load fast enough
    That's exactly why it's too simple, the less code, the faster it loads. Besides, try testing it in any browser, I'm really eager to find one that doesn't work (so I can fix it).

    Never heard about the DOM node called d
    Whoops! I forgot to change that! The thing is that I point the document object to the variable d so the code size is smaller. So I'll replace it with document

    Wrapped in "code" would be more appropriate.
    I didn't say wrapping in "quote" was appropriate, just easier to read.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles