<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>MemeRocket &#187; CSS</title>
	<atom:link href="http://memerocket.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://memerocket.com</link>
	<description>Bill Burcham's Launch Platform</description>
	<lastBuildDate>Tue, 08 Nov 2011 19:50:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='memerocket.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/048c0b3b1b3b5279e320104a4b5d0bb0?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>MemeRocket &#187; CSS</title>
		<link>http://memerocket.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://memerocket.com/osd.xml" title="MemeRocket" />
	<atom:link rel='hub' href='http://memerocket.com/?pushpress=hub'/>
		<item>
		<title>OOCSS + SASS = Fewer Classes On Your Elements</title>
		<link>http://memerocket.com/2009/03/28/oocss-sass-fewer-classes-on-your-elements/</link>
		<comments>http://memerocket.com/2009/03/28/oocss-sass-fewer-classes-on-your-elements/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 23:44:06 +0000</pubDate>
		<dc:creator>Bill Burcham</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://memerocket.com/?p=164</guid>
		<description><![CDATA[update 3/29/2009 8:23 AM: Turns out Chris Eppstein is way ahead of me. Check out Compass. It&#8217;s a project that delivers your favorite CSS frameworks as SASS mix-ins. Oh and also it integrated with your favorite Ruby web development framework. Stubbornella &#8230; <a href="http://memerocket.com/2009/03/28/oocss-sass-fewer-classes-on-your-elements/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=164&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>update</strong> 3/29/2009 8:23 AM: Turns out <a href="http://acts-as-architect.blogspot.com/">Chris Eppstein</a> is way ahead of me. Check out <a href="http://compass-style.org/">Compass</a>. It&#8217;s a project that delivers your favorite <a href="http://wiki.github.com/chriseppstein/compass/supported-frameworks">CSS frameworks</a> as SASS mix-ins. Oh and also it integrated with your favorite Ruby web development framework.</p>
<p>Stubbornella you have captivated me. I am now watching <a href="http://www.stubbornella.org/content/">Nicole Sullivan</a>&#8216;s <a href="http://www.stubbornella.org/content/2009/03/23/object-oriented-css-video-on-ydn/">Object Oriented CSS talk</a> for the second time. The <a href="http://wiki.github.com/stubbornella/oocss">OOCSS framework</a> is a terse but ambitious thing in the tradition of <a href="http://developer.yahoo.com/yui/grids/">YUI Grids CSS</a> and <a href="http://www.blueprintcss.org/">Blueprint</a> but with opinions that reach beyond grids, resets and typography.</p>
<p>While I have certainly not mastered the OOCSS concepts I do have some early observations I&#8217;d like to share nevertheless. This of course is dangerous territory since I risk having to eat my words later. So be it. Feel free to feed ’em to me as appropriate…</p>
<p>It strikes me from looking at the <a href="http://wiki.github.com/stubbornella/oocss/uml">UML diagram</a> for OOCSS that something is missing, or more accurately, some things are being conflated which shouldn&#8217;t be. If we&#8217;re thinking about objects and classes here the first question should be: what are we modeling? Well the <a href="http://en.wikipedia.org/wiki/HTML#Semantic_HTML">semantic HTML</a> folks might say we need to model things like paragraphs and headings, or at another level contacts and phone numbers, or at another level sidebars and navigation. These are all semantics.</p>
<p>When we think about modeling these things in HTML in such as way that CSS can be profitably applied, we use HTML element types to directly model semantics where we can (p element for paragraph, h1 element for top-level heading) and we use class attributes to express the rest (&#8216;top-nav&#8217;, &#8216;address&#8217;, &#8216;phone&#8217;). If you have a look at the OOCSS UML diagram you will see in the &#8220;page layout&#8221; section a set of classes that fall into the former category ( &#8216;doc&#8217;, &#8216;hd&#8217; for header, &#8216;bd&#8217; for body, &#8216;ft&#8217; for footer).</p>
<p>So far so good. But now how do we actually extend a class? The approach suggested in OOCSS is to change the (HTML) markup. One example from the talk is to specialize the media block class &#8216;media&#8217; so that the fixed-size media is on the right instead of on the left. The suggestion is to define a new class &#8216;media_ext&#8217; along with a new set of CSS rules. Then the idea is to change our HTML so that the element of interest carries two classes: &#8216;media&#8217; and &#8216;media_ext&#8217;. And then we define some CSS for the new media_ext module, something like this:</p>
<pre>.media_ext .fixedMedia { float:right }</pre>
<p>This is the fundamental approach in OOCSS, so fundamental that it is on the short list of <em>10 Best Practices</em> from slide 19 of <a href="http://www.slideshare.net/stubbornella/object-oriented-css">the talk</a>:</p>
<p style="padding-left:30px;">9. Extend objects by applying multiple classes to an element</p>
<p>The library defines a small set of base classes and a few core extensions to those. Users are invited to extend these further and we change our HTML to carry the full set of classes expressing semantics, layout and skinning too, all as separate classes.</p>
<p>The value in this approach is it certainly brings order to chaos. The downside is twofold: first we must pollute our HTML with layout and skinning choices and second, we must rely solely on coding conventions to ensure that each HTML element carries a self-consistent and complete set of classes.</p>
<p style="padding-left:30px;">aside: To me this feels much more akin to structured programming or maybe at best &#8220;abstract data types&#8221; than it does OO. I don&#8217;t really see language-level inheritance here, nor do I see polymorphism. But that&#8217;s just a terminological nit.</p>
<p>The first problem we need to solve is to get rid of the superfluous classes (on our elements). How could we make a media block (&#8220;fixed-width media object on the left with an open editable zone on the right&#8221;) into a right-handed media block without changing our HTML? Well the classic way in CSS is to use context to distinguish this situation. So let&#8217;s imagine that every odd media block ought to be right-handed. A classic approach is to have an &#8216;odd&#8217; class on the element (or to use nth-child pseudo class). Perhaps something like this:</p>
<pre>.media.odd .fixedMedia { float:right }</pre>
<p>Where target is the fixed-width object we&#8217;d like to be on the right-hand side instead of the left. You get the idea. The problem with this approach is that we&#8217;ve just coded up some potentially reusable stuff (the {float:right} part) and we&#8217;ve got no way to reuse it in other circumstances. Also we are now guilty of committing pitfall #1 from the talk:</p>
<p style="padding-left:30px;">1. Location dependent styles</p>
<p>So you can see that we are definitely violating a key tennet of OOCSS. If you&#8217;re already an OOCSS dogmatist you may want to stop reading now. Still with me? OK, what if we want a right-hand media block for even rows next time? We&#8217;d have to edit that last CSS rule to look something like this:</p>
<pre>.media.even .fixedMedia { float:right }</pre>
<p>Yuck. What&#8217;s going on here? The problem is that CSS has no named/reusable/callable construct. No macro. No function. No Class. OOCSS does the best it can with plain old CSS by requiring us to define a new HTML class name. That lets us define a reusable set of CSS rules for it, but at the cost of polluting our HTML at each use.</p>
<p>I think a good way out of this is to break out of plain old CSS into a higher realm. Both <a href="http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html">SASS</a> and <a href="http://shauninman.com/archive/2007/06/27/css_server_side_pre_processor">CSS-SSC</a> have a macro concept. SASS has its mixins and CSS-SSC has its base and based-on. What these actually add to CSS is named abstractions and reuse. So I could define a SASS mixin like this:</p>
<pre>=right-hand-media
  .fixedMedia
    float: right</pre>
<p>Now that is a reusable module. In my application I can apply that module to an element:</p>
<pre>.media.odd
  +right-hand-media</pre>
<p>Yay. Now I have the best of both worlds. If we have another app that wants even media items to be right-handed then we just define this:</p>
<pre>.media.even
  +right-hand-media</pre>
<p>The value of this is that I didn&#8217;t have to change my HTML markup in order to change the layout. There are examples of using the same approach to define a <a href="http://wonderfullyflawed.com/2008/05/21/clearfix-as-mixin/">clearfix module</a>. To those who say this approach is going to generate a lot of CSS I say, &#8220;well maybe, but I think our first priority needs to be making our source code manageable and this approach may just help us do that.&#8221;</p>
<p>As I already pointed out, this proposal (using SASS mix-ins or CSS-SSC macros to implement reusable modules, and then using contextual CSS Rules to apply those modules) violates a core principle of OOCSS. On the upside it solves one of the wish list items from the <a href="http://www.slideshare.net/stubbornella/object-oriented-css">talk</a> (on slide 60):</p>
<p style="padding-left:30px;">1. Extending objects—possible to make &#8220;sale module&#8221; inherit from &#8220;module&#8221;</p>
<p style="padding-left:30px;">
<pre>.module{}
.saleModule{extends: module}</pre>
<p>Now that approach is a bit different from the one I described for right-hand-media. But it is clear that mix-ins or macros could easily be used to reuse .module in .saleModule right? SASS mix-ins, for instance can be used (as in my first example) as straight-up mix-ins, or to implement inheritance. The choice is yours.</p>
<p>To close, I highly recommend watching the <a href="http://us.dl1.yimg.com/download.yahoo.com/dl/ydn/nicolesullivan.m4v">Stubbornella&#8217;s presentation</a>. <strong>Twice</strong>. There is just a ton of gold in there. Meanwhile, I&#8217;ll go experiment with SASS mix-ins and let you know how it works in practice and how it can be combined with some of the other principles highlighted in the talk.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/memerocket.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/memerocket.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/memerocket.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/memerocket.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/memerocket.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/memerocket.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/memerocket.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/memerocket.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/memerocket.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/memerocket.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/memerocket.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/memerocket.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/memerocket.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/memerocket.wordpress.com/164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=164&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://memerocket.com/2009/03/28/oocss-sass-fewer-classes-on-your-elements/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
<enclosure url="http://us.dl1.yimg.com/download.yahoo.com/dl/ydn/nicolesullivan.m4v" length="583962269" type="video/x-m4v" />
	
		<media:content url="http://0.gravatar.com/avatar/a88a8da103044de18418f303bf0c1507?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">bburcham</media:title>
		</media:content>
	</item>
		<item>
		<title>A Curmudgeon We All Can Love</title>
		<link>http://memerocket.com/2007/11/08/a-curmudgeon-we-all-can-love/</link>
		<comments>http://memerocket.com/2007/11/08/a-curmudgeon-we-all-can-love/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 18:57:18 +0000</pubDate>
		<dc:creator>Bill Burcham</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[One Step Forward]]></category>
		<category><![CDATA[Web as Platform]]></category>

		<guid isPermaLink="false">http://www.meme-rocket.com/2007/11/08/a-curmudgeon-we-all-can-love/</guid>
		<description><![CDATA[Douglas Crockford, purveyor of the JSONRequest spec, is cranky in a polite sort of way. He also happens to be right! Check out the video of his recent talk on The State of AJAX. Crockford takes us through a brief &#8230; <a href="http://memerocket.com/2007/11/08/a-curmudgeon-we-all-can-love/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=90&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-188" title="rhinobookthumbnail" src="http://memerocket.files.wordpress.com/2009/03/rhinobookthumbnail.gif?w=520" alt="rhinobookthumbnail"   />Douglas Crockford, purveyor of the <a href="http://json.org/JSONRequest.html">JSONRequest spec</a>, is cranky in a polite sort of way. He also happens to be right!  Check out the video of his recent talk on <a href="http://yuiblog.com/blog/2007/11/06/video-crockford/">The State of AJAX</a>.</p>
<p>Crockford takes us through a brief history of computing reminding us, as we&#8217;ve been reminded before, that the Web interaction model is practically the same as the mainframe 3270 interaction model circa 1972.</p>
<p>The most potent moment in the talk however, is when he shows a shot of a mermaid rendered via a run of the mill nvidia subsystem and dryly points out &#8220;look, rounded corners&#8221;. The upshot: the 1984 Macintosh had rounded corners â€” browsers were obsolete from the git go and there is a huge and widening gap between what you do in a web app and what you do in a non-web one.</p>
<p>Oh and I&#8217;m making <a href="http://www.crockford.com/">Crockford</a> my <em>Personal Hero of the Month</em> for pointing out that not only are our web technologies based on eight-year-old standards (HTML 4.0.1, ECMAscript ed. 3, CSS 3) started in &#8217;98 and still under development but that of those, CSS is the <a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets#Limitations">worst</a> of the lot and should be replaced with urgent haste. Refreshing respite from the usual <a href="http://www.transcendingcss.com/">CSS love</a>.</p>
<p>&#8220;Don&#8217;t take any crap.&#8221;</p>
<p><strong>update</strong>: watch this space for my growing list of <em>web standards revolutionaries</em>:</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/memerocket.wordpress.com/90/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/memerocket.wordpress.com/90/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/memerocket.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/memerocket.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/memerocket.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/memerocket.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/memerocket.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/memerocket.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/memerocket.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/memerocket.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/memerocket.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/memerocket.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/memerocket.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/memerocket.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/memerocket.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/memerocket.wordpress.com/90/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=90&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://memerocket.com/2007/11/08/a-curmudgeon-we-all-can-love/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a88a8da103044de18418f303bf0c1507?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">bburcham</media:title>
		</media:content>

		<media:content url="http://memerocket.files.wordpress.com/2009/03/rhinobookthumbnail.gif" medium="image">
			<media:title type="html">rhinobookthumbnail</media:title>
		</media:content>
	</item>
		<item>
		<title>ID Proliferation Eradication Technique #1: Leverage page.select with page.insert</title>
		<link>http://memerocket.com/2007/07/05/id-proliferation-eradication-technique-1-leverage-pageselect-with-pageinsert/</link>
		<comments>http://memerocket.com/2007/07/05/id-proliferation-eradication-technique-1-leverage-pageselect-with-pageinsert/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 17:37:27 +0000</pubDate>
		<dc:creator>Bill Burcham</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[RJS templates]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.meme-rocket.com/2007/07/05/id-proliferation-eradication-technique-1-leverage-pageselect-with-pageinsert/</guid>
		<description><![CDATA[update 3/29/2009 8:34 AM: In November, 2007 Brad Wilson pointed out an even cleaner fix. Rather than relying on page.select you can just use page.literal to inject (literal) JavaScript code right where you want it. So recasting my example using &#8230; <a href="http://memerocket.com/2007/07/05/id-proliferation-eradication-technique-1-leverage-pageselect-with-pageinsert/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=76&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="padding-left:30px;"><strong>update</strong> 3/29/2009 8:34 AM: In November, 2007 <a href="http://sentia.com.au/2009/03/using-javascript-code-for-rjs-instead-of-ids/">Brad Wilson pointed out</a> an even cleaner fix. Rather than relying on page.select you can just use page.literal to inject (literal) JavaScript code right where you want it. So recasting my example using page.literal it would look something like this:</p>
<pre class="textmate-source twilight" style="padding-left:30px;"><span class="linenum">    1</span> <span class="source source_ruby source_ruby_rails">page.insert_html <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:bottom</span>, page.literal( <span class="string string_quoted string_quoted_double string_quoted_double_ruby">"$$( '#contact_<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source">#{<span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby">@contact</span>.id}</span> .email-category ul'</span>).first" ), <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:partial</span> =&gt; <span class="string string_quoted string_quoted_single string_quoted_single_ruby">'show'</span>, <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:locals</span> =&gt; {<span class="meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block"> </span><span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:show</span> =&gt; <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby">@email_address</span>}</span></pre>
<p>In <a href="2007/04/10/fight-id-proliferation-and-update-any-element-you-want/">Fight id Proliferation</a> I highlighted the prevalent misunderstanding of the prototype API&#8217;s insert_html, replace_html and friends that is evident both in the Prototype documentation and in Rails. Due to that misunderstanding, many of us are polluting our HTML with many more id attributes than would otherwise be necessary. In the original post I proposed a fix to Rails to remedy the situation and allow us to use CSS selectors to identify a target HTML element for the various calls. In this post I provide a workaround you can use now, while waiting for a cleaner fix.</p>
<p><span id="more-76"></span></p>
<p>Previously, I pointed out that we&#8217;d really like to use page.select and more generally, any expression that produces an element, as e.g. the second parameter to page.insert_html.Â  So it would be really nice if this worked:</p>
<pre class="textmate-source twilight"><span class="linenum">    1</span> <span class="source source_ruby source_ruby_rails">page.insert_html <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:bottom</span>, page.select( <span class="string string_quoted string_quoted_double string_quoted_double_ruby">"#contact_<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source">#{<span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby">@contact</span>.id}</span> .email-category ul"</span>).first, <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:partial</span> =&gt; <span class="string string_quoted string_quoted_single string_quoted_single_ruby">'show'</span>, <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:locals</span> =&gt; {<span class="meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block"> </span><span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:show</span> =&gt; <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby">@email_address</span>}</span></pre>
<p>If that worked, we wouldn&#8217;t need an id on each element representing the email address for a contact.Â  Instead we&#8217;d just put an id on the contact (at the outer level) and we&#8217;d tag the parts of the contact (email address, phone number, etc) with appropriate classes. Much more microformatty.</p>
<p>Well, as you know, you can&#8217;t do that just now in Rails. But there is a workaround.Â  It&#8217;s a bit ugly but it works. And the ugliness is in the RJS, not in the HTML. So your markup is smaller and cleaner, even if you&#8217;re generating an extra line of JavaScript.</p>
<p>The workaround is to use the <code>each</code> method on the result of calling <code>page.select</code>. This lets you iterate (in the browser) over the elements returned from evaluating the CSS selector. Within that iteration, you have available the element of interest. Now that you&#8217;ve got an element, you can call the various page methods that require an element or id such as <code>page.insert position, element</code>. You can also call methods directly on the element itself such as <code>element.reset</code>. Here&#8217;s the previous example recast in this way:</p>
<pre class="textmate-source twilight"><span class="linenum">    1</span> <span class="source source_ruby">              page.select( <span class="string string_quoted string_quoted_double string_quoted_double_ruby">"#contact_<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source">#{<span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby">@contact</span>.id}</span> .email-category ul"</span>).each <span class="keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block">do </span>|element|
<span class="linenum">    2</span>                 page.insert_html <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:bottom</span>, element, <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:partial</span> =&gt; <span class="string string_quoted string_quoted_single string_quoted_single_ruby">'show'</span>, <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:locals</span> =&gt; {<span class="meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block"> </span><span class="constant constant_other constant_other_symbol constant_other_symbol_ruby">:show</span> =&gt; <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby">@email_address</span>}
<span class="linenum">    3</span>               <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>This works great in Rails 1.2 even if it is a little bit ugly. By ugly I mean that the code doesn&#8217;t exactly express what we want. Notice that the original code was selecting the <code>first</code> element matched by the CSS selector whereas the workaround code is iterating over all elements matched. So long as you&#8217;re careful to construct CSS selectors that match exactly the number of elements you&#8217;re really after though, you should be ok.</p>
<p>Here&#8217;s a similar snippet but this one calls the Prototype <code>reset</code> method on the element:</p>
<pre class="textmate-source twilight"><span class="linenum">    1</span> <span class="source source_ruby">              page.select( <span class="string string_quoted string_quoted_double string_quoted_double_ruby">"#contact_<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source">#{<span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby">@contact</span>.id}</span> .email-category form"</span>).each <span class="keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block">do </span>|element|
<span class="linenum">    2</span>                 element.reset
<span class="linenum">    3</span>               <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>By tagging only top-level elements with id&#8217;s and using classes to tag internal components you end up with cleaner HTML. This is valuable anywhere you present a list of complex, editable objects. For example, here is one contact of many displayed in a list:</p>
<p><img class="alignnone size-medium wp-image-161" title="Contact Email Address" src="http://memerocket.files.wordpress.com/2009/03/firefoxscreensnapz037.jpg?w=300&#038;h=109" alt="Contact Email Address" width="300" height="109" /></p>
<p>Each contact has a set of email addresses, blog URL&#8217;s and phone numbers. We don&#8217;t want to have to assign id&#8217;s to every single phone number, blog URL and email address on the page. Instead we assign id&#8217;s only to the top-level elements. Here is a contact list with <code>contact_19</code> expanded. Under <code>contact-details</code> we&#8217;ve got email addresses under an element with classes <code>contact-category</code> and <code>email-category</code>. That element contains both the unordered list of email addresses and a form to add new ones:</p>
<pre class="textmate-source twilight"><span class="linenum">    1</span> <span class="text text_html text_html_basic"><span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">ul</span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">class</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>contacts-list editable<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">    2</span>     <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">li</span> <span class="meta meta_attribute-with-value meta_attribute-with-value_id meta_attribute-with-value_id_html"><span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_id entity_other_attribute-name_id_html">id</span><span class="punctuation punctuation_separator punctuation_separator_key-value punctuation_separator_key-value_html">=</span><span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span><span class="meta meta_toc-list meta_toc-list_id meta_toc-list_id_html">contact_25</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span></span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">class</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>contact-summary<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">    3</span>     <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">li</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">    4</span>     <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">li</span> <span class="meta meta_attribute-with-value meta_attribute-with-value_id meta_attribute-with-value_id_html"><span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_id entity_other_attribute-name_id_html">id</span><span class="punctuation punctuation_separator punctuation_separator_key-value punctuation_separator_key-value_html">=</span><span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span><span class="meta meta_toc-list meta_toc-list_id meta_toc-list_id_html">contact_19</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span></span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">class</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>contact-summary<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">    5</span>         <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">class</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>name<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>support@thought-propulsion.com<span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">    6</span>         <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">class</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>contact-details<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">style</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">    7</span>             <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">class</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>contact-category email-category<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">    8</span>                 <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">h2</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>Email Addresses<span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">h2</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">    9</span>                 <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">ul</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   10</span>                     <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">li</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>support@thought-propulsion.com<span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">li</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   11</span>                 <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">ul</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   12</span>             <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   13</span>             <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">class</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>contact-category blog-category<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   14</span>             <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   15</span>             <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">class</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>contact-category phone-category<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   16</span>             <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   17</span>         <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">div</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   18</span>     <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">li</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   19</span>     <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">li</span> <span class="meta meta_attribute-with-value meta_attribute-with-value_id meta_attribute-with-value_id_html"><span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_id entity_other_attribute-name_id_html">id</span><span class="punctuation punctuation_separator punctuation_separator_key-value punctuation_separator_key-value_html">=</span><span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span><span class="meta meta_toc-list meta_toc-list_id meta_toc-list_id_html">contact_22</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span></span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">class</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>contact-summary<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   20</span>     <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">li</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>
<span class="linenum">   21</span> <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">ul</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span></span></pre>
<p>So if you want to use <a href="http://www.juixe.com/techknow/index.php/2007/04/03/simply-helpful-rails-plugin/">Simply Helpful</a> to generate your top-level id&#8217;s have at it, but you needn&#8217;t use it to generate id&#8217;s for all the internal parts just because of a little misunderstanding :)</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/memerocket.wordpress.com/76/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/memerocket.wordpress.com/76/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/memerocket.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/memerocket.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/memerocket.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/memerocket.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/memerocket.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/memerocket.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/memerocket.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/memerocket.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/memerocket.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/memerocket.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/memerocket.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/memerocket.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/memerocket.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/memerocket.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=76&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://memerocket.com/2007/07/05/id-proliferation-eradication-technique-1-leverage-pageselect-with-pageinsert/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a88a8da103044de18418f303bf0c1507?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">bburcham</media:title>
		</media:content>

		<media:content url="http://memerocket.files.wordpress.com/2009/03/firefoxscreensnapz037.jpg?w=300" medium="image">
			<media:title type="html">Contact Email Address</media:title>
		</media:content>
	</item>
		<item>
		<title>Safari 3 Beta Nav List Eschews Anchors in Favor of CSS cursor Property and Click Events</title>
		<link>http://memerocket.com/2007/06/22/safari-3-beta-nav-list-eschews-anchors-in-favor-of-css-cursor-property-and-click-events/</link>
		<comments>http://memerocket.com/2007/06/22/safari-3-beta-nav-list-eschews-anchors-in-favor-of-css-cursor-property-and-click-events/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 23:22:25 +0000</pubDate>
		<dc:creator>Bill Burcham</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://www.meme-rocket.com/2007/06/22/safari-3-beta-nav-list-eschews-anchors-in-favor-of-css-cursor-property-and-click-events/</guid>
		<description><![CDATA[The Safari 3 Public Beta page has a nice little navigation list in the middle: 12 reasons you&#8217;ll love Safari. It&#8217;s kind of &#8220;semantic&#8221; markup since it uses an ordered list to enumerate the choices (as opposed to e.g. a &#8230; <a href="http://memerocket.com/2007/06/22/safari-3-beta-nav-list-eschews-anchors-in-favor-of-css-cursor-property-and-click-events/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=75&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.apple.com/safari/"><span>Safari 3 Public Beta page</span></a> has a nice little navigation list in the middle: <span style="font-style:italic;">12 reasons you&#8217;ll love Safari</span>. It&#8217;s kind of &#8220;semantic&#8221; markup since it uses an ordered list to enumerate the choices (as opposed to e.g. a table or something). And it&#8217;s kind of separating content from presentation with its use of CSS to style the list items &#8212; including nice visual differentiation for the <span style="font-style:italic;">active</span> (selected) item. All this is pretty standard stuff for readers of Dan Cederholm&#8217;s <span style="font-style:italic;">Web Standards Solutions</span>. And rather than reloading the whole page on each navigation click, the site is using XMLHttpRequest to load just a small section. Again, nothing surprising here.</p>
<p>What is a little surprising is the page&#8217;s departure from the common practice of using anchor tags within the list items. Instead of each list item containing a hyperlink, it contains plain old text. Since there is no hyperlink, the browser won&#8217;t provide a visual cue that the item is navigable/clickable. That&#8217;s kind of ok since most designers go to pains to undo some of the cue anyway &#8212; I&#8217;m talking about eliminating underlining. The other cue &#8212; changing the cursor to the <span style="font-style:italic;">pointer</span> image when mousing over the &#8220;active&#8221; list item, is implemented via a CSS rule. Then all that&#8217;s left is to catch the click events in JavaScript code.  Here&#8217;s the markup:</p>
<p><img class="alignnone size-medium wp-image-198" title="firefoxscreensnapz033" src="http://memerocket.files.wordpress.com/2007/06/firefoxscreensnapz033.jpg?w=300&#038;h=94" alt="firefoxscreensnapz033" width="300" height="94" /></p>
<p>It&#8217;s a pretty design and it works really nice. On the other hand it is not an example of &#8220;unobtrusive JavaScript&#8221; or of &#8220;graceful degradation&#8221;. I am pointing this out not to be dogmatic about these things, rather to cite it as evidence of the difficulty of applying the aforementioned philosophies.  Here you have a lovely page, built by the best designers money can buy. It doesn&#8217;t get much more high profile than this. And these guys went ahead and built a page that requires JavaScript. Made me think. I hope it makes you think too.</p>
<p>This feels like it&#8217;s going to be a bit of a recurring theme here (see the recent <a href="/2007/05/18/tableful-grace/">Tableful Grace</a> post). Graceful degradation with respect to JavaScript, CSS, heck even background images; separation of behavior from content; table-less layout &#8212; these are great philosophies. But the practice is riddled with subtlety and compromise. And you wouldn&#8217;t really know it from reading the short &#8220;gee look what I can do&#8221; type articles.</p>
<p>I&#8217;m curious to know how you feel about these new sacred cows now that we&#8217;ve had a little experience with them. For example, are you implementing whole applications with graceful degradation or only pieces of your application? If it&#8217;s the latter, are you getting any real benefit? Does graceful degradation double your testing effort?</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/memerocket.wordpress.com/75/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/memerocket.wordpress.com/75/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/memerocket.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/memerocket.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/memerocket.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/memerocket.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/memerocket.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/memerocket.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/memerocket.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/memerocket.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/memerocket.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/memerocket.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/memerocket.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/memerocket.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/memerocket.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/memerocket.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=75&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://memerocket.com/2007/06/22/safari-3-beta-nav-list-eschews-anchors-in-favor-of-css-cursor-property-and-click-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a88a8da103044de18418f303bf0c1507?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">bburcham</media:title>
		</media:content>

		<media:content url="http://memerocket.files.wordpress.com/2007/06/firefoxscreensnapz033.jpg?w=300" medium="image">
			<media:title type="html">firefoxscreensnapz033</media:title>
		</media:content>
	</item>
		<item>
		<title>Heinous Corner-Rounding of the Day Award (HCROD) #1: Powells Books (div per image)</title>
		<link>http://memerocket.com/2007/06/21/heinous-corner-rounding-of-the-day-award-hcrod-1-powells-books-div-per-image/</link>
		<comments>http://memerocket.com/2007/06/21/heinous-corner-rounding-of-the-day-award-hcrod-1-powells-books-div-per-image/#comments</comments>
		<pubDate>Thu, 21 Jun 2007 17:47:25 +0000</pubDate>
		<dc:creator>Bill Burcham</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://www.meme-rocket.com/2007/06/21/heinous-corner-rounding-of-the-day-award-hcrod-1-powells-books-div-per-image/</guid>
		<description><![CDATA[My sister recently sent me an (online) gift certificate to Powells books. I just love those stores but had never been to the web site. It turns out that the site, like the stores, is exceptionally cool. You can browse &#8230; <a href="http://memerocket.com/2007/06/21/heinous-corner-rounding-of-the-day-award-hcrod-1-powells-books-div-per-image/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=74&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My sister recently sent me an (online) gift certificate to <a href="http://www.powells.com">Powells books</a>. I just love those stores but had never been to the web site. It turns out that the site, like the stores, is exceptionally cool. You can browse for books and then print out a shopping list for your store visit. And there is all kinds of useful organization such as the <a href="http://www.powells.com/technicalbooks">technical section</a>, and the <a href="http://www.powells.com/portland/">Portland local section</a>.</p>
<p>So what&#8217;s my first thought when encountering such a site (well maybe my second thought &#8212; right after &#8220;can I preorder my copy of <a href="http://www.powells.com/harry.html">Harry Potter #7</a>&#8220;)? Why it&#8217;s: &#8220;let&#8217;s see what Firebug can tell us about the site&#8217;s construction&#8221; of course! Here&#8217;s what I found interesting in about three minutes:</p>
<ol>
<li>the site pretty much uses table-less layout &#8212; yippee! divs and floats my friends</li>
<li>elastic layout</li>
<li>font resizing works pretty well in content areas but not in navigation controls</li>
</ol>
<p>Something I&#8217;m particularly interested in these days is that old chestnut of web design: the rounded corner. The approach on the Powells site was so, well, heinous, that it prompted me to inaugurate what I hope will become a regular feature here. Without further ado, I give you:</p>
<h3>Heinous Corner-Rounding of the Day Award (HCROD) #1: Powells Books (div per image)</h3>
<p>Got some content you&#8217;d like to render in a rounded box? Well then, simply wrap it in <span style="font-weight:bold;">six divs</span> &#8212; one each for: right, bottom, and each of the corners. That way you can hang CSS rules on each of those divs to apply your rounded/shadowed images. Semantic HTML my foot. Dig:</p>
<p><img class="alignnone size-full wp-image-208" title="firefoxscreensnapz0322" src="http://memerocket.files.wordpress.com/2007/06/firefoxscreensnapz0322.jpg?w=520" alt="firefoxscreensnapz0322"   /></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/memerocket.wordpress.com/74/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/memerocket.wordpress.com/74/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/memerocket.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/memerocket.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/memerocket.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/memerocket.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/memerocket.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/memerocket.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/memerocket.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/memerocket.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/memerocket.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/memerocket.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/memerocket.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/memerocket.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/memerocket.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/memerocket.wordpress.com/74/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=74&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://memerocket.com/2007/06/21/heinous-corner-rounding-of-the-day-award-hcrod-1-powells-books-div-per-image/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a88a8da103044de18418f303bf0c1507?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">bburcham</media:title>
		</media:content>

		<media:content url="http://memerocket.files.wordpress.com/2007/06/firefoxscreensnapz0322.jpg" medium="image">
			<media:title type="html">firefoxscreensnapz0322</media:title>
		</media:content>
	</item>
		<item>
		<title>Tableful Grace</title>
		<link>http://memerocket.com/2007/05/18/tableful-grace/</link>
		<comments>http://memerocket.com/2007/05/18/tableful-grace/#comments</comments>
		<pubDate>Fri, 18 May 2007 18:42:43 +0000</pubDate>
		<dc:creator>Bill Burcham</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://www.meme-rocket.com/2007/05/18/tableful-grace/</guid>
		<description><![CDATA[I love reading about table-less layout with CSS. My experience though has been that it never really works for forms. I always end up resorting to tables to lay out my labels, controls and instructions. Well brother, Dan Benjamin and &#8230; <a href="http://memerocket.com/2007/05/18/tableful-grace/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=69&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-200" title="firefoxscreensnapz023" src="http://memerocket.files.wordpress.com/2007/05/firefoxscreensnapz023.jpg?w=246&#038;h=300" alt="firefoxscreensnapz023" width="246" height="300" /> I love reading about table-less layout with CSS. My experience though has been that it never really works for forms. I always end up resorting to tables to lay out my labels, controls and instructions. Well brother, Dan Benjamin and Dan Cederholm provide absolution.<br />
Witness the tableful layout of the <a href="http://corkd.com/signup">Cork&#8217;d signup</a> form at the right. Be at peace. Use tables to lay out your forms. Life is full of sweet pleasures.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/memerocket.wordpress.com/69/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/memerocket.wordpress.com/69/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/memerocket.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/memerocket.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/memerocket.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/memerocket.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/memerocket.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/memerocket.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/memerocket.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/memerocket.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/memerocket.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/memerocket.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/memerocket.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/memerocket.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/memerocket.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/memerocket.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=memerocket.com&amp;blog=5432592&amp;post=69&amp;subd=memerocket&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://memerocket.com/2007/05/18/tableful-grace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a88a8da103044de18418f303bf0c1507?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">bburcham</media:title>
		</media:content>

		<media:content url="http://memerocket.files.wordpress.com/2007/05/firefoxscreensnapz023.jpg?w=246" medium="image">
			<media:title type="html">firefoxscreensnapz023</media:title>
		</media:content>
	</item>
	</channel>
</rss>
