{"library":"next-node","title":"Next Node Element Utility","description":"The `next-node` package provides a lightweight utility function, `nextNode`, designed to retrieve the subsequent DOM Node Element relative to a given starting node. It includes an optional parameter to restrict the search within a specified container element. This package is currently stable at version `1.0.3`. Given its focused and simple functionality, it likely follows a maintenance release cadence, with updates primarily for bug fixes or minor enhancements rather than frequent new features. Its key differentiator is its minimal API and focused scope, aiming to solve the specific problem of navigating sibling nodes efficiently, optionally within a parent boundary, without the overhead of larger DOM manipulation libraries. It's suitable for scenarios requiring precise and controlled DOM traversal, particularly when fine-grained control over DOM element discovery is needed beyond standard DOM traversal methods like `nextElementSibling` or `children`.","language":"javascript","status":"maintenance","last_verified":"Sun Apr 19","install":{"commands":["npm install next-node"],"cli":null},"imports":["const nextNode = require('next-node');","import nextNode from 'next-node';","// nextNode is available globally after <script src=\"...next-node.min.js\"></script>"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"document.body.innerHTML = `\n<div id=\"a1\">\n    <div id=\"b1\"></div>\n    <div id=\"b2\"></div>\n</div>\n<div id=\"c1\"></div>\n<div id=\"d1\"></div>\n`;\n\n// In a browser context, 'nextNode' might be globally available or require bundling.\n// For Node.js with JSDOM, you would typically `require` it.\nconst nextNode = require('next-node');\n\nconst a1 = document.getElementById('a1');\nconst b1 = document.getElementById('b1');\nconst b2 = document.getElementById('b2');\nconst c1 = document.getElementById('c1');\nconst d1 = document.getElementById('d1');\n\nconsole.log('nextNode(a1):', nextNode(a1).id); // Expected: 'b1'\nconsole.log('nextNode(b1):', nextNode(b1).id); // Expected: 'b2'\nconsole.log('nextNode(b2, a1):', nextNode(b2, a1)); // Expected: null (container specified, no next sibling in a1)\nconsole.log('nextNode(b2):', nextNode(b2).id); // Expected: 'c1' (container not specified, moves outside a1)\nconsole.log('nextNode(c1):', nextNode(c1).id); // Expected: 'd1'\nconsole.log('nextNode(d1):', nextNode(d1)); // Expected: null (no more elements)\n\ntry {\n  nextNode(null); // This will throw a TypeError\n} catch (e) {\n  console.error('nextNode(null) error:', e.message);\n}","lang":"javascript","description":"Demonstrates `nextNode` usage for traversing DOM elements, including examples with and without container restrictions, and illustrates potential errors with invalid inputs. The HTML structure is simulated for a runnable example.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}