<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Safari 3: Onload firing, and bad timing</title>
	<atom:link href="http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Sat, 20 Mar 2010 13:30:04 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Penny</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-259332</link>
		<dc:creator>Penny</dc:creator>
		<pubDate>Tue, 27 Nov 2007 03:47:31 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-259332</guid>
		<description>Sorry, it stripped my bit of code - here it is minus special characters and quotes

body onLoad=this.open(blockNav.asp?sectionID=8, navigation)</description>
		<content:encoded><![CDATA[<p>Sorry, it stripped my bit of code &#8211; here it is minus special characters and quotes</p>
<p>body onLoad=this.open(blockNav.asp?sectionID=8, navigation)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Penny</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-259331</link>
		<dc:creator>Penny</dc:creator>
		<pubDate>Tue, 27 Nov 2007 03:45:36 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-259331</guid>
		<description>I have had problems with a website that uses iframes to display dynamic content not loading properly in safari. Initial load is triggered by the following:



navigation is an iframe and blocknav gets the content from the database and does its own onload in its body tag to load the content iframes.

Would the issue in this discussion be the reason for the problem? If so, is there a workaround?</description>
		<content:encoded><![CDATA[<p>I have had problems with a website that uses iframes to display dynamic content not loading properly in safari. Initial load is triggered by the following:</p>
<p>navigation is an iframe and blocknav gets the content from the database and does its own onload in its body tag to load the content iframes.</p>
<p>Would the issue in this discussion be the reason for the problem? If so, is there a workaround?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 000</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-252516</link>
		<dc:creator>000</dc:creator>
		<pubDate>Tue, 10 Jul 2007 06:03:16 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-252516</guid>
		<description>Why Safari 3 causes mor eproblem?</description>
		<content:encoded><![CDATA[<p>Why Safari 3 causes mor eproblem?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-252394</link>
		<dc:creator>Ian</dc:creator>
		<pubDate>Fri, 06 Jul 2007 18:48:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-252394</guid>
		<description>Webkit doesn&#039;t seem to wait for much of anything before firing onLoad according to this open bug report:

http://bugs.webkit.org/show_bug.cgi?id=13241

That seems to contradict somewhat with what Dave Hyatt states above (though obviously not much detail in the report), and sounds as if it would actually skew results...</description>
		<content:encoded><![CDATA[<p>Webkit doesn&#8217;t seem to wait for much of anything before firing onLoad according to this open bug report:</p>
<p><a href="http://bugs.webkit.org/show_bug.cgi?id=13241" rel="nofollow">http://bugs.webkit.org/show_bug.cgi?id=13241</a></p>
<p>That seems to contradict somewhat with what Dave Hyatt states above (though obviously not much detail in the report), and sounds as if it would actually skew results&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maciej Stachowiak</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-252247</link>
		<dc:creator>Maciej Stachowiak</dc:creator>
		<pubDate>Tue, 03 Jul 2007 06:51:56 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-252247</guid>
		<description>The scrolling forced by the iBench isn&#039;t really related to the layout delay either, it&#039;s there to force painting (which I believe all browsers can defer until after onload and in some cases will skip entirely on a fast benchmark). Yes, it does overweight painting as a result (since you paint twice), but I don&#039;t think this hurts other browsers more than Safari.</description>
		<content:encoded><![CDATA[<p>The scrolling forced by the iBench isn&#8217;t really related to the layout delay either, it&#8217;s there to force painting (which I believe all browsers can defer until after onload and in some cases will skip entirely on a fast benchmark). Yes, it does overweight painting as a result (since you paint twice), but I don&#8217;t think this hurts other browsers more than Safari.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Rowe</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-252228</link>
		<dc:creator>Mark Rowe</dc:creator>
		<pubDate>Mon, 02 Jul 2007 15:00:15 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-252228</guid>
		<description>&quot;that just means you are penalising other browsers to make up for an unexpected behaviour in Safari, since scrolling can take a long time on some pages when layout was otherwise fast.&quot;

Keep in mind that iBench is a third-party benchmark suite originally developed by Ziff Davis Media.  It was under development before Safari even existed, so to say that the benchmark is designed to penalise other browsers due to a quirk in Safari&#039;s behaviour is quite far-fetched.  The design of the benchmark is to ensure that what is being timed is consistent across browsers.</description>
		<content:encoded><![CDATA[<p>&#8220;that just means you are penalising other browsers to make up for an unexpected behaviour in Safari, since scrolling can take a long time on some pages when layout was otherwise fast.&#8221;</p>
<p>Keep in mind that iBench is a third-party benchmark suite originally developed by Ziff Davis Media.  It was under development before Safari even existed, so to say that the benchmark is designed to penalise other browsers due to a quirk in Safari&#8217;s behaviour is quite far-fetched.  The design of the benchmark is to ensure that what is being timed is consistent across browsers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Hyatt</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-252048</link>
		<dc:creator>Dave Hyatt</dc:creator>
		<pubDate>Wed, 27 Jun 2007 15:52:16 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-252048</guid>
		<description>All you have to do is add document.body.offsetLeft, and you&#039;ll force Safari to do a layout (and get results that are comparable to Firefox).  The differences really just boil down to lazy layout and lazy image decoding.</description>
		<content:encoded><![CDATA[<p>All you have to do is add document.body.offsetLeft, and you&#8217;ll force Safari to do a layout (and get results that are comparable to Firefox).  The differences really just boil down to lazy layout and lazy image decoding.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TarquinWJ</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-251957</link>
		<dc:creator>TarquinWJ</dc:creator>
		<pubDate>Mon, 25 Jun 2007 19:56:06 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-251957</guid>
		<description>Thanks Dave, I have corrected the statement about images loading to be decoding instead.

Now your point about iBench (I didn&#039;t mention that in the original article, but since you have mentioned it I added it) - that just means you are penalising other browsers to make up for an unexpected behaviour in Safari, since scrolling can take a long time on some pages when layout was otherwise fast - opacity and fixed backgrounds in Opera come to mind here. It also means you are no longer testing just load&amp;display times, so iBench does not represent what it is supposed to represent.

Sorry, but that is a cludge, not accuracy.

Your comments about when onload fires are valid (yes, it&#039;s good for efficiency in some cases), but that does not contradict anything I have said about benchmark testing. The article was about benchmarking, after all.</description>
		<content:encoded><![CDATA[<p>Thanks Dave, I have corrected the statement about images loading to be decoding instead.</p>
<p>Now your point about iBench (I didn&#8217;t mention that in the original article, but since you have mentioned it I added it) &#8211; that just means you are penalising other browsers to make up for an unexpected behaviour in Safari, since scrolling can take a long time on some pages when layout was otherwise fast &#8211; opacity and fixed backgrounds in Opera come to mind here. It also means you are no longer testing just load&amp;display times, so iBench does not represent what it is supposed to represent.</p>
<p>Sorry, but that is a cludge, not accuracy.</p>
<p>Your comments about when onload fires are valid (yes, it&#8217;s good for efficiency in some cases), but that does not contradict anything I have said about benchmark testing. The article was about benchmarking, after all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Hyatt</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-251753</link>
		<dc:creator>Dave Hyatt</dc:creator>
		<pubDate>Wed, 20 Jun 2007 07:16:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-251753</guid>
		<description>With respect, Mark is actually wrong on several points.

Yes, onload does fire earlier in Safari than in other browsers.  However it does not fire until all resources have been loaded.  We do delay doing the first layout (if the page loaded quickly enough) until after the onload fires.  This is simply common sense, since to do otherwise is to waste time doing relayouts as a result of the changes that would be executed by a typical onload handler.

Note that Firefox does not defer its first layout until after onload, but - like Safari - it also defers painting until after the onload has fired.  Neither browser will paint until after the onload if the page loads quickly enough.  (I ought to know.  I implemented this in Firefox.)

Regarding images, Safari does wait until the image data has been fetched before firing onload, but it does not decode images until they actually paint.  Again this is common sense to keep memory usage down (and is especially useful on mobile devices).  Most other browsers are not very smart in this respect and aggressively decode images before firing the onload.  This is neither necessary nor required to be compliant with onload (and it wastes memory and hurts performance).

Finally, regarding the ibench test itself, ibench is specifically designed to work around onload.  It forces the page to lay out and scroll, causing every browser in the test to paint each page twice.  It also measures the overall time of the entire run, thus ensuring that as long as your paints take longer than the timeout values used, even the paints will be incorporated into the time.  It&#039;s actually really clever.</description>
		<content:encoded><![CDATA[<p>With respect, Mark is actually wrong on several points.</p>
<p>Yes, onload does fire earlier in Safari than in other browsers.  However it does not fire until all resources have been loaded.  We do delay doing the first layout (if the page loaded quickly enough) until after the onload fires.  This is simply common sense, since to do otherwise is to waste time doing relayouts as a result of the changes that would be executed by a typical onload handler.</p>
<p>Note that Firefox does not defer its first layout until after onload, but &#8211; like Safari &#8211; it also defers painting until after the onload has fired.  Neither browser will paint until after the onload if the page loads quickly enough.  (I ought to know.  I implemented this in Firefox.)</p>
<p>Regarding images, Safari does wait until the image data has been fetched before firing onload, but it does not decode images until they actually paint.  Again this is common sense to keep memory usage down (and is especially useful on mobile devices).  Most other browsers are not very smart in this respect and aggressively decode images before firing the onload.  This is neither necessary nor required to be compliant with onload (and it wastes memory and hurts performance).</p>
<p>Finally, regarding the ibench test itself, ibench is specifically designed to work around onload.  It forces the page to lay out and scroll, causing every browser in the test to paint each page twice.  It also measures the overall time of the entire run, thus ensuring that as long as your paints take longer than the timeout values used, even the paints will be incorporated into the time.  It&#8217;s actually really clever.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-251661</link>
		<dc:creator>Chad</dc:creator>
		<pubDate>Mon, 18 Jun 2007 04:06:05 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-251661</guid>
		<description>I agree with Evan. If it was found this fast, please post a bug at the apple website for Safari and they will more than likely fix the issue before we have to worry about it as developers :)</description>
		<content:encoded><![CDATA[<p>I agree with Evan. If it was found this fast, please post a bug at the apple website for Safari and they will more than likely fix the issue before we have to worry about it as developers :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charlie Cheng</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-251660</link>
		<dc:creator>Charlie Cheng</dc:creator>
		<pubDate>Mon, 18 Jun 2007 02:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-251660</guid>
		<description>I try to safari 3 for windows. It crashes all the time. 

Charlie</description>
		<content:encoded><![CDATA[<p>I try to safari 3 for windows. It crashes all the time. </p>
<p>Charlie</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mikael bergkvist</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-251632</link>
		<dc:creator>mikael bergkvist</dc:creator>
		<pubDate>Sat, 16 Jun 2007 05:37:18 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-251632</guid>
		<description>Why even adopt to it?
Cant we expect some basic features from browsers?
It&#039;s a beta, and developers should push for it to &#039;grow up&#039; instead.
I kinda like Safari, but I dont see why we should make excuses for it.</description>
		<content:encoded><![CDATA[<p>Why even adopt to it?<br />
Cant we expect some basic features from browsers?<br />
It&#8217;s a beta, and developers should push for it to &#8216;grow up&#8217; instead.<br />
I kinda like Safari, but I dont see why we should make excuses for it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: evan108108</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-251621</link>
		<dc:creator>evan108108</dc:creator>
		<pubDate>Fri, 15 Jun 2007 20:13:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-251621</guid>
		<description>Yes I have run into this problem on rare occasions in safari 2 as well. The onload event defiantly triggers at a different time then most browsers. But it should be noted that this problem does not present itself very often and in most cases no adjustments are necessary.</description>
		<content:encoded><![CDATA[<p>Yes I have run into this problem on rare occasions in safari 2 as well. The onload event defiantly triggers at a different time then most browsers. But it should be noted that this problem does not present itself very often and in most cases no adjustments are necessary.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing/comment-page-1#comment-251618</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 15 Jun 2007 19:28:27 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing#comment-251618</guid>
		<description>I&#039;ve run into a version of this on Safari 2, where standard DOM objects such as window weren&#039;t available yet. I had to put a catch in and the set a timeout to try again. Safari 3 does seem to cause even more problems.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve run into a version of this on Safari 2, where standard DOM objects such as window weren&#8217;t available yet. I had to put a catch in and the set a timeout to try again. Safari 3 does seem to cause even more problems.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
