stream.replace = function (s, fn) { return stream.select(s, function (node) { if (typeof fn === 'function') { node.replace(function (html) { return fn(html, node); }); } else node.replace(fn); }); };
stream.remove = function (s, fn) { return stream.select(s, function (node) { node.remove(); if (typeof fn === 'function') fn(node); }); };