<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Running on :empty</title>
	<atom:link href="http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/feed/" rel="self" type="application/rss+xml" />
	<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/</link>
	<description>Things that Eric A. Meyer, CSS expert, writes about on his personal Web site; it&#039;s largely Web standards and Web technology, but also various bits of culture, politics, personal observations, and other miscellaneous stuff</description>
	<lastBuildDate>Fri, 19 Mar 2010 00:27:46 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Robin</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-232998</link>
		<dc:creator>Robin</dc:creator>
		<pubDate>Thu, 13 Sep 2007 09:31:39 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-232998</guid>
		<description>For the specific case of empty tables cells there&#039;s a &lt;a href=&quot;http://www.w3.org/TR/CSS21/tables.html#empty-cells&quot; rel=&quot;nofollow&quot;&gt;special rule already in CSS2.1&lt;/a&gt;: &lt;code&gt;empty-cells:show&#124;hide&lt;/code&gt;. Although, yes, &lt;code&gt;:empty&lt;/code&gt; is more flexible.</description>
		<content:encoded><![CDATA[<p>For the specific case of empty tables cells there&#8217;s a <a href="http://www.w3.org/TR/CSS21/tables.html#empty-cells" rel="nofollow">special rule already in CSS2.1</a>: <code>empty-cells:show|hide</code>. Although, yes, <code>:empty</code> is more flexible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will Kessel</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-224667</link>
		<dc:creator>Will Kessel</dc:creator>
		<pubDate>Sat, 25 Aug 2007 01:21:41 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-224667</guid>
		<description>So: you led me to playing around with this :empty stuff, eh? Just because I have a new job, and now I have to play catch-up... grrr.....     ;-)

Until now, I have completely ignored the :empty pseudo-element. A quick glance at the spec tells me that this might be a fairly handy feature for someone who has to populate a table with some dynamically-generated (tabular, of course) data, and wishes to highlight empty cells for whatever reason. 

So I did &lt;a href=&quot;http://www.collisionbend.com/sandbox/emptytable.html&quot; rel=&quot;nofollow&quot;&gt;a quick-and-dirty experiment&lt;/a&gt;. (Granted, the contents aren&#039;t dynamically generated, but for this experiment, it matters little.)

Firefox 2.0.0.6/Mac handled this one with ease, albeit with a couple of minor rendering glitches; Safari 2.0.4 (419.3) blew it to pieces, styling every td as empty instead of just the empty ones. And the value of the very last cell, the number 12, is &lt;i&gt;not&lt;/i&gt; within a p tag like the rest of the cells...

Veddy intrestink.</description>
		<content:encoded><![CDATA[<p>So: you led me to playing around with this :empty stuff, eh? Just because I have a new job, and now I have to play catch-up&#8230; grrr&#8230;..     ;-)</p>
<p>Until now, I have completely ignored the :empty pseudo-element. A quick glance at the spec tells me that this might be a fairly handy feature for someone who has to populate a table with some dynamically-generated (tabular, of course) data, and wishes to highlight empty cells for whatever reason. </p>
<p>So I did <a href="http://www.collisionbend.com/sandbox/emptytable.html" rel="nofollow">a quick-and-dirty experiment</a>. (Granted, the contents aren&#8217;t dynamically generated, but for this experiment, it matters little.)</p>
<p>Firefox 2.0.0.6/Mac handled this one with ease, albeit with a couple of minor rendering glitches; Safari 2.0.4 (419.3) blew it to pieces, styling every td as empty instead of just the empty ones. And the value of the very last cell, the number 12, is <i>not</i> within a p tag like the rest of the cells&#8230;</p>
<p>Veddy intrestink.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carter</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-224560</link>
		<dc:creator>Carter</dc:creator>
		<pubDate>Fri, 24 Aug 2007 21:11:16 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-224560</guid>
		<description>I&#039;ve just run into a situation where :empty not applying to input elements definitely seemed to go against common sense. I&#039;m using javascript to find the first empty input element in a form and set focus  to it. As Christopher mentioned, the attribute selector works just peachy instead--

Here&#039;s the selector string I&#039;m using (with jQuery)

&lt;code&gt;$(&quot;[@value=&#039;&#039;]:input:visible:enabled:first&quot;)&lt;/code&gt;

I agree that using on &lt;code&gt;[@value=&#039;&#039;]&lt;/code&gt; or &lt;code&gt;[@src=&#039;&#039;]&lt;/code&gt; makes more sense then the common-sense approach to :empty, although initially I was also a little thrown.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve just run into a situation where :empty not applying to input elements definitely seemed to go against common sense. I&#8217;m using javascript to find the first empty input element in a form and set focus  to it. As Christopher mentioned, the attribute selector works just peachy instead&#8211;</p>
<p>Here&#8217;s the selector string I&#8217;m using (with jQuery)</p>
<p><code>$("[@value='']:input:visible:enabled:first")</code></p>
<p>I agree that using on <code>[@value='']</code> or <code>[@src='']</code> makes more sense then the common-sense approach to :empty, although initially I was also a little thrown.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222989</link>
		<dc:creator>Christopher</dc:creator>
		<pubDate>Tue, 21 Aug 2007 16:45:04 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222989</guid>
		<description>Would there be issue with any element that is self closing not being considered &#039;empty&#039;?  I see no benefit to targeting &#039;br&#039; or &#039;hr&#039; with :empty.

As for &#039;img&#039; and &#039;input&#039;, it seems to me that an attribute selector checking their &#039;src&#039; and &#039;value&#039; properties respectively would suffice when you wanted to see if they were truly &#039;empty&#039;.

This pseudo-class seems primarily targeted at paragraphs and divs without text, as I see little in the way of other practical uses for it (perhaps anchors?).</description>
		<content:encoded><![CDATA[<p>Would there be issue with any element that is self closing not being considered &#8216;empty&#8217;?  I see no benefit to targeting &#8216;br&#8217; or &#8216;hr&#8217; with :empty.</p>
<p>As for &#8216;img&#8217; and &#8216;input&#8217;, it seems to me that an attribute selector checking their &#8217;src&#8217; and &#8216;value&#8217; properties respectively would suffice when you wanted to see if they were truly &#8216;empty&#8217;.</p>
<p>This pseudo-class seems primarily targeted at paragraphs and divs without text, as I see little in the way of other practical uses for it (perhaps anchors?).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Everman</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222689</link>
		<dc:creator>Eric Everman</dc:creator>
		<pubDate>Tue, 21 Aug 2007 01:44:22 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222689</guid>
		<description>:empty seems incompatible with html/xhtml, since whitespace is supposed to be ignored.  For instance, if the html/xhtml spec says that:

&lt;code&gt;&lt;p&gt;&lt;/p&gt;&lt;/code&gt;
and
&lt;code&gt;&lt;p&gt;   [spaces]   &lt;/p&gt;&lt;/code&gt;

are supposed to be equivalent, it seems to me that the browser could legitimately collapse the distinction b/t the two in the DOM model before applying the CSS styling.  ...Or I could be wrong on that - perhaps the spec says that one space is the same as twenty spaces, but any number of spaces is different then zero spaces...</description>
		<content:encoded><![CDATA[<p>:empty seems incompatible with html/xhtml, since whitespace is supposed to be ignored.  For instance, if the html/xhtml spec says that:</p>
<p><code>&lt;p&gt;&lt;/p&gt;</code><br />
and<br />
<code>&lt;p&gt;   [spaces]   &lt;/p&gt;</code></p>
<p>are supposed to be equivalent, it seems to me that the browser could legitimately collapse the distinction b/t the two in the DOM model before applying the CSS styling.  &#8230;Or I could be wrong on that &#8211; perhaps the spec says that one space is the same as twenty spaces, but any number of spaces is different then zero spaces&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222494</link>
		<dc:creator>Rick</dc:creator>
		<pubDate>Mon, 20 Aug 2007 16:28:47 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222494</guid>
		<description>I just found a name for my nascent web design business:

head:empty</description>
		<content:encoded><![CDATA[<p>I just found a name for my nascent web design business:</p>
<p>head:empty</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mats Lindblad</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222397</link>
		<dc:creator>Mats Lindblad</dc:creator>
		<pubDate>Mon, 20 Aug 2007 07:49:36 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222397</guid>
		<description>What happens to ?

I agree that logic should rule what is affected and not.
Meaning that elements that render content on the page are NOT :empty, such as images and :s.

:empty elements are what the validator warns you about, I.E. elements that, possibly, contains only white-space nodes, comments or PI.
Not what is referred to as EMPTY elements in the spec.</description>
		<content:encoded><![CDATA[<p>What happens to ?</p>
<p>I agree that logic should rule what is affected and not.<br />
Meaning that elements that render content on the page are NOT :empty, such as images and :s.</p>
<p>:empty elements are what the validator warns you about, I.E. elements that, possibly, contains only white-space nodes, comments or PI.<br />
Not what is referred to as EMPTY elements in the spec.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Meyer</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222327</link>
		<dc:creator>Eric Meyer</dc:creator>
		<pubDate>Mon, 20 Aug 2007 03:01:17 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222327</guid>
		<description>&lt;a href=&quot;http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/?#comment-222306&quot; rel=&quot;nofollow&quot;&gt;Ralph&lt;/a&gt;, the &lt;code&gt;head&lt;/code&gt; children are being rendered because I opened up the &lt;code&gt;head&lt;/code&gt; in order to display the embedded &lt;code&gt;style&lt;/code&gt; element in the upper right corner there---and, by the by, to see if empty &lt;code&gt;head&lt;/code&gt; descendants like &lt;code&gt;link&lt;/code&gt; would be matched.

As for allowing us to style replaced elements, I&#039;m ambivalent, for &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2007/05/15/formal-weirdness/&quot; rel=&quot;nofollow&quot;&gt;many and sundry reasons&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p><a href="http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/?#comment-222306" rel="nofollow">Ralph</a>, the <code>head</code> children are being rendered because I opened up the <code>head</code> in order to display the embedded <code>style</code> element in the upper right corner there&#8212;and, by the by, to see if empty <code>head</code> descendants like <code>link</code> would be matched.</p>
<p>As for allowing us to style replaced elements, I&#8217;m ambivalent, for <a href="http://meyerweb.com/eric/thoughts/2007/05/15/formal-weirdness/" rel="nofollow">many and sundry reasons</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ralph</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222306</link>
		<dc:creator>Ralph</dc:creator>
		<pubDate>Mon, 20 Aug 2007 02:18:03 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-222306</guid>
		<description>Interesting... I wonder if we should see the &lt;code&gt;link&lt;/code&gt; element. Why would &lt;code&gt;head&lt;/code&gt; children be rendered at all? What sense does it have? I even find the &lt;code&gt;br&lt;/code&gt; element not being shown (in the test page) has more sense, I mean, this is a replaced element, isn&#039;t?. If that&#039;s so, then most of CSS rules don&#039;t apply at all &#8212;though I still wonder just what kind of element &lt;code&gt;br&lt;/code&gt; is and how is it &lt;em&gt;implemented&lt;/em&gt; across browsers.

This leads me to another issue: should we be grateful with browser vendors that they give us some little freedom there (with replaced elements)? I mean, do you think this is positive at all? &#8212;If you ask me, I think it is, I tend to alter the border and background of &lt;code&gt;input&lt;/code&gt;&#039;s, for instance. What&#039;s your opinion?</description>
		<content:encoded><![CDATA[<p>Interesting&#8230; I wonder if we should see the <code>link</code> element. Why would <code>head</code> children be rendered at all? What sense does it have? I even find the <code>br</code> element not being shown (in the test page) has more sense, I mean, this is a replaced element, isn&#8217;t?. If that&#8217;s so, then most of CSS rules don&#8217;t apply at all &mdash;though I still wonder just what kind of element <code>br</code> is and how is it <em>implemented</em> across browsers.</p>
<p>This leads me to another issue: should we be grateful with browser vendors that they give us some little freedom there (with replaced elements)? I mean, do you think this is positive at all? &mdash;If you ask me, I think it is, I tend to alter the border and background of <code>input</code>&#8217;s, for instance. What&#8217;s your opinion?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Meyer</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221788</link>
		<dc:creator>Eric Meyer</dc:creator>
		<pubDate>Sat, 18 Aug 2007 22:57:22 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221788</guid>
		<description>I&#039;d actually expect that, &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221522&quot; rel=&quot;nofollow&quot;&gt;Sebastian&lt;/a&gt;, since in the first case &lt;code&gt;object&lt;/code&gt; has no child nodes, and in the second case it does.  On the other hand, if the &lt;code&gt;param&lt;/code&gt; isn&#039;t selected, then that&#039;s either total spec weirdness or a browser bug.  To test it, you&#039;d have to make sure the &lt;code&gt;display&lt;/code&gt; of both &lt;code&gt;object&lt;/code&gt; and &lt;code&gt;param&lt;/code&gt; was something other than &lt;code&gt;none&lt;/code&gt;.

I think you are missing something, &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221653&quot; rel=&quot;nofollow&quot;&gt;Nils&lt;/a&gt;.  In the first part of the post, I&#039;m talking about the &lt;code&gt;body&lt;/code&gt; being inappropriately selected, as documented in the Bugzilla entry.  In the second part, I&#039;m talking about selection of empty elements that are DOM-empty but not render-empty, like images and inputs and such.  I didn&#039;t say anything about that appearance of the top-most tiny box on the test page, which is indeed the &lt;code&gt;link&lt;/code&gt; element and (given that we accept HTML-empty elements are selected by &lt;code&gt;:empty&lt;/code&gt;) should be seen, given the rest of the styles.</description>
		<content:encoded><![CDATA[<p>I&#8217;d actually expect that, <a href="http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221522" rel="nofollow">Sebastian</a>, since in the first case <code>object</code> has no child nodes, and in the second case it does.  On the other hand, if the <code>param</code> isn&#8217;t selected, then that&#8217;s either total spec weirdness or a browser bug.  To test it, you&#8217;d have to make sure the <code>display</code> of both <code>object</code> and <code>param</code> was something other than <code>none</code>.</p>
<p>I think you are missing something, <a href="http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221653" rel="nofollow">Nils</a>.  In the first part of the post, I&#8217;m talking about the <code>body</code> being inappropriately selected, as documented in the Bugzilla entry.  In the second part, I&#8217;m talking about selection of empty elements that are DOM-empty but not render-empty, like images and inputs and such.  I didn&#8217;t say anything about that appearance of the top-most tiny box on the test page, which is indeed the <code>link</code> element and (given that we accept HTML-empty elements are selected by <code>:empty</code>) should be seen, given the rest of the styles.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nils Maier</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221654</link>
		<dc:creator>Nils Maier</dc:creator>
		<pubDate>Sat, 18 Aug 2007 16:14:13 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221654</guid>
		<description>Err, &quot;the empty link-Node&quot;.
(Should have known that the blogsoft would filter it completely when written as tag)</description>
		<content:encoded><![CDATA[<p>Err, &#8220;the empty link-Node&#8221;.<br />
(Should have known that the blogsoft would filter it completely when written as tag)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nils Maier</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221653</link>
		<dc:creator>Nils Maier</dc:creator>
		<pubDate>Sat, 18 Aug 2007 16:12:35 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221653</guid>
		<description>The DOM-Inspector tells me that the box you see is not body but the empty  node from the head.
Or am I missing something?</description>
		<content:encoded><![CDATA[<p>The DOM-Inspector tells me that the box you see is not body but the empty  node from the head.<br />
Or am I missing something?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian Redl</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221522</link>
		<dc:creator>Sebastian Redl</dc:creator>
		<pubDate>Sat, 18 Aug 2007 09:49:49 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221522</guid>
		<description>Here&#039;s another little weirdness in the spec:

&lt;object ...&gt;&lt;/object&gt; is matched.
&lt;object ...&gt;&lt;param name=&quot;foo&quot; value=&quot;bar&quot;/&gt;&lt;/object&gt; is not.</description>
		<content:encoded><![CDATA[<p>Here&#8217;s another little weirdness in the spec:</p>
<p>&lt;object &#8230;&gt;&lt;/object&gt; is matched.<br />
&lt;object &#8230;&gt;&lt;param name=&#8221;foo&#8221; value=&#8221;bar&#8221;/&gt;&lt;/object&gt; is not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dana</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221378</link>
		<dc:creator>Dana</dc:creator>
		<pubDate>Sat, 18 Aug 2007 03:29:42 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221378</guid>
		<description>It seems like this is a bit open to interpretation.  To me, &lt;code&gt;empty&lt;/code&gt; means &quot;no children&quot;.  So, if I want to find, say, all empty &lt;code&gt;p&lt;/code&gt; elements, I could use &lt;code&gt;p:empty&lt;/code&gt; for my selector.  In my mind, it would make sense then for &lt;code&gt;*:empty&lt;/code&gt; to apply to &lt;code&gt;textarea&lt;/code&gt; elements if there is not text in them.  If there is text, then they wouldn&#039;t be selected.

I also tend to agree with Ralph that the attributes wouldn&#039;t be considered, therefore &lt;code&gt;img&lt;/code&gt; elements would always be selected, as they have no child nodes.

Perhaps a new pseudo-class is needed for the situation you bring up where an &lt;code&gt;img&lt;/code&gt; element&#039;s data successfully loads or not.  Something like &lt;code&gt;nocontent&lt;/code&gt;?  I guess there would be some overlap between &lt;code&gt;empty&lt;/code&gt; and something like that, though.</description>
		<content:encoded><![CDATA[<p>It seems like this is a bit open to interpretation.  To me, <code>empty</code> means &#8220;no children&#8221;.  So, if I want to find, say, all empty <code>p</code> elements, I could use <code>p:empty</code> for my selector.  In my mind, it would make sense then for <code>*:empty</code> to apply to <code>textarea</code> elements if there is not text in them.  If there is text, then they wouldn&#8217;t be selected.</p>
<p>I also tend to agree with Ralph that the attributes wouldn&#8217;t be considered, therefore <code>img</code> elements would always be selected, as they have no child nodes.</p>
<p>Perhaps a new pseudo-class is needed for the situation you bring up where an <code>img</code> element&#8217;s data successfully loads or not.  Something like <code>nocontent</code>?  I guess there would be some overlap between <code>empty</code> and something like that, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ralph</title>
		<link>http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221275</link>
		<dc:creator>Ralph</dc:creator>
		<pubDate>Fri, 17 Aug 2007 22:31:52 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comment-221275</guid>
		<description>I forgot to summarize...

This is a problem of &lt;strong&gt;context&lt;/strong&gt;. The &lt;code&gt;:empty&lt;/code&gt; statement applies to empty &lt;em&gt;elements&lt;/em&gt;. As far as I know it doesn&#039;t take into consideration their &lt;em&gt;attributes&lt;/em&gt;, and frankly I see no reason to do so, even more since you can reference them directly with &lt;code&gt;[attribute]&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>I forgot to summarize&#8230;</p>
<p>This is a problem of <strong>context</strong>. The <code>:empty</code> statement applies to empty <em>elements</em>. As far as I know it doesn&#8217;t take into consideration their <em>attributes</em>, and frankly I see no reason to do so, even more since you can reference them directly with <code>[attribute]</code>.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head profile="http://gmpg.org/xfn/1">
<title>meyerweb.com</title>
<link rel="openid.server" href="http://www.myopenid.com/server">
<link rel="openid.delegate" href="http://emeyer.myopenid.com/">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel="shortcut icon" href="/favicon.ico"><link rel="home" href="http://meyerweb.com/" title="Home" ><link rel="stylesheet" href="http://meyerweb.com/ui/meyerweb.css" type="text/css" media="screen, projection"><link rel="stylesheet" href="http://meyerweb.com/ui/theme.css" type="text/css" media="screen, projection" id="themeLink"><link rel="stylesheet" href="http://meyerweb.com/ui/print.css" type="text/css" media="print"><script src="http://meyerweb.com/ui/addresses.js" type="text/javascript"></script><link rel="stylesheet" href="/ui/wordpress.css" type="text/css" media="screen">
<link rel="stylesheet" href="/ui/tfe.css" type="text/css" media="screen">
<link rel="stylesheet" href="/ui/home.css" type="text/css" media="screen">
<link rel="alternate" type="application/rss+xml" title="Thoughts From Eric" href="/eric/thoughts/rss2/full" />
<link rel="alternate" type="application/rss+xml" title="Thoughts From Eric (only technical posts)" href="/eric/thoughts/category/tech/rss2/full" />
<link rel="alternate" type="application/rss+xml" title="Thoughts From Eric (only personal posts)" href="/eric/thoughts/category/personal/rss2/full" />
<link rel="alternate" type="application/rss+xml" title="Distractions" href="/eric/thoughts/recent-links/rss2" />
<link rel="alternate" type="application/rss+xml" title="Excuse of the Day" href="/feeds/excuse/rss20.xml" />
</head>
<body id="www-meyerweb-com" class="hpg">

<div id="sitemast"><h1><a href="/"><span>meyerweb</span>.com</a></h1></div><div id="search"><h4>Exploration</h4><!-- SiteSearch Google --><form method="get" action="http://www.google.com/custom" target="_top"><div><input type="hidden" name="domains" value="meyerweb.com"></input><label for="sbb" style="display: none">Submit search form</label><input type="submit" name="sa" value="Google Search" id="sbb"></input><label for="sbi" style="display: none">Enter your search terms</label><input type="text" name="q" size="31" maxlength="255" value="" id="sbi"></input><p><input type="radio" name="sitesearch" value="meyerweb.com" checked id="ss1"></input><label for="ss1" title="Search meyerweb.com">meyerweb.com</label><input type="radio" name="sitesearch" value="" id="ss0"></input><label for="ss0" title="Search the Web">Web</label></p><input type="hidden" name="client" value="pub-3772084027748653"></input><input type="hidden" name="forid" value="1"></input><input type="hidden" name="ie" value="ISO-8859-1"></input><input type="hidden" name="oe" value="ISO-8859-1"></input><input type="hidden" name="safe" value="active"></input><input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1"></input><input type="hidden" name="hl" value="en"></input></div></form><!-- SiteSearch Google --><!-- <form method="get" action="http://www.google.com/custom"><div><input type="submit" name="sa" value="Search"><input type="text" name="q" size="20" maxlength="255" value=""><input type="hidden" name="sitesearch" value="meyerweb.com"></div></form><small><a href="http://www.google.com/search">Powered by Google</a></small> --></div><div id="main"><div class="skipper">Skip to: <a href="#extra">site navigation/presentation</a></div><div class="skipper">Skip to: <a href="#thoughts">Thoughts From Eric</a></div>
<div id="thoughts">


<div class="entry">
<h3><a href="http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/" rel="bookmark" title="Permanent Link: Running on :empty">Running on :empty</a></h3>
<ul class="meta">
<li class="date">Fri 17 Aug 2007</li>
<li class="time">1230</li>
<li class="cat"><a href="http://meyerweb.com/eric/thoughts/category/tech/browsers/" title="View all posts in Browsers" rel="category tag">Browsers</a><br> <a href="http://meyerweb.com/eric/thoughts/category/tech/css/" title="View all posts in CSS" rel="category tag">CSS</a></li>
<li class="cmt"><a href="http://meyerweb.com/eric/thoughts/2007/08/17/running-on-empty/#comments">23 responses</a></li>
<li></li><li></li></ul>

<div class="text">
<p>
While kicking around some ideas at the CSS workshop I led in London, I ran into some interesting problems with <code>:empty</code>.  If you&#8217;re not up on what that one does, it&#8217;s a way of selecting elements that have no children, including text.  To quote the <a href="http://www.w3.org/TR/css3-selectors/#empty-pseudo">formal definition</a>:
</p>

<blockquote cite="http://www.w3.org/TR/css3-selectors/#empty-pseudo">
<p>
The <code>:empty</code> pseudo-class represents an element that has no children at all. In terms of the DOM, only element nodes and text nodes (including CDATA nodes and entity references) whose data has a non-zero length must be considered as affecting emptiness; comments, PIs, and other nodes must not affect whether an element is considered empty or not.
</p>
</blockquote>

<p>
So kindly consider:
</p>

<pre>
*:empty {
   padding: 0.25em;
   outline: 1px dashed red;
   background: yellow;
}
</pre>

<p>
We (re)discovered something very strange right there in the workshop: given the preceding rule, Firefox applies it to the <code>body</code> element&#8212;which is, quite clearly, not empty.  You can check out the fun on my <a href="http://meyerweb.com/eric/css/tests/empty-bare.html"><code>bare *:empty</code> test page</a>.  From there, we realized that if you prepend a <code>body</code> to the selector, yielding <code>body *:empty</code>, the problem vanishes, as you might expect.
</p>
<p>
As it turns out, this is <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=323052">a known bug in Gecko</a>.  It&#8217;s been known for about 18 months, in fact.  So that&#8217;s why I was confused by Firefox&#8217;s behavior.
</p>
<p>
The other problem is that <code>:empty</code> in Firefox matches <code>img</code> elements, whether or not they cause an image to successfully load.  You can see this happen on <a href="http://meyerweb.com/eric/css/tests/empty-bare.html">the same test page</a>.  While it&#8217;s true that <code>img</code> is an empty element, it&#8217;s still bringing in content, so from a common-sense point of view it seems that <code>:empty</code> ought not to match.
</p>
<p>
In re-reading the description from the specification, though, I can&#8217;t justify my common-sense interpretation&#8212;an <code>img</code> element has neither element nodes nor text nodes, so far as I&#8217;m aware.  The same is true for form inputs, even text inputs that have pre-filled value text; but <em>not</em> for <code>textarea</code>s that have pre-filled content text.  But then <code>br</code> elements should also be selected by this rule, and they apparently don&#8217;t get matched at all, as <a href="http://meyerweb.com/eric/css/tests/empty-bare.html">the test page</a> shows.  Bwuh?
</p>
<p>
Well, maybe it&#8217;s a bug.  What concerns me here is that the definition of <code>:empty</code> basically requires that things like images and inputs always be selected, which strikes me as kind of useless.  After all, if I wanted to select all images, I&#8217;d write <code>img</code> into my selector; ditto <code>input</code> for inputs.
</p>
<p>
My thinking is that the description should change to state that application of <code>:empty</code> is restricted to non-replaced elements.  Alternatively, it could be redefined to only apply non-replaced elements and to empty replaced elements that don&#8217;t either cause something to load or have values associated with them.
</p>
<p>
Which seems a better solution to you, and why?  Or, if you see a better approach than either of those, what is it?
</p>
</div>

</div>

</div>
<p style="font-size: 90%; text-align: right; margin-top: 0.5em; padding-top: 0;">(If you care, there's even an <a href="/eric/thoughts/page/2/">archive of previous thoughts</a>...)</p>

</div><div id="extra"><div class="panel" id="archipelago"><h4>Identity Archipelago</h4><ul><li><a href="http://flickr.com/photos/meyerweb/" rel="me">Flickr</a></li><li><a href="http://twitter.com/meyerweb/" rel="me">Twitter</a></li><li><a href="http://dopplr.com/traveller/meyerweb">Dopplr</a></li><li><a href="http://www.linkedin.com/in/meyerweb" rel="me">LinkedIn</a></li><li><a href="http://technorati.com/profile/emeyer" rel="me">Technorati</a></li></ul></div><div class="panel" id="pointers"><h4>Projects Elsewhere</h4><ul><li><a href="http://aneventapart.com/">An Event Apart</a></li><li><a href="http://complexspiral.com/">Complex Spiral Consulting</a></li><li><a href="http://www.webassist.com/go/css/emeyer/">CSS Sculptor</a></li><li><a href="http://css-discuss.org/">css-discuss</a></li><li><a href="http://microformats.org/">Microformats</a></li><li><a href="http://s5project.org/">S5</a></li></ul></div><div class="panel" id="tour"><ul><li><a href="http://fray.com/issue3/"><img src="http://fray.com/images/i3c.gif" alt="Fray Contributor (Issue 3: Sex &amp; Death)" /></a></li><!-- <li><a href="http://www.webassist.com/go/css/emeyer/"><img src="/pix/CS_ad_180x109.jpg" alt="CSS Sculptor for Dreamweaver" style="max-width: 100%;" /></a></li> --></ul></div><div class="panel">
<h4>Recently Tweeted</h4>
<p class="more"><a href="http://twitter.com/meyerweb">see more</a></p>
<p>Got a Pulse pen as a gift and hit an odd snag.  E-mail support from LiveScribe has been basically useless.  CS pool lacks any consistency. <small>&#8211;tweeted 10 hours, 7 minutes ago</small></p>
</div><div id="sideblog" class="panel">
<h4>Distractions</h4>
<p class="more">
<a href="/eric/thoughts/recent-links/">archive</a>
</p>
<ul>
<li><a href="http://tweetagewasteland.com/2010/03/my-head-is-in-the-cloud/" title="March 18 | &#8220;I sense that my addiction to the realtime stream is only making room for the consumption of a faster stream.&#8221;">My Head is in the Cloud</a> <small>[via <a href="http://daringfireball.net/">John</a>]</small></li>
<li><a href="http://8bitnyc.com/" title="March 17 | All of a sudden I want to establish a mission in Central Park and negotiate with the natives for gold and food.">8-Bit NYC</a></li>
<li><a href="http://www.youtube.com/watch?v=nFicqklGuB0&amp;feature=player_embedded" title="March 12 | Wry comment expressing my appreciation of the creative derivativeness of this video and its uncanny accuracy in mocking common tropes.">Academy Award Winning Movie Trailer</a></li>
<li><a href="http://www.youtube.com/watch?v=414TmP12WAU" title="March 9 | &#8220;Apple juice&#8230; for half price!&#8221;  More like twice PRICELESS.  (Note: If you&#8217;re at work, don your headphones.)">Happy in Paraguay</a> <small>[via <a href="http://unstoppablerobotninja.com/">Ethan</a>]</small></li>
<li><a href="http://www.youtube.com/watch?v=9V5ubAOeOBk&amp;feature=player_embedded" title="February 10 | This is approximately the best thing ever.">U900 -Walk Don&#8217;t Run (Isogabamaware)</a></li>
<li><a href="http://www.456bereastreet.com/archive/201002/sifr_default_css_hides_content_from_at_least_one_screen_reader/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A 456bereastreet %28456 Berea Street%29" title="February 8 | -9999px comes through again, but I really wish we were beyond that kind of thing.">sIFR default CSS hides content from at least one screen reader</a></li>
<li><a href="http://www.macosxhints.com/article.php?story=20100117064356428" title="February 8 | Storing this for future use.">Take a picture with the iSight camera when a folder is opened</a></li>
<li><a href="http://mingle2.com/blog/view/web-developer-mind" title="February 4 | Mostly valid.  (SEE WHAT I DID THERE?)">The Mind of a Web Developer: An Illustrated Diagram</a></li>
<li><a href="http://www.theonion.com/content/news/science_channel_refuses_to_dumb" title="January 28 | &#8220;Punkin Chunkin, for Christ&#8217;s sake&#8230; What more do you people want?&#8221;">Science Channel Refuses To Dumb Down Science Any Further</a></li>
<li><a href="http://www.mailchimp.com/blog/project-omnivore-declassified/" title="January 27 | Sounds like quite a feat.  But I wonder how we&#8217;d feel if Microsoft or Google announced the same kind of thing on their e-mail services.">MailChimp&#8217;s Project Omnivore: Declassified</a></li>
<li><a href="http://www.politifact.com/truth-o-meter/statements/2010/jan/25/carolyn-maloney/congresswoman-says-democratic-presidents-create-mo/" title="January 26 | &#8220;Obviously, luck matters a lot, but when there is a consistent pattern over more than 60 years, it starts to look like more than just luck.&#8221;">Congresswoman says Democratic presidents create more private-sector jobs</a></li>
<li><a href="http://www.ted.com/talks/taylor_mali_what_teachers_make.html" title="January 25 | Truth.">Taylor Mali: What teachers make</a></li>
<li><a href="http://notebook.johnmartz.com/how-websites-work?c=1" title="January 22 | At last, the truth is out and I can stop pretending:  beatific monkeys are what makes it all go.">How websites work</a></li>
</ul>
</div>
<div class="panel" id="advisory">
<div class="guarded">
<a href="http://blogadvisorysystem.com/"><img src="/pix/bas/guarded.png" alt="Blog Advisory System Alert Level: Guarded"></a>
</div>
</div>

<div class="panel" id="excuse">
<h4>The <a href="/feeds/excuse/">excuse of the day</a> is</h4>
<p>Chrome</p>
</div>

<div class="panel" id="extras">
<h4>Extras</h4>
<ul>
<li><a href="/feeds/">Feeds</a> &#8226;</li>
<li><a href="/eric/faq.html">FAQ</a> &#8226;</li>
<li><a href="/family.html">Family</a></li>
</ul>
</div>

</div>

<div id="navigate">
<h4>Navigation</h4>
<ul id="navlinks">
<li id="archLink"><a href="/eric/thoughts/">Archives</a></li>
<li id="cssLink"><a href="/eric/css/">CSS</a></li>
<li id="toolsLink"><a href="/eric/tools/">Toolbox</a></li>
<li id="writeLink"><a href="/eric/writing.html">Writing</a></li>
<li id="speakLink"><a href="/eric/talks/">Speaking</a></li>
<li id="otherLink"><a href="/other/">Leftovers</a></li>
<li id="aboutsite"><a href="/ui/about.html">About this site</a></li>
</ul>
</div>

<div id="footer">
<p class="sosumi">All contents of this site, unless otherwise noted, are &copy;1995-2008 <strong>Eric A. and Kathryn S. Meyer</strong>.  All Rights Reserved.</p>
<p>"<a href="/eric/thoughts/">Thoughts From Eric</a>" is powered by the &uuml;bercool <a href="http://wordpress.org/">WordPress</a></p>
</div>
</body>
</html>
