<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stephen Belanger &#187; Web Browsers &amp; Compatibility</title>
	<atom:link href="http://stephenbelanger.com/category/web-browsers-compatibility/feed/" rel="self" type="application/rss+xml" />
	<link>http://stephenbelanger.com</link>
	<description>Just another coder making the web a better place.</description>
	<lastBuildDate>Fri, 17 Feb 2012 04:09:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A simple explanation of &#8220;new&#8221; in Javascript.</title>
		<link>http://stephenbelanger.com/2011/04/10/a-simple-explanation-of-new-in-javascript/</link>
		<comments>http://stephenbelanger.com/2011/04/10/a-simple-explanation-of-new-in-javascript/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 22:12:40 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Browsers & Compatibility]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://stephenbelanger.com/?p=162</guid>
		<description><![CDATA[There is a major feature of Javascript that is sorely misunderstood--the "new" keyword. Using the "new" keyword when declaring a variable will assign it's value to the state of "this" upon completion of the function. Not using "new" will simply assign it's value to the return value, or 'undefined' if nothing was returned. I wrote a simple example below to illustrate the effects of using the new keyword.]]></description>
			<content:encoded><![CDATA[<p>There is a major feature of Javascript that is sorely misunderstood&#8211;the &#8220;new&#8221; keyword. Using the &#8220;new&#8221; keyword when declaring a variable will assign it&#8217;s value to the state of &#8220;this&#8221; upon completion of the function. Not using &#8220;new&#8221; will simply assign it&#8217;s value to the return value, or &#8216;undefined&#8217; if nothing was returned. I wrote a simple example below to illustrate the effects of using the new keyword.</p>
<pre name="code" class="javascript">function Test(name){
    this.test = function(){
        return 'This will only work through the "new" keyword.';
    }
    return name;
}

var test = new Test('test');
test instanceof Test; // returns true
test.test(); // returns 'This will only work through the "new" keyword.'
test // returns the instance object of the Test() function.

var test2 = Test('test');
test2 instanceof Test; // returns false
test2.test(); // throws TypeError: Object #&lt;Test&gt; has no method 'test'
test2 // returns 'test'</pre>
<p>As Andrew kindly pointed out; if you return an object the resulting value will be an instance of the returned object rather than the constructor.</p>
<pre name="code" class="javascript">function Test(name){
    this.test = function(){
        return 'This will only work through the "new" keyword.';
    }
    return {name:name};
}

var test = new Test('test');
test instanceof Test; // returns false
test2.test(); // throws TypeError: Object #&lt;Test&gt; has no method 'test'
test // returns {name:'test'}.</pre>
<img src="http://stephenbelanger.com/?ak_action=api_record_view&id=162&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://stephenbelanger.com/2011/04/10/a-simple-explanation-of-new-in-javascript/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Peint &#8211; Event-based canvas drawing, yay!</title>
		<link>http://stephenbelanger.com/2010/09/14/peint-event-based-canvas-drawing-yay/</link>
		<comments>http://stephenbelanger.com/2010/09/14/peint-event-based-canvas-drawing-yay/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 05:00:38 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Peint]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Browsers & Compatibility]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://www.stephenbelanger.com/?p=112</guid>
		<description><![CDATA[I did a bunch of work on Peint today, refactoring it to something that I might actually consider good enough to release. On that note; Peint enters alpha as of now!]]></description>
			<content:encoded><![CDATA[<p>I did a bunch of work on Peint today, refactoring it to something that I might actually consider good enough to release. On that note; Peint enters alpha as of now! <a href="http://peint.stephenbelanger.com/peint.zip">Get it here</a>. It won&#8217;t blow up your computer! &#8230;I hope.</p>
<p>No documentation yet, but you can look at the updated sample code at <a href="http://peint.stephenbelanger.com">peint.stephenbelanger.com</a> to get an idea of what this thing is capable of. It&#8217;s pretty neat. <img src='http://stephenbelanger.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<img src="http://stephenbelanger.com/?ak_action=api_record_view&id=112&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://stephenbelanger.com/2010/09/14/peint-event-based-canvas-drawing-yay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Peint &#8211; Painting to canvas made easy!</title>
		<link>http://stephenbelanger.com/2010/09/13/peint-painting-to-canvas-made-easy/</link>
		<comments>http://stephenbelanger.com/2010/09/13/peint-painting-to-canvas-made-easy/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 19:37:04 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Peint]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Browsers & Compatibility]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://www.stephenbelanger.com/?p=106</guid>
		<description><![CDATA[As I mentioned in my previous post, I have been working on a graphics rendering library for the html5 canvas element. Peint is an attempt to make using canvas easier and more flexible, while introducing event-based programming. You include only core library and then use Peint.require('yourscript', callback) to asynchronously load extra modules and execute the callback code once the module is ready. Using this method, http requests are made smaller and occur after page load, so execution appears near instant--no waiting for 100+ kb of code to download before the system starts setting itself up. :)]]></description>
			<content:encoded><![CDATA[<p>As I mentioned in my previous post, I have been working on a graphics rendering library for the html5 canvas element. Peint is an attempt to make using canvas easier and more flexible, while introducing event-based programming. You include only the core library and then use Peint.require(&#8216;yourscript&#8217;, callback) to asynchronously load extra modules and execute the callback code once the module is ready. Using this method, http requests are made smaller and occur after page load, so execution appears near instant&#8211;no waiting for 100+ kb of code to download before the system starts setting itself up. <img src='http://stephenbelanger.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In the previous post, I showed you the viewport module, which allowed me to dynamically resize the canvas to cover the entire viewport and adjust itself automatically whenever the window is resized. This time I&#8217;ll be introducing part of the draw2d module. Canvas uses the fillRect() method to fill a rectangular area with a particular color, but it only suppports the standard pixel coordinates from a top left origin. I decide that wasn&#8217;t good enough for me.</p>
<p>In the example below, we fill the background with a pleasant blue color, and we draw 2 boxes using a mix of numeric pixel coordinates, css-style &#8217;100px&#8217; coordinates and even percentages. In addition to that, it also demonstrates positioning from a non-top/left origin! The canvas.coords() positioning system dynamically tranforms the input values using their key names and the current dimensions of the canvas, allowing lots of flexibility in element positioning. I have a neat demo showing the fill() and image() methods online here; <a href="http://peint.stephenbelanger.com">peint.stephenbelanger.com</a></p>
<pre name="code" class="javascript">
// Initialize our canvas screen.
var screen = Peint.init('#screen');

// Load draw2d module for basic 2D drawing tools.
Peint.require('draw2d', function(){
	var canvas = this;

	// Draw our background color.
	canvas.fill(canvas.rgb(0,100,130));

	// Draw some boxes...
	// This one is statically positioned with pixels.
	// 'px' is optional, it will assume that on numbers.
	canvas.fill(
		canvas.rgba(150,200,0,0.8)
		, canvas.coords({
			right:150
			, bottom:150
			, width:'100px'
			, height:'100px'
		})
	);
	// This one is dynamically positioned with percentages.
	canvas.fill(
		canvas.rgba(200,150,0,0.8)
		, canvas.coords({
			left:'2%'
			, top:'5%'
			, width:'15%'
			, height:'50%'
		})
	);
});
</pre>
<img src="http://stephenbelanger.com/?ak_action=api_record_view&id=106&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://stephenbelanger.com/2010/09/13/peint-painting-to-canvas-made-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On canvas, and how to use it well.</title>
		<link>http://stephenbelanger.com/2010/09/12/on-canvas-and-how-to-use-it-well/</link>
		<comments>http://stephenbelanger.com/2010/09/12/on-canvas-and-how-to-use-it-well/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 00:20:26 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Peint]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Browsers & Compatibility]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://www.stephenbelanger.com/?p=101</guid>
		<description><![CDATA[All day I have been working on a graphics library for html5's canvas element,  and I've come to the conclusion that it is not particularly easy to use "as-is" in more involved applications.]]></description>
			<content:encoded><![CDATA[<p>I have been working on a graphics library for html5&#8242;s canvas element lately, and I&#8217;ve come to the conclusion that it is not particularly easy to use &#8220;as-is&#8221; in more involved applications. I suppose that should be expected, it being such new technology and all, so I thought I&#8217;d share some of my experiences, insights and progress on this endeavor.</p>
<p>First of all, canvas doesn&#8217;t play nice with CSS width and height dimensions. Rather than adjusting the usable area like one might expect, it stretches the element while retaining the buffer size of the render area. That means making it &#8220;100%&#8221; width/height becomes needlessly difficult. That is one of the many things the library I&#8217;m working on is meant to handle. Here&#8217;s a code sample to show it forcing the canvas dimensions by using a &#8220;resize&#8221; event in my library.</p>
<pre name="code" class="javascript">
// Load viewport module.
Peint.require('viewport', function(){
	var viewport = this;

	// Initialize our canvas screen.
	screen = Peint.init('#screen');

	// Create onresize handler.
	var resizer = function(){
		// Get current viewport dimensions.
		var size = viewport.size();

		// Position and resize it.
		screen.position().resize(size);
	};

	// Attach handler to resize and load event of window.
	this.bind('resize', resizer);
	this.bind('load', resizer);
});
</pre>
<p>What this does, is create a callback function to attach to window.onresize and window.onload (Actually, window.onload doesn&#8217;t exist, so it fakes it). Every time this event is called, it repositions the element on the screen and resizes it to match the viewport size. As you&#8217;ve probably figured out by the Peint.require() with the callback, this library supports loading external modules with callbacks to run when the code is ready. It&#8217;s pretty neat. I&#8217;ll share more as I complete the modules.</p>
<img src="http://stephenbelanger.com/?ak_action=api_record_view&id=101&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://stephenbelanger.com/2010/09/12/on-canvas-and-how-to-use-it-well/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox &#8211; Two brackets and a number from being perfect.</title>
		<link>http://stephenbelanger.com/2008/03/13/firefox-two-brackets-and-a-number-from-being-perfect/</link>
		<comments>http://stephenbelanger.com/2008/03/13/firefox-two-brackets-and-a-number-from-being-perfect/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 00:25:12 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Web Browsers & Compatibility]]></category>
		<category><![CDATA[Acid2]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Firefox beta]]></category>
		<category><![CDATA[Gecko]]></category>
		<category><![CDATA[Gecko 1.9]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[RSS Counter]]></category>
		<category><![CDATA[RSS Update Counter]]></category>
		<category><![CDATA[Safari]]></category>

		<guid isPermaLink="false">http://www.stephenbelanger.com/?p=9</guid>
		<description><![CDATA[I've always been an avid supporter of web standards, so I was glad to here that Gecko 1.9, the layout engine used in the Firefox 3 beta, passes the Acid2 test, but I found the future version of Firefox is still lacking one single thing that I feel holds it back rather significantly from being what it could be. That features is the RSS Updates counter that Safari has had for pretty much ever. How long will it take before Mozilla catches on that Firefox's lack of this simple feature is a deal-breaker for many people? I guess I'll have to continue using two browsers until Mozilla catches up.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nerdculture.org/wp-content/uploads/2008/03/firefox-could-be-better.jpg" width="480" height="250" alt="firefox-could-be-better.jpg" class="imageframe" />I&#8217;ve always been an avid supporter of web standards, so I was glad to here that Gecko 1.9, the layout engine used in the Firefox 3 beta, passes the <a href="http://www.webstandards.org/files/acid2/test.html">Acid2</a> test, but I found the future version of Firefox is still lacking one single thing that I feel holds it back rather significantly from being what it could be. That features is the RSS Updates counter that Safari has had for pretty much ever. How long will it take before Mozilla catches on that Firefox&#8217;s lack of this simple feature is a deal-breaker for many people? I guess I&#8217;ll have to continue using two browsers until Mozilla catches up.</p>
<img src="http://stephenbelanger.com/?ak_action=api_record_view&id=9&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://stephenbelanger.com/2008/03/13/firefox-two-brackets-and-a-number-from-being-perfect/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>YSlow? &#8211; That&#8217;s what I&#8217;d like to know!</title>
		<link>http://stephenbelanger.com/2007/10/25/yslow-thats-what-id-like-to-know/</link>
		<comments>http://stephenbelanger.com/2007/10/25/yslow-thats-what-id-like-to-know/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 12:42:39 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Web Browsers & Compatibility]]></category>
		<category><![CDATA[ETags]]></category>
		<category><![CDATA[Expires Headers]]></category>
		<category><![CDATA[Firebug]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HTTP Requests]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Yahoo]]></category>
		<category><![CDATA[YSlow]]></category>

		<guid isPermaLink="false">http://www.stephenbelanger.com/?p=11</guid>
		<description><![CDATA[So I stumbled upon a neat little plugin for the Firebug plugin I've been using with Firefox for awhile now. It's called YSlow and what it does is analyze various aspects of your pageload and compares it to Yahoo's <a href="http://developer.yahoo.com/performance/rules.html">Exceptional Performance</a> criteria and gives each aspect a letter grade rating. Nerd Culture was an F yesterday--Now it's averaging between D to B for me, depending on the page. I reduced the total page load of the homepage from 784 KB to 345 KB, less than half what it was before! Even better; Primed Cache was reduced from 440 KB to 18 KB! Why was my server set up so that the users would download images they already have in their browser's cache? &#62;.&#62;]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nerdculture.org/wp-content/uploads/2007/10/135.jpg" /></p>
<p>So I stumbled upon a neat little plugin for the Firebug plugin I&#8217;ve been using with Firefox for awhile now. It&#8217;s called YSlow and what it does is analyze various aspects of your pageload and compares it to Yahoo&#8217;s <a href="http://developer.yahoo.com/performance/rules.html">Exceptional Performance</a> criteria and gives each aspect a letter grade rating. Nerd Culture was an F yesterday&#8211;Now it&#8217;s averaging between D to B for me, depending on the page. I reduced the total page load of the homepage from 784 KB to 345 KB, less than half what it was before! Even better; Primed Cache was reduced from 440 KB to 18 KB! Why was my server set up so that the users would download images they already have in their browser&#8217;s cache? &gt;.&gt;</p>
<p>Tomorrow I&#8217;m thinking of going on a full-scale safari, hacking through WordPress&#8217; code with my Dreamweaver machete until I slim this fatty down a little. &gt;.&lt;</p>
<p>Anyone else hate that WordPress places all the javescript in the header and that they didn&#8217;t think to try using php to merge all the js files and all the css files into one big js file and one big css file, so you don&#8217;t have 50 HTTP Requests on every pageload? &gt;.&gt;</p>
<img src="http://stephenbelanger.com/?ak_action=api_record_view&id=11&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://stephenbelanger.com/2007/10/25/yslow-thats-what-id-like-to-know/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

