The `node-contains` package, currently at version 1.0.0 and last published in September 2014, was designed to provide a cross-browser polyfill for the `Node.prototype.contains()` DOM method. Its original purpose was to ensure consistent behavior across older web browsers that lacked native support for this functionality. However, this method has been natively supported by all major web browsers since July 2015. Consequently, this package is now largely obsolete and considered abandoned for modern web development. While it might still be encountered in projects targeting extremely legacy environments, for any contemporary application, including `node-contains` introduces unnecessary overhead and potential compatibility issues. It does not follow a regular release cadence and offers no unique differentiators over native browser implementations.
npm install node-containsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to include the `node-contains` polyfill and then use the `Node.prototype.contains()` method to check if a DOM node is a descendant of another.
Remove `node-contains` from your project's dependencies and codebase. Rely on the native browser implementation of `Node.prototype.contains()`.
Migrate away from this package. If you absolutely need `Node.prototype.contains` in an ancient browser environment not covered by native support, consider a more modern, maintained polyfill or implement a minimal custom solution after careful consideration of risks.
Audit your dependency tree for other polyfills or libraries that might target `Node.prototype.contains`. Prioritize native browser functionality, and if polyfills are strictly necessary, ensure they are well-maintained and don't create conflicts. Use conditional polyfilling techniques if possible.
This package is explicitly for client-side browser environments. Ensure it is only included in your client-side bundles and excluded from server-side Node.js code. Use appropriate build tool configurations (e.g., Webpack targets, browser field in package.json) to achieve this separation.
Verify that the `element` variable is indeed a DOM `Node` (e.g., obtained via `document.getElementById()`). If targeting extremely old browsers, ensure `import 'node-contains';` (or `require('node-contains');`) is executed at the very beginning of your application's entry point before any DOM manipulation code that relies on `contains`.Install the package using your package manager: `npm install node-contains` or `yarn add node-contains`. Then, double-check the import or require statement for any spelling errors and ensure it matches the package name exactly.
No dependency data recorded yet.