Current Folder

This commit is contained in:
Luis Fernando Molina committed 2020-11-20 14:05:59 +01:00
1 parent 8b3382289b
commit cfcada880d
4379 files changed

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
var walk = require("../index")
walk(document, function (node) {
console.log("node", node)
})
+24
View File
@@ -0,0 +1,24 @@
var slice = Array.prototype.slice
module.exports = iterativelyWalk
function iterativelyWalk(nodes, cb) {
if (!('length' in nodes)) {
nodes = [nodes]
}
nodes = slice.call(nodes)
while(nodes.length) {
var node = nodes.shift(),
ret = cb(node)
if (ret) {
return ret
}
if (node.childNodes && node.childNodes.length) {
nodes = slice.call(node.childNodes).concat(nodes)
}
}
}
+36
View File
@@ -0,0 +1,36 @@
{
"name": "dom-walk",
"version": "0.1.2",
"description": "iteratively walk a DOM node",
"keywords": [],
"author": "Raynos <raynos2@gmail.com>",
"repository": "git://github.com/Raynos/dom-walk.git",
"main": "index",
"homepage": "https://github.com/Raynos/dom-walk",
"contributors": [
{
"name": "Jake Verbaten"
}
],
"bugs": {
"url": "https://github.com/Raynos/dom-walk/issues",
"email": "raynos2@gmail.com"
},
"dependencies": {},
"devDependencies": {
"budo": "11.6.3"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/Raynos/dom-walk/raw/master/LICENSE"
}
],
"scripts": {
"example": "budo example/index.js"
}
,"_resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz"
,"_integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w=="
,"_from": "dom-walk@^0.1.0"
}