目录

find()

功能

通过一个选择器、对象或元素过滤,得到当前匹配的元素集合中每个元素的后代。

语法

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>