Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] OT: W3C
- From: liorean at f2o.org (liorean)
- Subject: [Javascript] OT: W3C
- Date: Wed May 26 10:20:08 2004
Hassan Schroeder wrote: > Shawn Milo wrote: > >> The reason for using double quotes around HTML attributes is that the >> W3C (http://www.w3.org/), the standards body which defines HTML, CSS, >> XHTML, etc., has made that the standard. > > > citing <http://www.w3.org/TR/html4/intro/sgmltut.html#attributes> > > By default, SGML requires that all attribute values be > delimited using either double quotation marks (ASCII decimal > 34) or single quotation marks (ASCII decimal 39). Single > quote marks can be included within the attribute value when > the value is delimited by double quote marks, and vice versa. > > ...unless you have another reference to the contrary... :-) There's a number of practical reasons for using double quotes, though: - Consistency with everyone else. - Double quotes allows you to use single quotes/apostrophes inside, which means that you can write regular English in it without escaping them. - For most uses, people tend to use single quotes in JavaScript. This makes for good JavaScript/HTML compatibility. JavaScript can be contained in an attribute value, and HTML can be contained within a JavaScript string, without requiring escaping. - Same goes for inline CSS and properties such as font-family, that may need quoting it's values. -- David "liorean" Andersson ViewStyles, ViewScripts, SwitchStyles and GraphicsInfo bookmarklets: <http://liorean.web-graphics.com/> Hangouts: <http://codingforums.com/> <http://yourmusicforums.com/>
- Follow-Ups:
- [Javascript] OT: W3C
- From: Chris T
- [Javascript] OT: W3C
- References:
- [Javascript] OT: W3C
- From: Shawn Milo
- [Javascript] OT: W3C
- From: Hassan Schroeder
- [Javascript] OT: W3C
- Prev by Date: [Javascript] OT: W3C
- Next by Date: [Javascript] multiple languages
- Previous by thread: [Javascript] OT: W3C
- Next by thread: [Javascript] OT: W3C
- Index(es):