>>If you want elegance, simplicity, and specificity then your best bet is XPath. If Diego Perini is listening in to this conversation I'd love to hear his thoughts, I know this is his area of expertise, and I know he's very opinionated about where the DOM is headed. I'm not entirely sure I understand you Austin, are you saying utilize native XPath methods over traditional DOM methods, because that debate ended a couple of years ago, or are you saying I should use XPath completely, as what is exposed to the end user? If the latter, than your idea is intriguing, and not one I would have considered.
On Tue, Sep 6, 2011 at 12:46 PM, Cheney, Austin < [email protected]> wrote: > > 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: [email protected] [mailto:[email protected]] On > Behalf Of Nathan Sweet > Sent: Tuesday, September 06, 2011 2:12 PM > To: [email protected] > 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 <[email protected]> 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/[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] > > -- > 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]
