<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>InfoSauce: Cross-browser onDOMContentLoaded</title>
    <link>http://blog.infosauce.com/articles/2005/09/24/cross-browser-ondomcontentloaded</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Cross-browser onDOMContentLoaded</title>
      <description>&lt;p&gt;&lt;a href="http://dean.edwards.name/weblog/2005/09/busted/"&gt;An elegant solution to the window.onload problem in Mozilla and IE.&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Client-side developers have long been frustrated by the shortcomings of window.onload, namely that it takes too long before firing if you want to attach scripts to rework the &lt;span class="caps"&gt;&lt;span class="caps"&gt;DOM&lt;/span&gt;&lt;/span&gt;, yet you have to wait before the &lt;span class="caps"&gt;&lt;span class="caps"&gt;DOM&lt;/span&gt;&lt;/span&gt; is parsed before manipulating it.&lt;/p&gt;

    &lt;p&gt;The &lt;a href="http://greasemonkey.mozdev.org/"&gt;Greasemonkey&lt;/a&gt; chaps solved the problem in Mozilla Firefox by uncovering the proprietary &lt;span class="caps"&gt;&lt;span class="caps"&gt;DOM&lt;/span&gt;&lt;/span&gt;ContentLoaded event.  Now not solving the problem in all browsers would be acceptable, since the other browsers could fall-back to the late firing window.onload, but it’s unrealistic to consider a solution for general web use that doesn’t at least take care of 90% of the market (Windows IE).&lt;/p&gt;

    &lt;p&gt;Ever since the &lt;a href="http://www.quirksmode.org/"&gt;&lt;span class="caps"&gt;PPK&lt;/span&gt;&lt;/a&gt; mentioned something in his blog about a way to solve it in IE and Mozilla(maybe Safari) in the &lt;a href="http://www.quirksmode.org/blog/archives/2005/06/you_shouldve_be_1.html"&gt;@media event entries&lt;/a&gt; a number of us have been very excited.  We’ve been &lt;a href="http://dean.edwards.name/weblog/2005/02/order-of-events/#comment2370"&gt;contemplating the best way to use this knowledge&lt;/a&gt;  involving complicated schemes requiring behaviors in &lt;span class="caps"&gt;IE &lt;/span&gt;(.htc files) and waiting for the mysterious “more details to come”&lt;/p&gt;

    &lt;p&gt;Well, the details have arrived, and it seems to make most of the scripts to handle an early firing domloaded event moot. Dean Edwards has delivered an &lt;a href="http://dean.edwards.name/weblog/2005/09/busted/"&gt;elegant solution to the window.onload problem in Mozilla and IE.&lt;/a&gt; If Safari/kthml, Opera, or any of the other browsers not covered by this are an important enough factor at your site, you might have to still think about an alternative like &lt;a href="http://www.brothercake.com/site/resources/scripts/domready/"&gt;brothercake’s domFunction.&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;We’re going to just stick with Dean Edwards solution for now and call it good, though.  Especially since, according to work done on the sIFR image replacement technique, &lt;a href="http://web-graphics.com/mtarchive/001635.php"&gt;Safari won’t layout the page properly until the images are loaded&lt;/a&gt; (read the 3rd comment).  This means having Safari wait for the window.onload is actually a feature.&lt;/p&gt;
</description>
      <pubDate>Sat, 24 Sep 2005 16:08:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:dacf94ae-5012-42e9-a8aa-00f5fa2c1fcb</guid>
      <author>Tim</author>
      <link>http://blog.infosauce.com/articles/2005/09/24/cross-browser-ondomcontentloaded</link>
      <category>CSS-DOM-standards</category>
    </item>
    <item>
      <title>"Cross-browser onDOMContentLoaded" by Tim Connor</title>
      <description>&lt;p&gt;He also added a method to handle IE the &lt;a href="http://dean.edwards.name/weblog/2005/09/busted2/" rel="nofollow"&gt;other way that has been discussed, using an HTC and ondocumentready,&lt;/a&gt; in case anyone has any problems with the “defer”  approach.&lt;/p&gt;</description>
      <pubDate>Sun, 25 Sep 2005 16:08:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:aa449f06-0ba6-450b-85ee-5a41d3171de2</guid>
      <link>http://blog.infosauce.com/articles/2005/09/24/cross-browser-ondomcontentloaded#comment-12</link>
    </item>
  </channel>
</rss>
