> So this presents an interesting dilemma

The dilemma is far more complicated than merely that.  You are using one means 
of selection in a context for which it was never intended.  That is why it is 
incomplete and error prone and it's not because of short-sightedness in CSS.  
This is why jQuery has to temper its use of CSS selectors as a query means with 
the addition of a large number of methods to complement the short comings of 
this convention.

If you want elegance, simplicity, and specificity then your best bet is XPath.  
This is the only thing XPath was designed for.  A simple XPath expression can 
give you a higher degree of specificity than a complex CSS selection with a 
whole host of unnecessary methods.  If that option is either unavailable or 
undesirable you can use the clunky DOM methods, which are neither the most 
elegant nor fastest solution, as they do their job with clarity.

If at the end of the day you still want to use some out of context convention 
then be prepared to make some hard decisions that come with unpleasantly 
burdensome consequences that extend beyond implementation questions.

Thanks,
Austin Cheney, CISSP

From: jsmentors@googlegroups.com [mailto:jsmentors@googlegroups.com] On Behalf 
Of Nathan Sweet
Sent: Tuesday, September 06, 2011 2:12 PM
To: jsmentors@googlegroups.com
Subject: Re: [JSMentors] spaces in attribute values

>>As for ANY CSS property value, that is more than one word you should use 
>>quotes, like font names. That this would apply to selectors too.

Thanks Poetro,
So this presents an interesting dilemma, it really is more of a code design 
question whether I should go above and beyond the call of duty and except 
identifiers with white space in them, it would actually be easier for me to do 
so, but would this be lazy? I think I'm good for now, but if anybody is really 
passionate about the philosophy of arbitrarily implementing the CSS spec as a 
mode of selecting elements in javascript, I'd be interested to hear their 
thoughts.
-Nate
On Tue, Sep 6, 2011 at 9:08 AM, Poetro <poe...@gmail.com> wrote:
Sorry, messed the the order

>> Attribute values must be CSS identifiers or strings.
>
> See the specification for identifiers
> http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
>
>> In CSS, identifiers (including element names, classes, and IDs in selectors)
>> can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0
>> and higher, plus the hyphen (-) and the underscore (_); they cannot start 
>> with a
>> digit, two hyphens, or a hyphen followed by a digit.
--
Poetro

--
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/
 
To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/
 
To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to