Re: [JSMentors] Re: spaces in attribute values

2011-09-21 Thread Diego Perini
Nice helper for CSS rules, the only way I know of targeting IDs containing spaces. With CSS selectors however one can still use spaces when matching attributes like IDs: document.querySelectorAll('[id="123 foo bar lolwat"]'); -- Diego On Wed, Sep 21, 2011 at 9:46 PM, Mathias Bynens wrote: >

[JSMentors] Re: spaces in attribute values

2011-09-13 Thread Scott Sauyet
Michal Kuklis wrote: > wow you guys have seriously way too much time... please, please just > stop this already. I think I will. I still don't understand Austin's rationale for insisting -- without presenting evidence -- that XPath is so superior to other selection methods. But it seems to have

Re: [JSMentors] Re: spaces in attribute values

2011-09-13 Thread Michal Kuklis
: spaces in attribute values Austin Cheney wrote: Scott Sauyet wrote: Let's talk real numbers here. http://jsperf.com/xpath-vs-dom This test is invalid. There are almost no valid examples where operations per second account for any sort of performance associated with web technologies.

RE: [JSMentors] Re: spaces in attribute values

2011-09-13 Thread Cheney, Austin
com [mailto:jsmentors@googlegroups.com] On Behalf Of Scott Sauyet Sent: Tuesday, September 13, 2011 7:14 AM To: The JSMentors JavaScript Discussion Group Subject: [JSMentors] Re: spaces in attribute values Austin Cheney wrote: > Scott Sauyet wrote: >> Let's talk real numbers here. >> >>

[JSMentors] Re: spaces in attribute values

2011-09-13 Thread Scott Sauyet
Austin Cheney wrote: > Scott Sauyet wrote: >> Let's talk real numbers here. >> >>    http://jsperf.com/xpath-vs-dom > > This test is invalid.  There are almost no valid examples where > operations per second account for any sort of performance associated > with web technologies.   You brought up p

RE: [JSMentors] Re: spaces in attribute values

2011-09-12 Thread Cheney, Austin
ct: [JSMentors] Re: spaces in attribute values Austin Cheney wrote: > Scott Sauyet wrote: >> You brought up XPath as an alternative to JQuery's >> selectors API. JQuery (and most competing selector engines) claim to >> support most if not all of CSS3. > > I ha

[JSMentors] Re: spaces in attribute values

2011-09-12 Thread Scott Sauyet
Matthias Reuter wrote: >> Let's talk real numbers here. > >>    http://jsperf.com/xpath-vs-dom > > I don't know if I understand the XPath correctly, but it seems to me, that   > the three examples don't do the same (actually, they do in the given   > example, but not in general. You're right. The

Re: [JSMentors] Re: spaces in attribute values

2011-09-12 Thread Matthias Reuter
Let's talk real numbers here. http://jsperf.com/xpath-vs-dom I don't know if I understand the XPath correctly, but it seems to me, that the three examples don't do the same (actually, they do in the given example, but not in general. document.evaluate("../../h3", button, null, XPath

Re: [JSMentors] Re: spaces in attribute values

2011-09-10 Thread Diego Perini
On Sat, Sep 10, 2011 at 2:45 AM, Scott Sauyet wrote: > Austin Cheney wrote: >> Scott Sauyet wrote: >>> You brought up XPath as an alternative to JQuery's >>> selectors API.  JQuery (and most competing selector engines) claim to >>> support most if not all of CSS3. >> >> I have compared XPath to CS

Re: [JSMentors] Re: spaces in attribute values

2011-09-10 Thread Diego Perini
Scott, I would add other parts that don't fit my requirements in XPath: 1) result set is not an array like, you must ".iterateNext()" and push each item in the set 2) XPath "evaluate" method/interface is only available on the document node object 3) It is too slow for the simplest selections compa

[JSMentors] Re: spaces in attribute values

2011-09-09 Thread Scott Sauyet
Austin Cheney wrote: > Scott Sauyet wrote: >> You brought up XPath as an alternative to JQuery's >> selectors API. JQuery (and most competing selector engines) claim to >> support most if not all of CSS3. > > I have compared XPath to CSS selectors. Perhaps I misunderstood. > jQuery is not compil

