Looks like the CSS Working Group has published their first working draft of how they'd like CSS4 selectors to work.
Here are some of the highlights:
var el = document.querySelector("#foo"); // returns first element with ID of foo
var bar = document.querySelector(":scope > p", el); // returns equivalent of "#foo > p"
li a:matches(:link, :hover, :visited)
a:local-link /* Matches anything that links to the current page */
a:local-link(0) /* Matches any link that is the same domain */
There's tons more and David Storey does a great job of explaining stuff in his blog post.