目录

isChildOf()

功能

检查dom节点是否为另一个dom节点的后代。

语法

noder.isChildOf(node, parent)

参数

范例

Example: 判断h4元素是否是div的子孙节点。

<!DOCTYPE html>
<html>

<head>
    <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>
    <div>
        <h4>h4</h4>
        <span></span>
    </div>
    <script>
    require(["skylark/datax", "skylark/finder", "skylark/noder"], function(datax, finder, noder) {
        var childOf = noder.isChildOf(finder.find("h4"), finder.find("div"));
        datax.text(finder.find("span"), childOf);
    });
    </script>
</body>

</html>