Values in CSS are space separated string literals.  A single value instance of 
a single property may contain spaces apart from other single values of the same 
property, however there must be a distinguishing characteristic to prevent 
unexpected separating of your single value instance that does contain spaces.  
This is accomplished with quotes.

font-family: monospace, 'Courier New', 'Lucida Console';

CSS, like HTML/XHTML accepts double and single characters equally so long as 
the terminating character of a given pair matches its opening counterpart.  If 
other engines are throwing an error at this behavior then they are performing 
improperly.  If they are throwing errors at the following example then they are 
perhaps less forgiving, but not necessarily acting improperly.

font-family: monospace, Courier New, Lucida Console;

In this second example there is a list of values, but what is the value 
separator the space, the comma, or both?  In this case it may be preferable to 
throw an error if this complicates interpretation during some algorithmic 
process.  If this example is acceptable then your engine is more forgiving and 
will likely be more welcomed in the public space.  You will have to decide 
whether you want your tool to be simple and maintainable or popular and widely 
reused.  You do not get both without significantly increasing your development 
costs.

Thanks,
Austin Cheney, CISSP


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf 
Of nathanJsweet
Sent: Tuesday, September 06, 2011 10:02 AM
To: The JSMentors JavaScript Discussion Group
Subject: [JSMentors] spaces in attribute values

Hey all,
I'm building my selector engine still (for those of you who remember
my ill-fated test suite), I'll be submitting it for code review
shortly, but I ran into an interesting issue that I was hoping someone
could resolve for me. Nowhere, that I can find, in the CSS spec does
it say that an attribute-value may not contain spaces in it using the
attribute selector. In fact, quite the opposite seems to be stated in
section 6.3 of the spec it says:

"Attribute values must be CSS identifiers or strings."

This is in explicit reference to the attribute selector, which would
lead me to believe that whitespace is certainly allowed. However, I
have noticed that in Sizzle and other selector engines, including the
native querySelector function, that whitespace throws an error; also,
not one of the examples in the attribute selector section of the CSS
spec has an example with whitespace. My question is: is there
something I'm missing?

My selector engine can handle whitespace in this situation, and I see
no reason why it shouldn't, because it's not as though whitespace in
this situation can create syntactic confusion as a brace, "]",
delimits the whole selection.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to