Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
void-elements
Advanced tools
The void-elements npm package provides a list of HTML void elements. Void elements are HTML elements that do not have closing tags, such as <img>, <br>, and <input>. This package is useful for developers who need to handle or validate HTML content programmatically.
List of Void Elements
This feature provides a list of all HTML void elements. The code sample demonstrates how to import the package and log the list of void elements to the console.
const voidElements = require('void-elements');
console.log(voidElements);
Check if an Element is Void
This feature allows you to check if a given HTML tag is a void element. The code sample shows how to create a function that checks if a tag name is in the list of void elements and demonstrates its usage with 'img' and 'div' tags.
const voidElements = require('void-elements');
const isVoidElement = (tagName) => voidElements.includes(tagName);
console.log(isVoidElement('img')); // true
console.log(isVoidElement('div')); // false
The html-tags package provides a list of all standard HTML tags, including both void and non-void elements. It is more comprehensive than void-elements as it covers all HTML tags, not just void elements.
The self-closing-tags package offers a list of self-closing HTML tags, which is similar to void elements. However, it focuses on tags that can self-close in XML and XHTML contexts, which may include more than just the standard HTML void elements.
Exports an Object
of "void element" node names as defined by the HTML spec.
The list is programatically generated from the latest W3C HTML draft.
var voidElements = require('void-elements');
assert(!voidElements['span'], '<span> is not a void element');
assert(voidElements['img'], '<img> is a void element');
MIT
FAQs
Array of "void elements" defined by the HTML specification.
The npm package void-elements receives a total of 4,723,634 weekly downloads. As such, void-elements popularity was classified as popular.
We found that void-elements demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.