I've heard (XPath or querySelector?) that XPath (evaluate
) can do everything that a CSS3 selector (querySelector
) can and even more, but couldn't find what exactly "more" it can do, can you list what exactly is "more"?
Asked
Active
Viewed 610 times
2
-
1Oh, XPath is much more powerful node selection mechanism. From the top of my head what XPath allows to do which CSS selector can't: 1). it has XPath Axes (parent, ancestors, and more); 2). `..` expression; 3). more convenient `position` expressions. 4). you can even use arithmetic operators, like select nodes where attribute more then ... – dfsq Aug 20 '14 at 09:15
-
Is there anything you wanted to do with XPath that did not work? Or put another way: Do you have a purely theoretical interest in finding the differences between them? A specific programming question would be better suited for SO. – Mathias Müller Aug 20 '14 at 09:30
-
This is really **too broad** to answer without a specific use case. – Artjom B. Aug 20 '14 at 17:58
-
I wanted to switch to querySelector cuz I started with xpath and was using it mostly for simply tasks (and tests said it's 2500% slower), so it's mostly theoretical to see what I'd be missing – Owyn Aug 20 '14 at 22:07