How to use the posthtml/lib/api.walk.call function in posthtml

To help you get started, we’ve selected a few posthtml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JetBrains / svg-mixer / packages / postsvg / lib / tree.js View on Github external
walk(callback) {
    return walk.call(this, callback);
  }
github kevinkace / posthtml-pseudo / lib / classNameFunctions / default.js View on Github external
module.exports = function(node) {
    let test = false;

    if(!node.tag || node.tag !== "form" || !node.content.length) {
        return node;
    }

    walk.call(node, (subNode) => {
        if(test || !subNode.tag || eligibleTags.indexOf(subNode.tag) === -1 ||
            (subNode.tag === "input" && get(subNode, [ "attrs", "type"]) !== "submit")) {
            return subNode;
        }

        test = true;
        addClassNameToNode(subNode, className);

        return subNode;
    });

    return node;
};