Re: Quotes vs. Single Quote

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 5, 2010 at 10:53 PM, Rick Dwyer <rpdwyer@xxxxxxxxxxxxx> wrote:

>
> On Aug 5, 2010, at 10:43 PM, Michael Shadle wrote:
>
> >
> > For HTML, -always- use double quotes.
> >
> > <tag attribute="bar" /> is the right way.
> > <tag attribute='bar' /> is the wrong way.
> >
> > I'd go into more explanation but there simply doesn't need to be one.
>

I would suggest that saying <tag attribute='bar' /> is "the wrong way" is a
rather strong assessment.  Whether you're talking about SGML (the
grandparent), XML (the parent), or XHTML, the use of a single quote is
perfectly valid, and has served a purpose since inception.  If I'm crafting
markup and embedding something that has a double quote within an attribute
(often times an alt attribute on an image), I don't hesitate to use the
single quote as the attribute delimiter.  That said, it's often easier if
you standardize on one, and most choose to use double quotes the default
delimiter.

Tim Bray, who knows a little bit about XML dialects (tongue in cheek),
appears to default to the single quote as his delimiter of choice:
http://www.tbray.org/ongoing/

Now, speaking to questions/concerns about javascript events frequent use of
single quotes beg the question:  Why are you embedding javascript events
into the markup of the page?  I'm aware of many sources that advocate
against mixing javascript and html in this way (see the books PPK on
Javascript, DOM Scripting, etc.)

That said, if there are some sources to point to that make a case for the
deprecation of single quotes in (X)HTML attributes, please let me know.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux