parseInt() and CSS naming was Re: [thelist] javascript "won't" subtract

Emma Jane Hogbin emmajane at xtrinsic.com
Sun Mar 9 17:56:01 CST 2003


On Sun, Mar 09, 2003 at 04:37:58PM -0600, Keith Dahlby wrote:
> For XHTML, the id attribute is of XML attribute type ID (see
> http://www.w3.org/TR/REC-xml#sec-attribute-types).  This type must match
> the Name production (http://www.w3.org/TR/REC-xml#dt-name):
> A Name is a token beginning with a letter or one of a few punctuation
> characters, and continuing with letters, digits, hyphens, underscores,
> colons, or full stops, together known as name characters.

I think I'm confused. (It's bad when you're not even sure if you're
confused or not.) In simplest terms I think the above paragraph means:
	In XHTML the following applies:
	IDs can only be made up out of "names"
	"names" can only begin with [A-Za-z] OR _ OR :
		(let's pretend the only letters right now are a-z letters)

If this is the case, why does my document validate as XHTML 1.0
Transitional when I have id="1"? Is the W3C validator simply overlooking
it?

> The only constraint that I can find on selectors in CSS is how patterns are
> matched (http://www.w3.org/TR/REC-CSS2/selector.html#type-selectors).  This
> restricts the use of colons and periods.  And though I've heard people talk
> about it before, I've never seen anything that indicates that hyphens are
> prohibited (and a quick check shows that pages using them validate).

I would have given the example of attribute selectors here:
http://www.w3.org/TR/REC-CSS2/selector.html#q10

[att|=val]
    Match when the element's "att" attribute value is a hyphen-separated
list of "words", beginning with "val". The match always starts at the
beginning of the attribute value. This is primarily intended to allow
language subcode matches (e.g., the "lang" attribute in HTML) as described
in RFC 1766 ([RFC1766]).

But it doesn't say that you're not allowed to use hyphens, it just tells
you there's a way to match on a hyphen... Agreed that a page with a class
or id name that's hyphenated will validate.

emma

--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]



More information about the thelist mailing list