The `iselement` package provides a focused utility function to accurately determine if a given JavaScript object is a DOM `Element`. Unlike simpler checks that rely solely on `instanceof HTMLElement`, this library is designed to correctly identify a broader range of elements, including 'exotic' elements such as SVG polygons. This ensures more robust and cross-browser compatible DOM manipulation logic, particularly crucial when dealing with complex web applications or third-party content. The current stable version is 1.1.4. Given its specific utility, the release cadence is typically stable and infrequent, with updates primarily for bug fixes or minor enhancements rather than new feature introductions. Its key differentiator is its comprehensive approach to element identification beyond standard HTML elements, providing reliable checks across the entire DOM specification.
npm install iselementVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `isElement` to check various JavaScript values, including HTML and SVG elements, and non-element types, correctly distinguishing them from actual DOM elements.
If you need to check for any DOM node type, consider `input instanceof Node` or a custom check. If you specifically need an Element, `isElement` is the correct function to use.
Ensure `iselement` is only used in browser contexts or Node.js environments where a DOM is sufficiently emulated (e.g., for testing with JSDOM). For server-side logic, alternative methods for object type checking should be employed.
For ESM, change to `import isElement from 'iselement';`. For CommonJS, change to `const isElement = require('iselement');`.Ensure `iselement` is executed in a browser context or in a Node.js environment that has JSDOM or similar global DOM objects configured. It is not intended for pure server-side logic.
No dependency data recorded yet.