Nick Morgan wrote: > Scott Sauyet wrote: >> XPath is >> inarguably more expressive than CSS. And it's designed for the same >> sort of targeting that we expect in DOM scripting. So there is a lot >> to be said for using it. The biggest downfall is that it rarely gains >> us anything; how often do we really need to target something that >> can't be expressed with CSS? And what's the point of adding a new >> tool that adds no *needed* functionality? > > The difference between XPath and CSS is that XPath is targeted towards > XML, whereas CSS is targeted towards HTML (primarily). So, when you're > only working with HTML, XPath is un-necessarily verbose.
It is more verbose, but I'm not sure that I agree with their targets. CSS is also targeted at general XML. Really the only part of the CSS spec I can think of that deals with the quirks of HTML is the .class selector that matches against a space-separated list of classes. CSS, though, was designed for progressive rendering (the only exceptions I can come up with are the `:nth-last-*` selectors), whereas XPath really only makes sense on a full DOM. I think that explains much of the difference. I am not recommending that people switch to XPath for DOM queries. I don't think it brings enough advantages to outweigh the issues, but it is an interesting idea. -- Scott -- 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