通过一个选择器、对象或元素过滤,得到当前匹配的元素集合中每个元素的后代。
finder.find(selector)
Example: 开始搜索段落后代的span元素。
<!DOCTYPE html> <html> <head> <style> body { font-size: 16px; font-weight: bolder; } p { margin: 5px 0; } </style> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [{ name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> <p><span>Hello</span>, how are you?</p> <p>Me? I'm <span>good</span>.</p> <script> require(["skylark/query", "skylark/styler", "skylark/finder"], function(query, styler, finder) { styler.css(finder.find("span"), "color", "blue"); }); </script> </body> </html>