Single quotes xhtml...

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Single quotes xhtml...

Post by andre_c »

I was told that it's better to use double quotes around tag attributes because they're standard xhtml. When I validate my code (in which i only use single quotes) on the w3c validator, it tells me that it's valid xhtml.
Is it true that single quotes for attributes are not standard xhtml?
if so, can you post a url that confirms it?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Both the 3rd edition of XML1.0 and XML1.1 recommendations allow single quotes to be used arond attribute values.

http://www.w3.org/TR/2004/REC-xml-20040204/#NT-AttValue
http://www.w3.org/TR/2004/REC-xml11-200 ... T-AttValue

Since the XHTML is just a dialect of XML it should allow it as well.
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

Thanks a lot for your reply,
I feel a lot better now about using single quotes.
( they're just a lot easier to deal with when echoing strings of html inside of double quotes, IMO)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Hmm... when I first read the spec, it felt like it required double quotes. My mistake, I guess.
Post Reply