<?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>cdevroe.com &#187; john resig</title>
	<atom:link href="http://cdevroe.com/tag/john-resig/feed/" rel="self" type="application/rss+xml" />
	<link>http://cdevroe.com</link>
	<description>by Colin Devroe</description>
	<lastBuildDate>Thu, 24 May 2012 15:29:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>	<atom:link rel='hub' href='http://cdevroe.com/?pushpress=hub'/>
<cloud domain='cdevroe.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>The CSS Selector proposal explained for CSS noobs</title>
		<link>http://cdevroe.com/notes/css-selectors-for-noobs/</link>
		<comments>http://cdevroe.com/notes/css-selectors-for-noobs/#comments</comments>
		<pubDate>Tue, 06 May 2008 15:45:44 +0000</pubDate>
		<dc:creator>Colin Devroe</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css selectors]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[john resig]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[proposal]]></category>
		<category><![CDATA[shaun-inman]]></category>
		<category><![CDATA[web-design]]></category>

		<guid isPermaLink="false">http://cdevroe.com/?p=695</guid>
		<description><![CDATA[Shaun Inman proposed something I didn't understand.  After working through it, I think I understand it.  Here is a noob explanation.]]></description>
			<content:encoded><![CDATA[<p>I am not well versed in CSS. Â I can get around. Â I can make a site look pretty good in Safari and horrible in Internet Explorer (look at this site in IE for a great example). Â But I&#8217;m a hacker at best. Â I fiddle with CSS until something looks right, I don&#8217;t follow conventions or standards, I don&#8217;t know what a box-model hack actually does, and I can&#8217;t even begin to tell you how to write browser specific CSS styles.</p>
<p>If you are a like me then <a href="http://www.shauninman.com/archive/2008/05/05/css_qualified_selectors">Shaun Inman&#8217;s proposal for CSS Selectors</a> will probably leave you with a furled brow.</p>
<p>Rather then being left standing in the dark I tried to wrap my head around what Shaun was trying to accomplish with his proposal. Â I didn&#8217;t get. Â But I wanted to. Â So I setup <a href="http://cdevroe.com/pages/css-selectors.html">a quick example page that illustrated my question</a>. Â I then hopped, skipped, and jumped over the Shaun&#8217;s Web site, and <a href="http://www.shauninman.com/archive/2008/05/05/css_qualified_selectors#comment_3933">asked what I was missing</a>. Â Shaun, kindly andÂ succinctly, <a href="http://www.shauninman.com/archive/2008/05/05/css_qualified_selectors#comment_3935">replied</a>.</p>
<h3>The non-CSS guru explanation of the CSS Selector proposal</h3>
<p>I can&#8217;t be sure that any of you reading this are in the same boat as I was. Â In fact, I&#8217;m sitting here thinking at all of you are smarter than I am when it comes to these things, and that you&#8217;re not even reading this right now. Â But if you are, and you&#8217;d like to understand this debate a little further, here is as simple an explanation as I can give.</p>
<p><em>A style can not be attributed to a parent element when a specific child element is present.</em></p>
<p>I don&#8217;t even know if I worded that correctly. Â I&#8217;m pretty sure I didn&#8217;t. Â So here is the long-winded version. Â In Shaun&#8217;s first example he shows that an image, that is wrapped with a link, would have the same style as a normal link. Â The problem is that, currently, CSS can not determine the differences between a normal link and a link that has an image within it. Â It just isn&#8217;t &#8220;smart&#8221; enough. Â That is, without the help of something that runs after the <abbr title="Document Object Model">DOM</abbr> has loaded fully like the awe-inspiring <a href="http://ejohn.org/blog/qualified-selectors-in-jquery/">John Resig&#8217;s jQuery plugin</a>.</p>
<p>Here is a quick explanation of what John Resig&#8217;s JavaScript is doing. Â Once the page loads, jQuery parses through the entire HTML document, determines which links &#8220;has images&#8221; (<a href="http://docs.jquery.com/Selectors/has#selector">see documentation here</a>) and then you may run specific JavaScript functions on those links specifically. Â You could, for example, add classes to those links dynamically with jQuery, rather than mucking up your code with classes inline.</p>
<p>Shaun&#8217;s proposal is to help make CSS, and browsers, &#8220;smart&#8221; enough to determine when styles <em>should be</em> attributed to links and <em>when not to be attributed</em> to links that contain images. Â This was only his first example, Shaun gives others.</p>
<p>I really hope I did an okay job explaining this for those of you that, like me, didn&#8217;t understand it before pounding my head against my desk.</p>
<h3>Addendum</h3>
<p>Shaun has hit me back with a succinctÂ definitionÂ that correctly uses the lingo.</p>
<blockquote><p>&#8220;CSS allows you to style elements based on their parent/ancestor elements but it does not allow you to style a parent element based on the presence of a descendant element.&#8221;</p></blockquote>
<p>You can look backwards, but you can&#8217;t look forwards. Â Thanks Shaun!</p>
]]></content:encoded>
			<wfw:commentRss>http://cdevroe.com/notes/css-selectors-for-noobs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

