读书笔记,稍后整理~~
#main <div> p: This expression finds an element with an ID of main, all <div> element
descendants, and then all <p> element descendants. All of this is a proper CSS 1 selector.
locates all child <p> elements. This is a valid CSS 2 selector.
a valid CSS 3 selector.
cssLibrary VS Jquery
cssLibrary : http://dean.edwards.name
// Find all <p> children of <div> elements
cssQuery("div > p");
// Find all <div>s, <p>s, and <form>s
cssQuery("div,p,form");
// Find all <p>s and <div>s then find all <a>s inside of them
var p = cssQuery("p,div");
cssQuery("a",p);
// Find all <div>s that have a class of 'links' and a <p> element inside of them
$("div.links[p]")
// Find all descendants of all <p>s and <div>s
$("p,div").find("*")
// Find every other link that points to Google
$("a[@href^='google.com']:even")
对于纯XML文件的导航来说,可以使用XPATH替代CSS选择器