<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>ShaunInman.com // Comments</title>
<link>http://www.shauninman.com/</link>
<description></description>
<copyright>Copyright 2001-2008 Shaun Inman</copyright>
<generator>Shaun Inman&#8217;s Bookend</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<lastBuildDate>Mon, 12 May 2008 14:32:47 GMT</lastBuildDate>

<item>
	<title>Mariusz Nowak on CSS Qualified Selectors</title>
	<description><![CDATA[<p>I favor other idea which was proposed on CSS mailing list not so long ago - it&#8217;s indication which simple selector elements we want query to return:
e.g.
document.querySelectorAll(&#8220;!p a&#8221;)
will return all p elements that has anchor descendant.
Additionaly introduction of &#8216;scope&#8217; pseudo class would resolve all other issues. e.g.
el.querySelector(&#8220;!* + :scope&#8221;)
returns previous element sibling element of el</p>

<p>I think it&#8217;s cleaner more powerfull and it doesn&#8217;t introduce new combinators.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3957&amp;seed_title=Mariusz+Nowak+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3957@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Mon, 12 May 2008 12:45:36 GMT</pubDate>
</item>
<item>
	<title>bond-vaga-bond on CSS Qualified Selectors</title>
	<description><![CDATA[<p>Holding breath until jquery, prototype or some other JS lib community implements the &#8220;impossible&#8221;.</p>

<p>Hell, if they can implement most of the CSS 2/3 selector stuff in javascript before Microsoft could implement <em>some</em> of it for IE 7, I wouldn&#8217;t be surprised.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3956&amp;seed_title=bond-vaga-bond+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3956@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Sat, 10 May 2008 07:43:50 GMT</pubDate>
</item>
<item>
	<title>Zack Katz on CSS Qualified Selectors</title>
	<description><![CDATA[<p>I&#8217;ve been yearning &#8212; and I mean <strong>yearning</strong> &#8212; for this for so long, especially the <code>!&lt;</code> part. </p>

<p>Let&#8217;s hope that all the heavy hitters get on board and push this through!</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3955&amp;seed_title=Zack+Katz+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3955@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Fri, 09 May 2008 16:47:29 GMT</pubDate>
</item>
<item>
	<title>travis forden on CSS Qualified Selectors</title>
	<description><![CDATA[<p>@fantasai. Is there a difference between parsing for the browser UI and a web page or web app? The recommendations in the Mozilla doc seem to imply that using the cascade is overly expensive, especially with type selectors, and thus bad to use. All the CSS books and tutorials I&#8217;ve ever seen use descendant selectors and type selectors along with class and ID selectors.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3954&amp;seed_title=travis+forden+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3954@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Fri, 09 May 2008 14:02:52 GMT</pubDate>
</item>
<item>
	<title>vFragoso on CSS Qualified Selectors</title>
	<description><![CDATA[<p>Another reason for using the syntax <code>img &lt; a</code> is that doing this, the syntax should allow us to keep traversing in the CSS code.</p>

<p>Something like:</p>

<pre><code>&lt;div class="box"&gt;
  &lt;span class="box_head" /&gt;
  &lt;span class="box_body" /&gt;
&lt;/div&gt;
</code></pre>

<p>&#8230;</p>

<pre><code>span.box_body &lt; div.box &gt; span.box_head
{
  css code
}
</code></pre>

<p>This should allow us to access any level of the DOM hierarchy based on any selector.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3952&amp;seed_title=vFragoso+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3952@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Thu, 08 May 2008 13:38:14 GMT</pubDate>
</item>
<item>
	<title>vFragoso on CSS Qualified Selectors</title>
	<description><![CDATA[<p>Now, about browser performance, I guess it would really be a pain in the ass.</p>

<p>But..</p>

<blockquote>
  <p>Since I&#8217;m not an expert on browser implemantation. This is just an opinion..</p>
</blockquote>

<p>Nowadays, we are already doing this.
WITH JAVASCRIPT :( !!</p>

<p>And the designers will continue doing this and many other things that will reduce the browser performance more and more.</p>

<p>Allowing us to do that providing the best method the browser can achieve (performatically) via a CSS syntax should standarize the way we do things like that.</p>

<p>This should improve the actual performance since we already do this by worse ways.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3951&amp;seed_title=vFragoso+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3951@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Wed, 07 May 2008 20:17:32 GMT</pubDate>
</item>
<item>
	<title>vFragoso on CSS Qualified Selectors</title>
	<description><![CDATA[<p>I like the idea very much, but, as the usual css syntax, the elements are written in a traversing order.</p>

<p>In the example you used <code>a &gt; img</code> the <code>&gt;</code> symbol represents not an arrow, but the descendance of the <code>img</code> element on the DOM.</p>

<p>Something like the <code>img</code> element is inferior (minor) than element <code>a</code>.</p>

<p>So, the correct syntax, in my opinion, of course, should be:</p>

<pre><code>img &lt; a
</code></pre>

<p>Wich represents that the <code>a</code> element is superior (greater) than element <code>img</code>.</p>

<p>This keeps the <code>a</code> element on the end of the syntax. Like the descendant selectors we are used to write in CSS.</p>

<p>This also looks more close to the javascript or jQuery syntax as well:</p>

<pre><code>img.parent()
</code></pre>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3950&amp;seed_title=vFragoso+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3950@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Wed, 07 May 2008 19:58:28 GMT</pubDate>
</item>
<item>
	<title>Shaun Inman on CSS Qualified Selectors</title>
	<description><![CDATA[<p>Forgot to ask, since that page is hosted by Mozilla and written by Dave, I assume this is how both Firefox and Safari work. Is it safe to assume that this is also how IE works?</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3948&amp;seed_title=Shaun+Inman+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3948@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Wed, 07 May 2008 13:46:07 GMT</pubDate>
</item>
<item>
	<title>Shaun Inman on CSS Qualified Selectors</title>
	<description><![CDATA[<p>Thanks fantasai, that provided a lightbulb moment. At first, this seemed backwards to me:</p>

<blockquote>
  <p>The style system matches a rule by starting with the rightmost selector and moving to the left through the rule&#8217;s selectors.</p>
</blockquote>

<p>But when trying to apply styles <em>while rendering the partial page as it is served</em> to the browser it makes perfect sense. There&#8217;s no need to re-query the partial document when the renderer encounters a potential target for a style&#8212;it already has its target, it just needs to (if you&#8217;ll excuse the expression) qualify it by examining its attributes and ancestors.</p>

<p>Is this same logic used for redraws? It seems like the right-to-left approach would be less efficient once the DOM is already constructed.</p>

<p>I think the disbelief (and grief) that implementors get from designers and developers when this type of selector is brushed off is due to diametrically opposed mental models of how CSS selects its targets. </p>

<p>Because we read and write left-to-right, we assume the parser does as well. That gives the impression that the parser would look at <code>div a</code> and think (as we do) &#8220;I need to grab all <code>div</code>s, then grab any <code>a</code>s in those <code>div</code>s and apply this style&#8221; when (please correct me if I&#8217;m misunderstanding this) the truth is more like &#8220;I need to grab all <code>a</code>s and then release any that aren&#8217;t an ancestor of a <code>div</code>.&#8221; We are more accustomed to interacting with a fully-realized DOM (thanks to your hard work up front).</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3947&amp;seed_title=Shaun+Inman+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3947@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Wed, 07 May 2008 13:37:09 GMT</pubDate>
</item>
<item>
	<title>fantasai on CSS Qualified Selectors</title>
	<description><![CDATA[<p>See <a href="http://developer.mozilla.org/en/docs/Writing_Efficient_CSS">http://developer.mozilla.org/en/docs/Wr &hellip; icient_CSS</a></p>

<p>There&#8217;s a trade-off between markup complexity and style resolution complexity. Where you want to stand depends on what you&#8217;re trying to do. If you&#8217;re writing a reasonably-short static document, you don&#8217;t lose much performance and you gain leaner, more maintainable markup by using more sophisticated selectors. If you&#8217;re writing a highly-dynamic web app (or, in the case targeted above, browser UI) then you&#8217;re better off using heavier markup so you can use dead-simple selectors.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3945&amp;seed_title=fantasai+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3945@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Wed, 07 May 2008 03:29:41 GMT</pubDate>
</item>
<item>
	<title>Shaun Inman on CSS Qualified Selectors</title>
	<description><![CDATA[<p>Thanks for the explanation Dave. This statement gives me pause though:</p>

<blockquote>
  <p>Decorating your markup with classes and ids and matching purely on those while avoiding all uses of sibling, <em>descendant</em> [emphasis added] and child selectors will actually make a page perform significantly better in all browsers.</p>
</blockquote>

<p>Do descendant selectors really fall in that list? I&#8217;m not sure this particular topic gets talked about often enough. What&#8217;s the impact of each type of selector on rendering performance? Eg. what kind of effect does a selector like <code>ol ul li</code> have on performance? Is this documented somewhere?</p>

<p>The true utility of CSS&#8212;to me&#8212;is establishing context with a parent element and then styling its descendants based on that context, thereby minimizing repetitive and redundant presentational hooks in the markup. But from what you&#8217;ve said, it sounds like I&#8217;m &#8220;doing it wrong.&#8221;</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3944&amp;seed_title=Shaun+Inman+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3944@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Tue, 06 May 2008 22:59:35 GMT</pubDate>
</item>
<item>
	<title>Dave Hyatt on CSS Qualified Selectors</title>
	<description><![CDATA[<p>The problem is that browsers cannot store all of the information they need to know exactly what to invalidate when something in the DOM changes.  They end up using a tainting model that inevitably (in the worst case scenarios) leads to over-invalidation.</p>

<p>For example, consider the rule:</p>

<pre><code>.foo div { }
</code></pre>

<p>Now imagine some gigantic document with lots of divs sprinkled all over the place.  Somebody then goes and sets the class name of the body to <code>foo</code>.</p>

<p>In WebKit, that will result in us essentially having to re-resolve style on the entire document.  For a large page, that example could lock up the browser.</p>

<p>To expect that WebKit would know exactly how many divs were inside the body and where they are in order to do precise invalidation is unrealistic, since that would consume too much memory (especially as you started piling on arbitrarily complex rules).</p>

<p>The problems can get even worse when you chain selectors together.</p>

<pre><code>.foo ~ .goo div { }
</code></pre>

<p>If some element suddenly acquires the class name <code>foo</code>, you have to examine every single following sibling and all of their descendants.</p>

<p>These sorts of cases are reasonably uncommon with forward chaining selectors (or at least the author scopes them reasonably well when they do occur).  </p>

<p>With parent selectors it becomes extremely easy to accidentally cause a document-wide grovel.  People can and will misuse this selector.  Supporting it is giving people a whole lot of rope to hang themselves with.</p>

<p>The sad truth about CSS3 selectors is that they really shouldn&#8217;t be used at all if you care about page performance.  Decorating your markup with classes and ids and matching purely on those while avoiding all uses of sibling, descendant and child selectors will actually make a page perform significantly better in all browsers.</p>

<p>For example style information can actually be shared across siblings and even cousins in a DOM tree if you know no sibling rules are used.  WebKit typically achieves a 75% memory reduction in style footprint on pages that don&#8217;t make use of sibling selectors.</p>

<p>Descent into children can be avoided when changes happen if you know no descendant rules are used.  Dynamic effects like <code>:hover</code> will perform better if descendant rules are avoided.</p>

<p>In many cases these rules can still be used and the performance will be perfectly fine.  This is especially true on small blog pages that don&#8217;t get that large.  However once you scale up (e.g., the HTML5 specification), the problems become more apparent.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3942&amp;seed_title=Dave+Hyatt+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3942@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Tue, 06 May 2008 18:56:36 GMT</pubDate>
</item>
<item>
	<title>Shaun Inman on CSS Qualified Selectors</title>
	<description><![CDATA[<blockquote>
  <p>I think you do not fully appreciate what it means to have to support selectors in a dynamic environment.</p>
</blockquote>

<p>I&#8217;m quite certain that I don&#8217;t Dave. That&#8217;s why I asked for and appreciate browser developer insight. Can you give us an example of how the selector might be abused? Something as simple as <code>body &lt; a:visited</code>?</p>

<p>That you have recent experience re-evaluating the problem is good enough for me, we&#8217;re just trying to get a better understanding of the problem.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3941&amp;seed_title=Shaun+Inman+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3941@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Tue, 06 May 2008 18:32:45 GMT</pubDate>
</item>
<item>
	<title>Dave Hyatt on CSS Qualified Selectors</title>
	<description><![CDATA[<p>I just recently implemented more of the CSS3 selectors in WebKit, and it took a really large amount of work and multiple iterations to make the HTML5 spec viewable again after adding support for dynamic nth-child, last-child and sibling selectors.  The spec literally became unviewable in WebKit for a while as I worked to optimize and optimize those selectors to try to get back the performance lost from adding support for dynamism.</p>

<p>In the end, I got back the performance, but at the cost of bloating memory.</p>

<p>If you think a parent selector can&#8217;t render pages unusable in 2008, you are wrong.  It can quite easily. The problem with this selector is that badly written rules could lock up a browser.  An additional concern is that authors would use these rules just for alternative browsers (leaving IE to perform well and degrading Opera/Safari/Firefox performance).</p>

<p>I think you do not fully appreciate what it means to have to support selectors in a dynamic environment.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3940&amp;seed_title=Dave+Hyatt+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3940@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Tue, 06 May 2008 18:19:11 GMT</pubDate>
</item>
<item>
	<title>Colin Devroe on CSS Qualified Selectors</title>
	<description><![CDATA[<p>Thats the **** right there.  Thanks.</p>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3939&amp;seed_title=Colin+Devroe+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3939@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Tue, 06 May 2008 16:18:00 GMT</pubDate>
</item>
<item>
	<title>Shaun Inman on CSS Qualified Selectors</title>
	<description><![CDATA[<p>Close enough for jazz. If I were to take another stab at defining the problem more succinctly I might say:</p>

<blockquote>
  <p>CSS allows you to style elements based on an ancestor element but it does not allow you to style a parent element based on the presence of a descendant element.</p>
</blockquote>]]></description>
	<link>http://shauninman.com/feeder/?FeederAction=clicked&amp;feed=Comments&amp;seed=http%3A%2F%2Fwww.shauninman.com%2Farchive%2F2008%2F05%2F05%2Fcss_qualified_selectors%23comment_3938&amp;seed_title=Shaun+Inman+on+CSS+Qualified+Selectors</link>
	<guid isPermaLink="false">3938@http://www.shauninman.com/</guid>
	<category>Comments</category>
	<pubDate>Tue, 06 May 2008 16:15:03 GMT</pubDate>
</item>
</channel>
</rss>