<?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: Grammar Question</title>
	<atom:link href="http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/feed/" rel="self" type="application/rss+xml" />
	<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/</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: Mary</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-14281</link>
		<dc:creator>Mary</dc:creator>
		<pubDate>Fri, 03 Feb 2006 14:43:20 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-14281</guid>
		<description>Is the title of a play underlined or in quotes?  Thank you for your assistance.</description>
		<content:encoded><![CDATA[<p>Is the title of a play underlined or in quotes?  Thank you for your assistance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-967</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Sun, 19 Sep 2004 12:36:40 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-967</guid>
		<description>&lt;p&gt;
Okay, it&#039;s much more clear now&#8212;thanks to all.
&lt;/p&gt;
&lt;p&gt;
J.B.: yep, you&#039;re right, that&#039;s more in line with what I meant to say, although I realized later that my formulation didn&#039;t permit single-quote marks, and in turn neither did yours, but you were a lot closer to being correct than I was.  As for the outsider-hostile character encoding, I figure that anyone who needs to encode markup will know how to do it; nobody else would really need to know anyway.  One of these days I&#039;ll probably add a preview function, but there are a lot of other things sitting much higher on my priority list.  With any luck, WordPress will get a comment-preview function built in, and that will be that.
&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>
Okay, it&#8217;s much more clear now&mdash;thanks to all.
</p>
<p>
J.B.: yep, you&#8217;re right, that&#8217;s more in line with what I meant to say, although I realized later that my formulation didn&#8217;t permit single-quote marks, and in turn neither did yours, but you were a lot closer to being correct than I was.  As for the outsider-hostile character encoding, I figure that anyone who needs to encode markup will know how to do it; nobody else would really need to know anyway.  One of these days I&#8217;ll probably add a preview function, but there are a lot of other things sitting much higher on my priority list.  With any luck, WordPress will get a comment-preview function built in, and that will be that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J.B. Nicholson-Owens</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-966</link>
		<dc:creator>J.B. Nicholson-Owens</dc:creator>
		<pubDate>Sun, 19 Sep 2004 07:17:06 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-966</guid>
		<description>By the way, I don&#039;t think &quot;[ &#039;&quot;&#039;? IDENT &#039;&quot;&#039;? ]&quot; means what you think it means, Eric.  I think it means that EACH quote is optional, not BOTH quotes TAKEN TOGETHER.  The subtle difference is illustrated here; with your syntax all of the following 4 are legal:

 &quot;hello&quot;  (quotes on both ends -- you thought of this)
 &quot;hello   (quote on left only)
  hello&quot;  (quote on right only)
  hello   (no quotes at all -- you thought of this)

I think what you were going for is

  [ &#039;&quot;&#039; IDENT &#039;&quot;&#039; &#124; IDENT ]

which indicates a choice: quotes-on or quotes-off, you supply both quotes or no quotes.  No onesies.

Finally, telling people to &quot;Remember to encode character entities if you&#039;re posting markup examples!&quot; without a preview button is rather &quot;hostile-to-outsiders&quot;, no?</description>
		<content:encoded><![CDATA[<p>By the way, I don&#8217;t think &#8220;[ '"'? IDENT '"'? ]&#8221; means what you think it means, Eric.  I think it means that EACH quote is optional, not BOTH quotes TAKEN TOGETHER.  The subtle difference is illustrated here; with your syntax all of the following 4 are legal:</p>
<p> &#8220;hello&#8221;  (quotes on both ends &#8212; you thought of this)<br />
 &#8220;hello   (quote on left only)<br />
  hello&#8221;  (quote on right only)<br />
  hello   (no quotes at all &#8212; you thought of this)</p>
<p>I think what you were going for is</p>
<p>  [ '"' IDENT '"' | IDENT ]</p>
<p>which indicates a choice: quotes-on or quotes-off, you supply both quotes or no quotes.  No onesies.</p>
<p>Finally, telling people to &#8220;Remember to encode character entities if you&#8217;re posting markup examples!&#8221; without a preview button is rather &#8220;hostile-to-outsiders&#8221;, no?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jf</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-964</link>
		<dc:creator>jf</dc:creator>
		<pubDate>Sun, 19 Sep 2004 02:24:57 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-964</guid>
		<description>String vs. ident: The choice between string and ident allows you to skip the quotes if it is a single, simple word (no space, punctuation or non-ascii). So 
&lt;code&gt;class=abc&lt;/code&gt; and &lt;code&gt;class=&quot;abc&quot;&lt;/code&gt; are both legal, while &lt;code&gt;class=&quot;to be&quot;&lt;/code&gt; must be quoted. The historical reason is proably that html uses these rules. (Unlike xml/xhtml, where quotes/strings are always mandatory.) 

Strings do allow all characters, both ascii and non-ascii, with the newline/control char/quote exceptions. 
&quot;string doesn&#039;t allow non-ascii characters&quot; refers to &quot;the flaw in the reasoning&quot;, not to strings.</description>
		<content:encoded><![CDATA[<p>String vs. ident: The choice between string and ident allows you to skip the quotes if it is a single, simple word (no space, punctuation or non-ascii). So<br />
<code>class=abc</code> and <code>class="abc"</code> are both legal, while <code>class="to be"</code> must be quoted. The historical reason is proably that html uses these rules. (Unlike xml/xhtml, where quotes/strings are always mandatory.) </p>
<p>Strings do allow all characters, both ascii and non-ascii, with the newline/control char/quote exceptions.<br />
&#8220;string doesn&#8217;t allow non-ascii characters&#8221; refers to &#8220;the flaw in the reasoning&#8221;, not to strings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Baron</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-963</link>
		<dc:creator>David Baron</dc:creator>
		<pubDate>Sun, 19 Sep 2004 02:16:03 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-963</guid>
		<description>Er, I did write a double negative, just not in the right two places.  I meant &quot;doesn&#039;t disallow ASCII characters&quot; (well, most of them).  But I put a &quot;non-&quot; in front of &quot;ASCII&quot; instead of a &quot;dis&quot; in front of &quot;allow&quot;.

I should always read what I write to see any words out!</description>
		<content:encoded><![CDATA[<p>Er, I did write a double negative, just not in the right two places.  I meant &#8220;doesn&#8217;t disallow ASCII characters&#8221; (well, most of them).  But I put a &#8220;non-&#8221; in front of &#8220;ASCII&#8221; instead of a &#8220;dis&#8221; in front of &#8220;allow&#8221;.</p>
<p>I should always read what I write to see any words out!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Baron</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-962</link>
		<dc:creator>David Baron</dc:creator>
		<pubDate>Sun, 19 Sep 2004 02:14:11 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-962</guid>
		<description>Oops, I was trying to write a double negative and I forgot one of them.  I meant &quot;doesn&#039;t disallow&quot;.

And the reason simple STRING doesn&#039;t suffice is that we want to allow &lt;code&gt;td[align=left]&lt;/code&gt; in addition to &lt;code&gt;td[align=&quot;left&quot;]&lt;/code&gt;, as long as the attribute value is reasonably simple (i.e., an identifier).</description>
		<content:encoded><![CDATA[<p>Oops, I was trying to write a double negative and I forgot one of them.  I meant &#8220;doesn&#8217;t disallow&#8221;.</p>
<p>And the reason simple STRING doesn&#8217;t suffice is that we want to allow <code>td[align=left]</code> in addition to <code>td[align="left"]</code>, as long as the attribute value is reasonably simple (i.e., an identifier).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-961</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Sun, 19 Sep 2004 00:32:36 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-961</guid>
		<description>&lt;p&gt;
The &lt;code&gt; -~&lt;/code&gt; bit pointed out by Antone seems to have been the missing key in terms of character-range.  But why, then, offer a choice of a STRING or IDENT, when it seems like a simple STRING would suffice?  I still don&#039;t get that part.  And then David said:
&lt;/p&gt;
&lt;blockquote cite=&quot;http://www.meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-959&quot;&gt;
The flaw in the reasoning in the post is, as pointed out above, that STRING doesn</description>
		<content:encoded><![CDATA[<p>
The <code> -~</code> bit pointed out by Antone seems to have been the missing key in terms of character-range.  But why, then, offer a choice of a STRING or IDENT, when it seems like a simple STRING would suffice?  I still don&#8217;t get that part.  And then David said:
</p>
<blockquote cite="http://www.meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-959"><p>
The flaw in the reasoning in the post is, as pointed out above, that STRING doesn</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Baron</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-959</link>
		<dc:creator>David Baron</dc:creator>
		<pubDate>Sat, 18 Sep 2004 20:20:05 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-959</guid>
		<description>The flaw in the reasoning in the post is, as pointed out above, that STRING doesn&#039;t allow non-ASCII characters.  In fact, it allows all characters except for unescaped newlines, the type of quotation marks quoting the string (unescaped), and control characters other than TAB (i.e., all characters less than ASCII/Unicode 32 other than TAB, plus ASCII/Unicode 127).

That said, it should be possible to figure this out without looking at the grammar.  The attribute selector part certainly is possible: 5.8.1 says &quot;Attribute values must be identifiers or strings.&quot;  The definitions of identifiers and strings, though, should probably be clearer in chapter 4.</description>
		<content:encoded><![CDATA[<p>The flaw in the reasoning in the post is, as pointed out above, that STRING doesn&#8217;t allow non-ASCII characters.  In fact, it allows all characters except for unescaped newlines, the type of quotation marks quoting the string (unescaped), and control characters other than TAB (i.e., all characters less than ASCII/Unicode 32 other than TAB, plus ASCII/Unicode 127).</p>
<p>That said, it should be possible to figure this out without looking at the grammar.  The attribute selector part certainly is possible: 5.8.1 says &#8220;Attribute values must be identifiers or strings.&#8221;  The definitions of identifiers and strings, though, should probably be clearer in chapter 4.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurens Holst</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-958</link>
		<dc:creator>Laurens Holst</dc:creator>
		<pubDate>Sat, 18 Sep 2004 19:15:51 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-958</guid>
		<description>Because CSS 2.1 is more based on real-world implementations and lessons learned from CSS 2. It is the better spec (especially as far as clarity of explanations is concerned), and the one most browsers aim to implement.

~Grauw</description>
		<content:encoded><![CDATA[<p>Because CSS 2.1 is more based on real-world implementations and lessons learned from CSS 2. It is the better spec (especially as far as clarity of explanations is concerned), and the one most browsers aim to implement.</p>
<p>~Grauw</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Dabell</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-957</link>
		<dc:creator>Jim Dabell</dc:creator>
		<pubDate>Sat, 18 Sep 2004 17:27:02 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-957</guid>
		<description>Is there any particular reason you are quoting from CSS 2.1 and not CSS 2?  The definition of attr is the same, and the 2.1 specification states:

&lt;blockquote&gt;&quot;Publication as a Candidate Recommendation does not imply endorsement by the W3C Membership. It is inappropriate to cite this document as other than work in progress.&quot;&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p>Is there any particular reason you are quoting from CSS 2.1 and not CSS 2?  The definition of attr is the same, and the 2.1 specification states:</p>
<blockquote><p>&#8220;Publication as a Candidate Recommendation does not imply endorsement by the W3C Membership. It is inappropriate to cite this document as other than work in progress.&#8221;</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Uri Bernstein</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-956</link>
		<dc:creator>Uri Bernstein</dc:creator>
		<pubDate>Sat, 18 Sep 2004 16:09:41 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-956</guid>
		<description>Alway one step behind you :-)
I should refresh more often.</description>
		<content:encoded><![CDATA[<p>Alway one step behind you :-)<br />
I should refresh more often.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antone Roundy</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-955</link>
		<dc:creator>Antone Roundy</dc:creator>
		<pubDate>Sat, 18 Sep 2004 16:09:01 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-955</guid>
		<description>I don&#039;t think &#039;div[class=this is a test] {color: orange;}&#039;, without quotes, is legal.

attrib : &#039;[&#039; S* IDENT S* [ [ &#039;=&#039; &#124; INCLUDES &#124; DASHMATCH ] S* [ IDENT &#124; STRING ] S* ]? &#039;]&#039;

After the &#039;=&#039;, you can have 0 or more whitespace characters followed by exactly one ident or string  followed by 0 or more whitespace characters (notice that there&#039;s no &quot;*&quot;, &quot;+&quot; or anything after [ IDENT &#124; STRING ], so you have to have exactly one of those). If you put quotes around &quot;this is a test&quot;, you have one string. Without the quotes, you have 4 identifiers.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think &#8216;div[class=this is a test] {color: orange;}&#8217;, without quotes, is legal.</p>
<p>attrib : &#8216;[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S* [ IDENT | STRING ] S* ]? &#8216;]&#8217;</p>
<p>After the &#8216;=&#8217;, you can have 0 or more whitespace characters followed by exactly one ident or string  followed by 0 or more whitespace characters (notice that there&#8217;s no &#8220;*&#8221;, &#8220;+&#8221; or anything after [ IDENT | STRING ], so you have to have exactly one of those). If you put quotes around &#8220;this is a test&#8221;, you have one string. Without the quotes, you have 4 identifiers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Uri Bernstein</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-954</link>
		<dc:creator>Uri Bernstein</dc:creator>
		<pubDate>Sat, 18 Sep 2004 16:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-954</guid>
		<description>Antone - I&#039;m afraid you took the wrong turn in step 3 - you followed the rule for escaped characters (which consist of a backslash followed by something).

(the other reason I&#039;m posting this comment is to correct my e-mail address, which I mis-typed last time).</description>
		<content:encoded><![CDATA[<p>Antone &#8211; I&#8217;m afraid you took the wrong turn in step 3 &#8211; you followed the rule for escaped characters (which consist of a backslash followed by something).</p>
<p>(the other reason I&#8217;m posting this comment is to correct my e-mail address, which I mis-typed last time).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antone Roundy</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-953</link>
		<dc:creator>Antone Roundy</dc:creator>
		<pubDate>Sat, 18 Sep 2004 15:57:32 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-953</guid>
		<description>Oops! Correction to what I wrote above. &quot;escape&quot; requires a backslash to precede it. The way you get the useful characters in there is from string1 (or string2) where is lists (-~ in the jumble of symbols. In this case, &quot;-&quot; denotes a range of characters, not a literal minus sign. The range (-~ includes almost everything in &lt;space&gt;-~, just not ! &quot; # $ % &amp; and &#039;, all of which (except the quote marks) are listed literally.</description>
		<content:encoded><![CDATA[<p>Oops! Correction to what I wrote above. &#8220;escape&#8221; requires a backslash to precede it. The way you get the useful characters in there is from string1 (or string2) where is lists (-~ in the jumble of symbols. In this case, &#8220;-&#8221; denotes a range of characters, not a literal minus sign. The range (-~ includes almost everything in &lt;space&gt;-~, just not ! &#8221; # $ % &#038; and &#8216;, all of which (except the quote marks) are listed literally.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Uri Bernstein</title>
		<link>http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-952</link>
		<dc:creator>Uri Bernstein</dc:creator>
		<pubDate>Sat, 18 Sep 2004 15:54:55 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/09/18/grammar-question/#comment-952</guid>
		<description>Hi Eric,

I hope I can help here a bit and perhaps thus pay back for some of the help I got from your books and columns.

STRING, in fact *does* include the ASCII range (or most of it). The key to understanding this is that little &quot;-&quot; hiding there, near the end of &lt;code&gt;[\t !#$%&amp;(&lt;b&gt;-&lt;/b&gt;~]&lt;/code&gt;, in the definition of STRING. What it means is &quot;any character whose code is &lt;i&gt;between&lt;/i&gt; that of &#039;(&#039; (which is hex 28) and &#039;~&#039; (which is hex 7E)&quot;. This includes all the digits, lower and upper case letters, and some more.

So if your string qualifies as an IDENT (roughly mening that it starts with a letter or underscore, and does not contain unescaped spaces or punctuation), you don&#039;t have to quote it. Any other string, you do have to quote.
Note that every IDENT also qualifies as a string (when quoted). So you&#039;re always allowed to quote, if you feel like it.

At least that&#039;s the way I understand it.</description>
		<content:encoded><![CDATA[<p>Hi Eric,</p>
<p>I hope I can help here a bit and perhaps thus pay back for some of the help I got from your books and columns.</p>
<p>STRING, in fact *does* include the ASCII range (or most of it). The key to understanding this is that little &#8220;-&#8221; hiding there, near the end of <code>[\t !#$%&#038;(<b>-</b>~]</code>, in the definition of STRING. What it means is &#8220;any character whose code is <i>between</i> that of &#8216;(&#8216; (which is hex 28) and &#8216;~&#8217; (which is hex 7E)&#8221;. This includes all the digits, lower and upper case letters, and some more.</p>
<p>So if your string qualifies as an IDENT (roughly mening that it starts with a letter or underscore, and does not contain unescaped spaces or punctuation), you don&#8217;t have to quote it. Any other string, you do have to quote.<br />
Note that every IDENT also qualifies as a string (when quoted). So you&#8217;re always allowed to quote, if you feel like it.</p>
<p>At least that&#8217;s the way I understand it.</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/2004/09/18/grammar-question/" rel="bookmark" title="Permanent Link: Grammar Question">Grammar Question</a></h3>
<ul class="meta">
<li class="date">Sat 18 Sep 2004</li>
<li class="time">1002</li>
<li class="cat"><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/2004/09/18/grammar-question/#comments">16 responses</a></li>
<li></li><li></li></ul>

<div class="text">
<p>
I was just recently asked if attribute selectors <strong>must</strong> use quotes around the value.  In other words, are both the following two selectors legal?
</p>
<pre>
a[href="http://www.meyerweb.com"] {font-weight: bold;}
a[href=http://www.complexspiral.com] {font-style: italic;}
</pre>
<p>
&#8220;No, they&#8217;re optional,&#8221; I said with assurance.  And then the doubts started to gnaw at me.  What if they actually weren&#8217;t, which might make sense given that you can require the exact match of a space-separated list of attribute values? By this, I mean that if you declare:
</p>
<pre>
div[class="this is a test"] {color: orange;}
</pre>
<p>
&#8230;then the selector will match any <code>div</code> element whose <code>class</code> attribute is <em>exactly</em> <code>this is a test</code>, in that order, and with nothing else in the attribute value.  Or so I&#8217;ve always been given to understand.  In that case, if you left off the quotes, couldn&#8217;t that somehow be confusing to the browser?  Maybe not, but it still bothered me.
</p>
<p>
So I went digging through <a href="http://www.w3.org/TR/CSS21/grammar.html" title="Grammar of CSS 2.1">CSS2.1, Appendix G</a> and found the grammatical definition of an attribute selector.
</p>
<pre>
attrib
  : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S*
    [ IDENT | STRING ] S* ]? ']'
  ;
</pre>
<p>
You all understood that, right?  Uh-huh.  Me either.  (This is one of those hostile-to-outsiders posts I <a href="/eric/thoughts/2004/09/07/on-the-outside/" title="On The Outside">mentioned a while back</a>.)
</p>
<p>
I never liked grammar in school, and I still don&#8217;t, but it is sometimes sadly necessary.  So here goes.  When you run down the definitions of the all-caps words (I think those are tokens) you find that IDENT is an identifier, which is sort of a catch-all bin for things like selectors, property names, values, and such.  Fine.  STRING, on the other hand, is a collection of symbols and other fun stuff, again including the non-ASCII range but not the ASCII range.  But then it includes the entirety of Unicode.  I&#8217;m not sure how much sense that makes, but whatever.
</p>
<p>
So the whole point of this is: if quotes around an IDENT are optional, wouldn&#8217;t it have made more sense to say this?
</p>
<pre>
attrib
  : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S*
    [ STRING? IDENT STRING? ] S* ]? ']'
  ;
</pre>
<p>
Or even:
</p>
<pre>
attrib
  : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S*
    [ '"'? IDENT '"'? ] S* ]? ']'
  ;
</pre>
<p>
It&#8217;s the <code>[ IDENT | STRING ]</code> from the original definition that has me befuddled.  It seems like it&#8217;s saying you can include an IDENT or a STRING but not both, and since IDENT doesn&#8217;t include quotes, that implies that you can either drop in an identifier, or a string with quotes.  Why is this a good idea?  Does it mean that any identifier has to be unquoted?  Does it mean that there&#8217;s no practical distinction between a STRING and an IDENT in this situation?  Does it mean that quotes prevent the inclusion of anything useful?  Somebody let me know.
</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>Saw a temporary license plate with expiration date MAR3010 and thought of <a href="http://twitter.com/t">@t</a>. <small>&#8211;tweeted 7 hours, 19 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>Internet 1 traffic is being routed onto Internet 2</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>
