<?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>Doctyper</title>
	<atom:link href="http://doctyper.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://doctyper.com</link>
	<description>Doctyper is the website of Richard Herrera, a front-end developer with a strong commitment to the web standards movement.</description>
	<lastBuildDate>Tue, 01 Dec 2009 23:07:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Substitute :last-child for :first-child for IE 7 support</title>
		<link>http://doctyper.com/archives/200912/substitute-last-child-for-first-child-for-ie-7-support/</link>
		<comments>http://doctyper.com/archives/200912/substitute-last-child-for-first-child-for-ie-7-support/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 23:05:29 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Quick Tip]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=56</guid>
		<description><![CDATA[Consider the following:
ul li {
&#160;&#160; display: inline;
&#160;&#160; margin-right: 10px;
&#160;&#160; padding-right: 10px;
&#160;&#160; border-right: 1px solid red;
}
ul li:last-child {
&#160;&#160; margin-right: 0;
&#160;&#160; padding-right: 0;
&#160;&#160; border-right: 0;
}
This bit of CSS would give you perfect line separators in IE8+. But since IE 7 supports the :first-child pseudo-class, we can do one better:
ul li {
&#160;&#160; display: inline;
&#160;&#160; margin-left: 10px;
&#160;&#160; padding-left: 10px;
&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Consider the following:</p>
<p><code>ul li {<br />
&nbsp;&nbsp; display: inline;<br />
&nbsp;&nbsp; margin-right: 10px;<br />
&nbsp;&nbsp; padding-right: 10px;<br />
&nbsp;&nbsp; border-right: 1px solid red;<br />
}</code></p>
<p><code>ul li:last-child {<br />
&nbsp;&nbsp; margin-right: 0;<br />
&nbsp;&nbsp; padding-right: 0;<br />
&nbsp;&nbsp; border-right: 0;<br />
}</code></p>
<p>This bit of CSS would give you perfect line separators in IE8+. But since IE 7 supports the :first-child pseudo-class, we can do one better:</p>
<p><code>ul li {<br />
&nbsp;&nbsp; display: inline;<br />
&nbsp;&nbsp; margin-left: 10px;<br />
&nbsp;&nbsp; padding-left: 10px;<br />
&nbsp;&nbsp; border-left: 1px solid red;<br />
}</code></p>
<p><code>ul li:first-child {<br />
&nbsp;&nbsp; margin-left: 0;<br />
&nbsp;&nbsp; padding-left: 0;<br />
&nbsp;&nbsp; border-left: 0;<br />
}</code></p>
<p>Same* result, with more browser support.<br />
<small>*Substitute for &#8220;sane&#8221;.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200912/substitute-last-child-for-first-child-for-ie-7-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Ping.fm to your Twitter homepage with Greasemonkey / GreaseKit</title>
		<link>http://doctyper.com/archives/200912/add-ping-fm-to-twitter/</link>
		<comments>http://doctyper.com/archives/200912/add-ping-fm-to-twitter/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 22:50:58 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=50</guid>
		<description><![CDATA[For those using either Greasemonkey or GreaseKit, I threw together a quick script to add the Ping.fm interface in your Twitter homepage:
Ping.fm / Twitter Integrator
Here&#8217;s a screenshot of what that looks like for reference:

]]></description>
			<content:encoded><![CDATA[<p>For those using either <a href="http://www.greasespot.net/">Greasemonkey</a> or <a href="http://8-p.info/greasekit/">GreaseKit</a>, I threw together a quick script to add the <a href="http://ping.fm">Ping.fm</a> interface in your Twitter homepage:</p>
<p><a href="http://doctyper.com/stuff/grease/ping.fm.twitter.user.js">Ping.fm / Twitter Integrator</a></p>
<p>Here&#8217;s a screenshot of what that looks like for reference:<br />
<a href="http://doctyper.com/stuff/grease/ping.fm-twitter-screenshot.png"><img src="http://doctyper.com/stuff/grease/ping.fm-twitter-thumb.png" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200912/add-ping-fm-to-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RGBa makes a great debugging tool</title>
		<link>http://doctyper.com/archives/200912/rgba-makes-a-great-debugging-tool/</link>
		<comments>http://doctyper.com/archives/200912/rgba-makes-a-great-debugging-tool/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 22:31:09 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Quick Tip]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=48</guid>
		<description><![CDATA[With 24 Ways pushing RGBa into the foreground today, I thought I&#8217;d share a quick debugging tip. Using RGBa can help while you&#8217;re debugging element positioning. For the adventurous, combine with a debug class:
.debug {
&#160;&#160;background: rgba(255, 0, 0, 0.5);
}
]]></description>
			<content:encoded><![CDATA[<p>With <a href="http://24ways.org/2009/working-with-rgba-colour">24 Ways</a> pushing RGBa into the foreground today, I thought I&#8217;d share a quick debugging tip. Using RGBa can help while you&#8217;re debugging element positioning. For the adventurous, combine with a debug class:</p>
<p><code>.debug {<br />
&nbsp;&nbsp;background: rgba(255, 0, 0, 0.5);<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200912/rgba-makes-a-great-debugging-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flow 1.1</title>
		<link>http://doctyper.com/archives/200906/flow-11/</link>
		<comments>http://doctyper.com/archives/200906/flow-11/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 00:44:24 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flow]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=47</guid>
		<description><![CDATA[And just like that, a new update. Several small fixes worthy of a point upgrade:

Switched QuerySelector engine to Sizzle 1.0
querySelector/querySelectorAll can now be run on any element (via Selectors API)
IE 8 does not like setAttribute on type elements. Reverting to DOM 1 method.
Fixed minor assertion bug in Require.js

]]></description>
			<content:encoded><![CDATA[<p>And just like that, <a href="http://flowjs.com">a new update</a>. Several small fixes worthy of a point upgrade:</p>
<ul>
<li>Switched QuerySelector engine to <a href="http://sizzlejs.com/">Sizzle 1.0</a></li>
<li id="_mc_tmp">querySelector/querySelectorAll can now be run on any element (via Selectors API)</li>
<li id="_mc_tmp">IE 8 does not like setAttribute on type elements. Reverting to DOM 1 method.</li>
<li id="_mc_tmp">Fixed minor assertion bug in Require.js</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200906/flow-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flow 1.0.8</title>
		<link>http://doctyper.com/archives/200906/flow-108/</link>
		<comments>http://doctyper.com/archives/200906/flow-108/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 14:44:23 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flow]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=45</guid>
		<description><![CDATA[A tiny update that fixes IE 8 browser identification. It previously incorrectly identified IE 8 as IE 5.
]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://flowjs.com">tiny update</a> that fixes IE 8 browser identification. It previously incorrectly identified IE 8 as IE 5.</p>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200906/flow-108/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pickleview shuts down</title>
		<link>http://doctyper.com/archives/200906/pickleview-shuts-down/</link>
		<comments>http://doctyper.com/archives/200906/pickleview-shuts-down/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 14:44:12 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=46</guid>
		<description><![CDATA[It had a good run there for a few months. I don&#8217;t need to tell you about MLB&#8217;s At Bat app do I? It&#8217;s the better (and free) alternative, and I can&#8217;t really compete with baseball&#8217;s integrated setup.
My thanks to the founders, wherever you are. That was a great weekend.
]]></description>
			<content:encoded><![CDATA[<p>It had a good run there for a few months. I don&#8217;t need to tell you about <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=309327900&amp;mt=8">MLB&#8217;s At Bat app</a> do I? It&#8217;s the better (<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=281969989&amp;mt=8">and free</a>) alternative, and I can&#8217;t really compete with baseball&#8217;s integrated setup.</p>
<p>My thanks to the founders, wherever you are. <a href="http://doctyper.com/archives/200707/pickleview/">That was a great weekend</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200906/pickleview-shuts-down/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixed positioning in Mobile Safari</title>
		<link>http://doctyper.com/archives/200808/fixed-positioning-on-mobile-safari/</link>
		<comments>http://doctyper.com/archives/200808/fixed-positioning-on-mobile-safari/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 00:34:07 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=44</guid>
		<description><![CDATA[Update: An anonymous genius in the comments suggested using translateY instead of top for the animation. After some edits I&#8217;ve updated my demo, and it flies! The scrolling animation is smooth as silk. Apparently Webkit transforms are the only hardware-accelerated animations at this point. Thanks, random dude on the internet!
Update 2: This code is released [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> An anonymous genius in the comments suggested using translateY instead of top for the animation. After some edits I&#8217;ve updated my demo, and it flies! The scrolling animation is smooth as silk. Apparently Webkit transforms are the only hardware-accelerated animations at this point. Thanks, random dude on the internet!</p>
<p><strong>Update 2</strong>: This code is released to the public domain. You can use, modify, remix as you see fit.</p>
<p>Behold, fixed positioning on iPhone! <a href="http://doctyper.com/stuff/iphone/fixed/">http://doctyper.com/stuff/iphone/fixed/</a></p>
<p><a href="http://doctyper.com/stuff/iphone/fixed/fixed-positioning.mov">Here&#8217;s a video</a> for those without iPhones. This is running in the iPhone Simulator bundled with the SDK. Note that the animation is much choppier on an actual iPhone.</p>
<p>With the release of iPhone OS 2.0 came some great improvements over previous Mobile Safari versions. CSS animations are in (though buggy), as well as native touch events like touchstart, touchend, gesturechange, etc.</p>
<p>I played around with these new goodies while hunting for improvements to build into <a href="http://pickleview.com">Pickleview</a>. The most fascinating change to me was that you can now prevent the default behavior of elements with a simple preventDefault() call. It allows a user to drag an element around the screen without having to worry about the viewport wobbling about.</p>
<p>I grew curious as to what I could specifically call this on, and started testing out several elements. Turns out you can preventDefault on everything in the DOM, including the body element. This seemed incredibly useless for no other reason than the terrible usability it would bring if you couldn&#8217;t scroll the viewport. Then the proverbial light bulb went off: <em>fixed positioning</em>!</p>
<p>First, let&#8217;s recap why fixed positioning does not work off-the-bat. Mobile Safari uses a viewport to show you websites. Imagine a book in front of you. Take a piece of paper, cut a 320&#215;416 square in it, and lay it over the book. To read the book, move the paper around and position the hole over the words you want to see. This is exactly what Mobile Safari&#8217;s viewport is doing. When you flick and scroll, you&#8217;re moving the viewport around while the website behind it stays static.</p>
<p>This renders fixed positioning null and void on iPhone. An element that has its position fixed is affixed to the <em>body</em>, not the viewport. So it <em>is</em> actually working as intended, though most people would prefer it attached to the viewport.</p>
<p>There are workarounds in the wild, but these are inelegant. You can reposition an element onscroll, but a scroll event in Mobile Safari is only fired after scrolling has stopped. This results in an evident &#8220;glitch&#8221; since you have to a) flick to your desired position, throwing the element off-screen, and b) wait for the element to reappear in the viewport after scrolling has stopped.</p>
<p>By disabling the default scroll behavior on the body element, you essentially glue the viewport down to its initial starting point, where it&#8217;s unable to go anywhere. This limits the viewport to exactly 320&#215;416 pixels of space to show you. In this state, you have a perfectly useless experience.</p>
<p>This is where it gets interesting. In order to re-enable scrolling, I needed to only make the content area scrollable (think iframe, with header and footer above and below it). The touch and gesture events gives access to X/Y values, as well as timers and offset values. So by logging these and incrementing the top offset of the content area, we can create a scrollable block that does not affect the header or footer elements. A little spit and polish later: voila!</p>
<p>It&#8217;s pretty evident from my proof-of-concept that CSS animations need a lot of work. They&#8217;re promised to be &#8220;hardware-accelerated&#8221;, but there&#8217;s little proof of this. Most animations glitch, some to the point of non-use. The scrolling isn&#8217;t particularly smooth and even something as simple as animating a &#8216;top&#8217; CSS property takes its toll. Still it&#8217;s usable, though I hope later Mobile Safari builds will address these issues.</p>
<p>If you&#8217;re interested, I&#8217;ve bundled together the source files for my proof-of-concept. <a href="http://doctyper.com/stuff/iphone/fixed/fixed-positioning.zip">Grab &#8216;em here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200808/fixed-positioning-on-mobile-safari/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
<enclosure url="http://doctyper.com/stuff/iphone/fixed/fixed-positioning.mov" length="3815585" type="video/quicktime" />
		</item>
		<item>
		<title>Breaking out of a forEach loop</title>
		<link>http://doctyper.com/archives/200807/breaking-out-of-a-foreach-loop/</link>
		<comments>http://doctyper.com/archives/200807/breaking-out-of-a-foreach-loop/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 00:40:02 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flow]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=43</guid>
		<description><![CDATA[An email going around the client-side mailing list at Schematic casually mentioned forEach loops. The sender liked them, but tended to avoid them because there was no way to break out of one.
Naturally, this sent me on the hunt to see if it was at all possible. A furious Google search led me to a [...]]]></description>
			<content:encoded><![CDATA[<p>An email going around the client-side mailing list at Schematic casually mentioned forEach loops. The sender liked them, but tended to avoid them because there was no way to break out of one.</p>
<p>Naturally, this sent me on the hunt to see if it was at all possible. A furious Google search led me to a <a href="http://dean.edwards.name/weblog/2006/07/enum/#comment104722">comment by Dean Edwards</a> (who else?). He suggested throwing yourself out of the loop and wrapping the throw in a try catch statement to silence the throw. Like so:</p>
<p><code>var array = [1, 2, 0, 3, 4, 5];<br />
try {<br />
&nbsp;&nbsp;array.forEach(function(item) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (item === 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw new Error(); // Simulated break<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;console.log(item);<br />
&nbsp;&nbsp;});<br />
} catch (e) {}</code></p>
<p><a href="http://doctyper.com/stuff/flow/forEach/test-1.html">That does the trick.</a> Fellow developer/comrade <a title="Don't mind the light!" href="http://rule52.com/">Lenny Burdette</a> pointed out that this was exactly the method <a href="http://github.com/sstephenson/prototype/tree/master/src/enumerable.js#L1">Prototype uses</a> to break their own custom loops.</p>
<p>But of course, there&#8217;s caveats. With Prototype, you merely have to call <em>$break</em> to have it automate this for you. With Flow, you&#8217;re exposed to the elements and need to handle it yourself. It&#8217;s a neat trick, but quite honestly it&#8217;s not very user friendly, and looks a bit unwieldy as a workaround.</p>
<p>I browsed the forEach documentation and went through possible solutions. One was to extend forEach and include a custom break function in it. But I decided against this for a few reasons. One, it would violate the <a href="http://dean.edwards.name/weblog/2007/03/rules/">rules</a> (#3, to be exact). Over-extending a native function would bring more hurt than it would good. Second, Safari 2 has a problem with extending forEach, so it wasn&#8217;t a viable solution either.</p>
<p>But I had a hunch. What if I simulated a break by splicing off the remaining objects in the array, thereby terminating the loop entirely? I gave it a try:</p>
<p><code>var array = [1, 2, 0, 3, 4, 5];<br />
array.forEach(function(item, i) {<br />
&nbsp;&nbsp;if (item === 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;array.splice(i, array.length - i); // Simulated break<br />
&nbsp;&nbsp;} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;console.log(item);<br />
&nbsp;&nbsp;}<br />
});</code></p>
<p><a href="http://doctyper.com/stuff/flow/forEach/test-2.html">Success!</a> The loop terminates, because there are no more objects to continue to. There&#8217;s just one problem: there are no more objects to continue to. It mutates the array, so it&#8217;s not reliable if you need to reuse the array. You&#8217;re limited to using it only once, or having to rebuild the array.</p>
<p>Ah, but what if you splice the array, and immediately concatenate it? Would it have the same effect and stop the array in its tracks?</p>
<p><code>var array = [1, 2, 0, 3, 4, 5];<br />
array.forEach(function(item, i) {<br />
&nbsp;&nbsp;if (item === 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;array = array.concat(array.splice(i, array.length - i)); // F-f-f-forEach breaker!<br />
&nbsp;&nbsp;} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;console.log(item);<br />
&nbsp;&nbsp;}<br />
});</code></p>
<p><a href="http://doctyper.com/stuff/flow/forEach/test-3.html">Double success!</a> In this example, the array is spliced from the current index point, and all remaining objects are dropped off, ending the loop. The magic happens when we rejoin the array using concat, and reassign the newly constructed object to the array variable. The array is mutated back to its original form, and you&#8217;ve broken the forEach loop.</p>
<p>Still, it&#8217;s not as satisfyingly simple as a break, is it? Well, we can&#8217;t call a break, but we can get close. The next Flow revision will contain the <em>exit</em> Array extra, which will provide you with a keyword (or, as close enough a keyword as I could get) to break a forEach loop:</p>
<p><code>var array = [1, 2, 0, 3, 4, 5];<br />
array.forEach(function(item, i) {<br />
&nbsp;&nbsp;if (item === 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;array = array.exit(i);<br />
&nbsp;&nbsp;} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;console.log(item);<br />
&nbsp;&nbsp;}<br />
});</code></p>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200807/breaking-out-of-a-foreach-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flow 1.0.2</title>
		<link>http://doctyper.com/archives/200807/flow-102/</link>
		<comments>http://doctyper.com/archives/200807/flow-102/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 19:19:52 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Flow]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=41</guid>
		<description><![CDATA[I just pushed release 1.0.2 out the door.
Bug fix:
Flow will no longer choke with SWFObject.
Early this morning I received a report about Flow not playing nicely with SWFObject. After debugging, it turned out it was a case of doing too much.
SWFObject correctly cleans up after itself in IE by removing its generated code on unload. [...]]]></description>
			<content:encoded><![CDATA[<p>I just pushed release 1.0.2 out the door.</p>
<h4>Bug fix:</h4>
<p>Flow will no longer choke with SWFObject.</p>
<p>Early this morning I received a report about Flow not playing nicely with SWFObject. After debugging, it turned out it was a case of doing too much.</p>
<p>SWFObject correctly cleans up after itself in IE by removing its generated code on unload. The conflict appears because Flow does the same with its code, going as far as eliminating all extended element properties.</p>
<p>So when SWFObject tried to removeChild, it returned null because Flow extends that property, and by the time SWFObject got to it, it was already wiped out.</p>
<p>Flow now merely restores an extended property back to its original implementation, rather than nullifying the property. This will fix the error.</p>
<h4>Feature:</h4>
<p>dispatchEvent is now implemented in Flow. You can use it to fire events on elements from another element. Confusing? Here&#8217;s an example:</p>
<p><code>var test = document.getById(&quot;test&quot;);<br />
test.addEventListener(&quot;click&quot;, function() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;// console.log(this.id);<br />
}, false);<br />
&nbsp;<br />
document.getById(&quot;dispatcher&quot;).addEventListener(&quot;click&quot;, function() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;test.dispatchEvent(&quot;click&quot;);<br />
}, false);</code></p>
<p>You can pass any event type and it will fire all events coupled with that type.</p>
<p>As usual, you can download the Flow framework at <a href="http://flowjs.com">http://flowjs.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200807/flow-102/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Flow</title>
		<link>http://doctyper.com/archives/200805/introducing-flow/</link>
		<comments>http://doctyper.com/archives/200805/introducing-flow/#comments</comments>
		<pubDate>Fri, 09 May 2008 21:00:52 +0000</pubDate>
		<dc:creator>doctyper</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://doctyper.com/?p=40</guid>
		<description><![CDATA[This is a post I&#8217;ve been wanting to write for months now. For the past several months I&#8217;ve been spending my free time toiling over a personal project of mine.
It started with Dean Edwards and his release of the Base2 library. It scratched an itch that I&#8217;ve had for years: I wanted the ability to [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post I&#8217;ve been wanting to write for months now. For the past several months I&#8217;ve been spending my free time toiling over a personal project of mine.</p>
<p>It started with Dean Edwards and his release of the <a href="http://dean.edwards.name/weblog/2007/03/yet-another/">Base2 library</a>. It scratched an itch that I&#8217;ve had for years: I wanted the ability to use the DOM API (Level 3) in all modern browsers. Base2 has since seen a second revision and is <a href="http://code.google.com/p/base2/">even more powerful</a> than before.<em> (Aside: Dean Edwards&#8217; is a freaking genius.)</em></p>
<p>But I wanted more. I wanted a hybrid API that would allow me to use the standard API, but would also contain helper functions, shorthand notation, chainability, etc. So I got to work.</p>
<p>After eight months of development, trials, tears and tribulations I am pleased to announce the initial release of <a href="http://flowjs.com/">The Flow Framework</a>.</p>
<p>Flow aims to fix and enhance the DOM Level 3 API. Flow extends API functionality to browsers that currently don&#8217;t support it. Additionaly, it adds powerful functionality on top for the best bang for your JavaScript buck.</p>
<p>A sample of the functions it implements cross-browser:</p>
<ul>
<li>getElementsByClassName / getElementsByAttribute</li>
<li>addEventListener / removeEventListener (with DOMContentLoaded support)</li>
<li>preventDefault / stopPropagation</li>
<li>addClass / removeClass / replaceClass</li>
<li>querySelector / querySelectorAll</li>
<li>shorthand notation (getById, getByTag, getByClass, etc)</li>
</ul>
<p>Hereâ€™s a snippet of what can be accomplished with Flow:</p>
<p>Find all: <code class="prettyprint">ul.checked li</code></p>
<h5>With Flow Core</h5>
<p><code>var uls = document.getElementsByClassName(&quot;checked&quot;).filter(function(e) {<br />
&nbsp;&nbsp;return e.nodeName.toLowerCase() == &quot;ul&quot;;<br />
});<br />
var lis = [];<br />
uls.forEach(function(ul) {<br />
&nbsp;&nbsp;ul.getElementsByTagName(&quot;li&quot;).forEach(function(li) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;lis.push(li);<br />
&nbsp;&nbsp;});<br />
});</code></p>
<h5>With Flow Extend</h5>
<p><code class="prettyprint">var lis = document.getByClass("checked").filter(function(e) {<br />
	return e.elementName() == "ul";<br />
}).getByTag("li");</code></p>
<h5>With Flow Query</h5>
<p><code>var lis = document.querySelectorAll(&quot;ul.checked li&quot;);</code></p>
<p>Want to open external links in new windows via JavaScript?<br />
<code>document.getByAttr(&quot;rel&quot;, &quot;external&quot;).setAttribute(&quot;target&quot;, &quot;_blank&quot;);</code></p>
<p>Want to return false on those pesky blank-anchor links?<br />
<code>document.getByAttr(&quot;href&quot;, &quot;#&quot;).addEventListener(&quot;click&quot;, function(e) {<br />
&nbsp;&nbsp;e.preventDefault();<br />
}, false);</code></p>
<p>There are more <a href="http://flowjs.com/examples/">code samples</a>, <a href="http://flowjs.com/docs/">documentation</a>, <a href="http://flowjs.com/test/unit/">unit tests</a> on the official site. Be sure to download a <a href="http://flowjs.com/download/">customized Flow build</a> and try it out!</p>
<p>For those that want to take a gander at the code, you can check out the source on Google Code: <a href="http://code.google.com/p/flowjs/">http://code.google.com/p/flowjs/</a>.</p>
<p>There&#8217;s already a website using Flow in the wild. <a href="http://southparkstudios.com/">South Park Studios</a> was unveiled a couple of months ago, and it&#8217;s been chugging along since. Unfortunately I was under gag order at the time while the final details were being hammered down. Now I can officially state that it&#8217;s using Flow and lovin&#8217; it.</p>
<p>Many, many thanks to <a href="http://schematic.com">Schematic</a> for supporting the release of this library, and to the many Schematicans who freely contributed to the library.</p>
<p>Thanks are also in order to the great JavaScript programmers who&#8217;ve turned us all on our heads: <a href="http://ejohn.org">John Resig</a>, <a href="http://dean.edwards.name/">Dean Edwards</a>, <a href="http://www.robertnyman.com/">Robert Nyman</a>, <a href="http://therealcrisp.xs4all.nl/blog/">Tino Zijdel</a>, <a href="http://www.ilinsky.com/">Sergey Ilinsky</a> and countless others.</p>
]]></content:encoded>
			<wfw:commentRss>http://doctyper.com/archives/200805/introducing-flow/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
