<?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>CodeDread Blog &#187; html5</title>
	<atom:link href="http://www.codedread.com/blog/archives/tag/html5/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codedread.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 02 Jan 2012 15:30:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Start Chopping Off Heads</title>
		<link>http://www.codedread.com/blog/archives/2010/09/21/start-chopping-off-heads/</link>
		<comments>http://www.codedread.com/blog/archives/2010/09/21/start-chopping-off-heads/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 17:02:10 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[w3c]]></category>

		<guid isPermaLink="false">http://www.codedread.com/blog/?p=945</guid>
		<description><![CDATA[Because my kids are now old enough to grok some complex games, I&#8217;ve introduced them to the Magic: The Gathering card game. They love it. I love it. To continue the fun, we went to a local comic book store and bought a couple booster packs, which apparently are still being sold throughout the world. [...]]]></description>
			<content:encoded><![CDATA[<p><img width="100" height="100" style="float:right" src="http://codedread.com/clipart/hydra.svgz" alt="I want to believe. SVG as an image format."></img>Because my kids are now old enough to grok some complex games, I&#8217;ve introduced them to the <a href="http://en.wikipedia.org/wiki/Magic:_the_gathering">Magic: The Gathering</a> card game.  They love it.  I love it.  To continue the fun, we went to a local comic book store and bought a couple booster packs, which apparently are still being sold throughout the world.  One of my kids got a <a href="http://www.amazon.com/Protean-Hydra-Magic-Mythic-Gathering/dp/B002TJX23W">Protean Hydra</a>.  Sweet!  The <a href="http://en.wikipedia.org/wiki/Lernaean_Hydra">Hydra</a> is a mythical beast with nine heads, and every time you chop off a head, two more grow back.</p>
<p>The web is like that.  And we&#8217;re not <a href="http://hsivonen.iki.fi/spacer/">chopping off heads</a> fast enough. <span id="more-945"></span></p>
<p>Now that Internet Explorer has come out of its corner swinging with SVG support, I figured it&#8217;s time to make sure we can actually deploy web pages with SVG content in them.  Did you know that there are at least <em>thirteen</em> ways to deploy SVG on the web?</p>
<ul>
<li>inline in <a href="http://dev.w3.org/html5/spec/the-map-element.html#svg-0">HTML5</a> as <em>not-XML</em> (or !XML as I like to call it)</li>
<li>inline in XHTML (1.1 or 5) as XML</li>
<li>via the <a href="http://dev.w3.org/html5/spec/embedded-content-1.html#the-img-element">HTML:img</a> element</li>
<li>via the <a href="http://dev.w3.org/html5/spec/the-iframe-element.html#the-object-element">HTML:object</a> element</li>
<li>via the <a href="http://dev.w3.org/html5/spec/the-iframe-element.html#the-embed-element">HTML:embed</a> element</li>
<li>via the <a href="http://dev.w3.org/html5/spec/the-iframe-element.html#the-iframe-element">HTML:iframe element</a></li>
<li>via the <a href="http://www.w3.org/TR/2010/WD-SVG11-20100622/struct.html#ImageElement">SVG:image</a> element</li>
<li>via the <a href="http://www.w3.org/TR/2010/WD-SVG11-20100622/extend.html#ForeignObjectElement">SVG:foreignObject</a> element</li>
<li>as a fragment via the <a href="http://www.w3.org/TR/2010/WD-SVG11-20100622/struct.html#UseElement">SVG:use</a> element</li>
<li>via the <a href="http://www.w3.org/TR/CSS2/colors.html#propdef-background-image">background-image</a> CSS property</li>
<li>via the <a href="http://www.w3.org/TR/CSS2/generate.html#propdef-list-style-image">list-image</a> CSS property</li>
<li>via the <a href="http://www.w3.org/TR/2002/WD-css3-border-20021107/#the-border-image-uri">border-image</a> CSS property</li>
<li>directly linking and then browsing to a SVG file</li>
</ul>
<p>Does anyone know why the &#60;embed&#62; element was not deprecated in HTML5?  Was it the realities of the IE deployment difficulties around the &#60;object&#62; tag?  It sounds like IE9 will help to fix that so maybe &#60;embed&#62; can eventually be deprecated in HTML6 five years from now?</p>
<p>What&#8217;s worse is that the properties on the embedding context and the SVG elements affect how the SVG is rendered.  The width/height properties on &#60;object&#62;/&#60;embed&#62;/&#60;iframe&#62; tags.  The width/height/<a href="http://www.w3.org/TR/2010/WD-SVG11-20100622/coords.html#ViewBoxAttribute">viewBox</a> properties on the &#60;svg&#62; element.  The <a href="http://www.w3.org/TR/2010/WD-SVG11-20100622/coords.html#PreserveAspectRatioAttribute">preserveAspectRatio attribute</a> on the &#60;svg&#62; element.</p>
<p>The width attribute on a &#60;svg&#62; element can be specified in units of em, ex, px, in, cm, mm, pt, pc or it can be unitless or it can be a percentage.  Of course the height attribute can be specified in different units.</p>
<p>The embedding context also determines whether scripts are run within the SVG document. Hint: Should not be run in image contexts.</p>
<p><img width="100" height="100" style="float:right" src="http://codedread.com/clipart/caution.svgz" alt="I want to believe. SVG as an image format."></img>But it gets worse.  Let&#8217;s just look at one case: embedding an SVG document in a web page via the &#60;object&#62; tag:</p>
<p><code>&#60;object type='image/svg+xml' data='...'&#62;&#60;/object&#62;</code></p>
<p>For the data attribute you can specify a local file, a http/https URL or a data URI.  The browser can treat each of these cases differently.</p>
<p>The file served to the browser can have a MIME type of image/svg+xml or text/xml or application/xml.  Browsers might do something different in these cases (though they shouldn&#8217;t).</p>
<p>If the width/height on the &#60;object&#62; tag are specified, they should override the &#60;svg&#62; width/height if the &#60;svg&#62; width/height are in absolute (not relative/percentage) units.  The coordinate system of the SVG should map to the viewBox attribute unless the viewBox attribute is not specified, in which case it should be inferred.  Got all that?</p>
<p>If width/height on &#60;object&#62; are not specified, and width/height of the SVG are specified in absolute terms, then the size of the &#60;object&#62; frame should change to match the size of the SVG.</p>
<p>If width/height on &#60;object&#038; are not specified on a Tuesday of a leap year, and the SVG document has an odd-number of bytes in it and includes the string &#8216;rick&#8217; or &#8216;roll&#8217; anywhere in it, then the browser should play a video instead.</p>
<p>I&#8217;m not making this up, it&#8217;s <a href="http://goo.gl/Bxjk">right here</a> in the spec.</p>
<p>Actually the difficulty of this case is that there are so many dimensions and that it&#8217;s spread across multiple specs: HTML, CSS, SVG.  I think WICD/CDF was supposed to address some (all?) of these cases, but &#8230; are those specs actually valid?  And by that I mean, are browser vendors paying attention to them?  As Dolores O&#8217;Riordan might say: Does anyone care?</p>
<p><img width="100" height="150" style="float:right" src="http://codedread.com/clipart/iphone.svgz" alt="I want to believe. SVG as an image format."></img>There&#8217;s something to be said for the simplicity of the iPhone&#8217;s &#8220;one&#8221; button.  Android&#8217;s addition of the &#8220;Back&#8221; button is a perfect example of how a system can be incrementally improved.</p>
<p>Anyway, I&#8217;ve started to look at just three dimensions of this n-dimensional problem:  the HTML embedding context, width/height and viewBox.  I wrote a <a href="http://codedread.com/browser-tests/svg-image/html.html">test case</a> showing the 16 possible combinations.  I was not really shocked that between all the four major browser engines, only one case displayed consistently across all latest builds: as an &#60;img&#62; with width/height specified on both &#60;img&#62; and &#60;svg&#62;.</p>
<p>I&#8217;m really tired of reading specs (I&#8217;m sure this will pass), so in absence of a <a href="http://lists.w3.org/Archives/Public/www-svg/2010Sep/0081.html">reference rendering</a> of this page, we&#8217;ll just need to do what we always do: Make it look the same across all browsers.  Now that we have IE9, it can act as a tie-breaker between renderings that could be argued one way or the other <img src='http://www.codedread.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Hopefully I&#8217;ll be able to talk more about these 16 cases in the future.  Now you know where to come if you&#8217;re having trouble sleeping.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codedread.com/blog/archives/2010/09/21/start-chopping-off-heads/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>kthoom!</title>
		<link>http://www.codedread.com/blog/archives/2010/04/12/kthoom/</link>
		<comments>http://www.codedread.com/blog/archives/2010/04/12/kthoom/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 12:55:51 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[comics]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://www.codedread.com/blog/?p=832</guid>
		<description><![CDATA[[clipart]Sometimes I get an idea and I just have to see it through to a point where it will let my brain go. At work Thursday we were all slobbering over Steve&#8217;s iPad and someone brought up how cool the Marvel app is. I had to admit it was much nicer than any piece of [...]]]></description>
			<content:encoded><![CDATA[<p><object type="image/svg+xml" width="100" height="100" style="float:right" data="http://codedread.com/clipart/kthoom.svgz">[clipart]</object>Sometimes I get an idea and I just have to see it through to a point where it will let my brain go.  At work Thursday we were all slobbering over <a href="http://nuthatch.com/blog/">Steve&#8217;s</a> iPad and someone brought up how cool the <a href="http://marvel.com/news/comicstories.11835.download_the_official_marvel_comics_ipad_app">Marvel app</a> is.  I had to admit it was much nicer than any piece of software I&#8217;d used for viewing comics before on my laptop.</p>
<p>In the meantime, I&#8217;ve been carefully watching WebKit creep <a href="https://bugs.webkit.org/show_bug.cgi?id=32624">closer</a> and <a href="https://bugs.webkit.org/show_bug.cgi?id=36567">closer</a> to implementing the <a href="http://www.w3.org/TR/FileAPI/">W3C File API</a> (Go Kinuko!).  Something I&#8217;ve been eagerly waiting for more browsers to do so you can open up local files in <a href="http://svg-edit.googlecode.com/">SVG-edit</a>.</p>
<p>And then it hit me. <span id="more-832"></span></p>
<p>Why not a comic book reader done directly in the browser?</p>
<p>In case you don&#8217;t know, <a href="http://en.wikipedia.org/wiki/Comic_Book_Archive_file">comic book archive files</a> are just ZIP or RAR files containing JPEG images.  Browsers can handle images.  Some browsers can now handle opening local files.  Even binary ones.  So theoretically you could write unzip/unrar in pure JavaScript, extract the JPEGs, turn them into data: URIs and shove them into an &#60;image&#62; element.  You can even do the unzipping in a separate thread using <a href="http://www.whatwg.org/specs/web-workers/current-work/">Web Workers</a>.</p>
<p>Theoretically.</p>
<p><a href="http://code.google.com/p/kthoom/">kthoom</a> was how far I was able to get in a weekend.</p>
<p>Some limitations:</p>
<ul>
<li><a href="http://code.google.com/p/kthoom/issues/detail?id=10">Unzipping is slow</a>.  None of the code has been optimized yet and I&#8217;m probably doing a lot of really stupid things.</li>
<li>Only supports CBZ files, <a href="http://code.google.com/p/kthoom/issues/detail?id=9">not CBR files</a> at the moment &#8211; I am accepting patches</li>
<li>Unzipping is <em>really</em> slow.  I need to <a href="http://code.google.com/p/kthoom/issues/detail?id=8">provide visual progress reporting</a> from the Web Worker thread, I know.</li>
<li>kthoom will crash Firefox 3.6 about half the time.  Firefox nightly (3.7) seems to handle it just fine.  I opened <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=558621">this bug</a>.</li>
<li>Did I mention that unzipping is slow?</li>
</ul>
<p>If I&#8217;m honest, this was really an exercise to see just how easy/hard it would be to do something like this in the browser &#8211; and to get some hands-on experience with Web Workers.  And hey, I&#8217;m not the <a href="http://jsxgraph.uni-bayreuth.de/wp/">first</a> or even <a href="http://github.com/tlrobinson/zipjs">second</a> person to think of doing unzip/deflate in JavaScript either.</p>
<p>It was my first experience writing JavaScript to handle binary files.  It was fun.  It took a weekend.  </p>
<p>Some essential tools:  Firebug, a hex editor, pen &#38; paper, a clear mind, patience.</p>
<p>Now swinging my attention back to stuff I should be working on&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codedread.com/blog/archives/2010/04/12/kthoom/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MIX 10k Code Challenge += SVG</title>
		<link>http://www.codedread.com/blog/archives/2010/01/14/mix-10k-code-challenge-svg/</link>
		<comments>http://www.codedread.com/blog/archives/2010/01/14/mix-10k-code-challenge-svg/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 15:56:59 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://blog.codedread.com/archives/2010/01/14/mix-10k-code-challenge-svg/</guid>
		<description><![CDATA[[clipart]I came across the MIX 10k Coding Challenge on the weekend, and on a whim I decided to submit one of my old SVG demos to the contest. The 10k challenge&#8217;s tagline is &#8220;What could you create for the Web if you had only 10 kilobytes of code?&#8221;. The rules didn&#8217;t explicitly say I could [...]]]></description>
			<content:encoded><![CDATA[<p><object type="image/svg+xml" width="100" height="100" style="float:right" data="http://codedread.com/clipart/villain.svgz">[clipart]</object>I came across the <a href="http://mix10k.visitmix.com/">MIX 10k Coding Challenge</a> on the weekend, and on a whim I decided to submit one of my old SVG demos to the contest.  The 10k challenge&#8217;s tagline is &#8220;What could you create for the Web if you had only 10 kilobytes of code?&#8221;.  The rules didn&#8217;t explicitly say I could use pure SVG, they mention SVG/Canvas in the context of HTML5 only, but I thought I&#8217;d give it a shot.  It&#8217;s in the spirit of the contest, after all.  At the very least it would encourage Microsoft to clarify the rules and at the very best it would be accepted and the rules updated to allow pure SVG applications.  Looks like it was my lucky day.<span id="more-551"></span></p>
<p>I decided to go with my <a href="http://codedread.com/solitaire.php">Solitaire</a> demo because it was the most complete, didn&#8217;t infringe on any copyrights (looking at you Tetris), and most visually recognizable.  It&#8217;s not the most innovative, but then again the point of this is not necessarily to win any prizes.  It&#8217;s really about increasing awareness.</p>
<p>Unfortunately, the SVG (26kb) and JavaScript (16kb + 21kb) totaled 63kb.  I did some cleanup of the SVG, minified the JS and then put the script inline with the SVG and then gzipped it.  The result was a .svgz file that was 9kb.  Perfect!</p>
<p>I then got an email from a friendly marketing/evangelism person at Microsoft who said that the engineers did not know how to open the svgz file to review the code to ensure it was under 10k.  Woops!  I explained to her that I thought it would be ok for the SVG to be gzipped, much as PNG/GIF files use compression and sent her the uncompressed SVG file for them to review.  After all, SVG is just an image format, right? <img src='http://www.codedread.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Was I following the rules?  Did Microsoft give me a fair shake?  <a href="http://mix10k.visitmix.com/Entry/Details/160">See for yourself</a>.  Who knows, maybe this is the first time a Microsoft admin had to figure out how to serve SVG on a Microsoft web server.</p>
<p>Out of curiosity, I later tried to see how far I was able to get down the Solitaire game: <a href="http://codedread.com/solitaire.svgz">5811 bytes</a>.  Not bad for a complete game that has scalable graphics.  I&#8217;d be curios to see the equivalent SWF file.</p>
<p>I don&#8217;t expect you to vote for my entry, but what I do expect you to do is now go out and submit .SVGZ entries to the MIX 10k challenge.  That one SVG entry is looking pretty lonely.  If I can get Solitaire down to 5811 bytes, surely you can do better?</p>
<p>Thanks a lot to Amy, the evangelist/marketing person who really was quite patient with me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codedread.com/blog/archives/2010/01/14/mix-10k-code-challenge-svg/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>HTML5 += Intertwingly</title>
		<link>http://www.codedread.com/blog/archives/2008/12/15/html5-intertwingly/</link>
		<comments>http://www.codedread.com/blog/archives/2008/12/15/html5-intertwingly/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 16:07:27 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[sam ruby]]></category>
		<category><![CDATA[w3c]]></category>

		<guid isPermaLink="false">http://blog.codedread.com/archives/2008/12/15/html5-intertwingly/</guid>
		<description><![CDATA[Sam Ruby has just been appointed co-chair of the HTML5 Working Group. In addition to being an early adopter of HTML5, Sam has been a loud proponent of distributed extensibility within HTML and a vocal critic of the entire HTML5 process in general. I&#8217;m glad to see Sam is putting his money where his mouth [...]]]></description>
			<content:encoded><![CDATA[<p><object type="image/svg+xml" width="100" height="100" style="float:right" data="http://codedread.com/clipart/party.svgz"><span/></object><object type="image/svg+xml" width="100" height="100" style="float:right" data="http://codedread.com/clipart/html.svgz"><span/></object><a href="http://intertwingly.net/blog" title="Sam Ruby">Sam Ruby</a> has just been <a href="http://lists.w3.org/Archives/Public/public-html/2008Dec/0145.html">appointed co-chair</a> of the <a href="http://www.w3.org/html/wg/" title="HTML Working Group">HTML5 Working Group</a>.  In addition to being an early adopter of HTML5, Sam has been a loud proponent of <a href="http://www.intertwingly.net/blog/2007/08/02/HTML5-and-Distributed-Extensibility" title="Distributed extensibility proposal for HTML5">distributed extensibility</a> within HTML and a <a href="http://intertwingly.net/blog/2007/11/29/HTML5-needs-a-CarterPhone">vocal</a> <a href="http://intertwingly.net/blog/2008/11/20/Half-Full">critic</a> of the entire HTML5 process in general.  I&#8217;m glad to see Sam is putting his money where his mouth is.  It will be very interesting to see how this will affect the dynamics of the Working Group.</p>
<p>A warm congratulations to Sam and a heartfelt <em>Good Luck</em>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codedread.com/blog/archives/2008/12/15/html5-intertwingly/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