RE: [JSMentors] Re: spaces in attribute values

2011-09-09 Thread Cheney, Austin
e execution of an XPath expression should be roughly equivalent to a regular expression operation, which is faster than DOM methods and certainly faster than a jQuery index. Thanks, Austin Cheney, CISSP -Original Message- From: jsmentors@googlegroups.com [mailto:jsmentors@googleg

[JSMentors] Re: spaces in attribute values

2011-09-09 Thread Scott Sauyet
Austin Cheney wrote: > Scott Sauyet wrote: > Most of the advanced CSS selector examples you have provided are only > CSS level 3, which less widely supported than XPath.  Therefore many of > arguments favoring use of CSS selectors for specific targeting less > valid. This entire discussion as I've

RE: [JSMentors] Re: spaces in attribute values

2011-09-09 Thread Cheney, Austin
cess. I am not sure if this method is supported in IE9. Thanks, Austin Cheney, CISSP -Original Message- From: jsmentors@googlegroups.com [mailto:jsmentors@googlegroups.com] On Behalf Of Scott Sauyet Sent: Thursday, September 08, 2011 9:10 PM To: The JSMentors JavaScript Discussion G

[JSMentors] Re: spaces in attribute values

2011-09-08 Thread Scott Sauyet
Austin Cheney wrote: > Scott Sauyet wrote: >> 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 can't say I

[JSMentors] Re: spaces in attribute values

2011-09-08 Thread Scott Sauyet
Austin Cheney wrote: > Scott Sauyet wrote: >> On the other hand, can you find any better way to mimic `p.foo` than >> the following?: > > I would just use //p[@class = "foo"] > Of course, this looks for a class attribute whose value is only "foo". > Outside of jQuery I see absolutely no value in su

RE: [JSMentors] Re: spaces in attribute values

2011-09-08 Thread Cheney, Austin
heney, CISSP -Original Message- From: jsmentors@googlegroups.com [mailto:jsmentors@googlegroups.com] On Behalf Of Scott Sauyet Sent: Thursday, September 08, 2011 2:03 PM To: The JSMentors JavaScript Discussion Group Subject: [JSMentors] Re: spaces in attribute values Austin Cheney wrote: > S

[JSMentors] Re: spaces in attribute values

2011-09-08 Thread Scott Sauyet
Austin Cheney wrote: > Scott Sauyet wrote: >> how often do we really need to target something that can't be >> expressed with CSS? > > All the time.  How can I target the following with CSS? > > * parent Can't do this, by design. This would be the primary advantage to XPath > * last child p sp

RE: [JSMentors] Re: spaces in attribute values

2011-09-08 Thread Cheney, Austin
JavaScript Discussion Group Subject: [JSMentors] Re: spaces in attribute values 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 i

[JSMentors] Re: spaces in attribute values

2011-09-08 Thread Scott Sauyet
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 d

RE: [JSMentors] Re: spaces in attribute values

2011-09-08 Thread Cheney, Austin
On Behalf Of Scott Sauyet Sent: Thursday, September 08, 2011 6:31 AM To: The JSMentors JavaScript Discussion Group Subject: [JSMentors] Re: spaces in attribute values Nathan Sweet wrote: > [ ... ] [T]he more I delve into building my engine > the more I see that the ph

Re: [JSMentors] Re: spaces in attribute values

2011-09-08 Thread Nick Morgan
On 8 September 2011 12:30, Scott Sauyet wrote: > Nathan Sweet wrote: >> [ ... ]                          [T]he more I delve into building my engine >> the more I see that the philosophical argument for using CSS is weak and >> tenuous. I'm planning on building another engine soon that only works f

[JSMentors] Re: spaces in attribute values

2011-09-08 Thread Scott Sauyet
Nathan Sweet wrote: > [ ... ] [T]he more I delve into building my engine > the more I see that the philosophical argument for using CSS is weak and > tenuous. I'm planning on building another engine soon that only works for > the latest browsers only (a sort of high-end eng