
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
flyweight-dom
Advanced tools
npm install --save-prod flyweight-dom
The extremely fast DOM implementation.
🔎 API documentation is available here.
The implementation provides classes for all DOM nodes:
import { Element } from 'flyweight-dom';
const element = new Element('div').append(
'Hello, ',
new Element('strong').append('world!')
);
element.classList.add('red');
element.getAttribute('class');
// ⮕ 'red'
Use DSL to streamlines DOM authoring:
import dsl from 'flyweight-dom/dsl';
const element = dsl.div({ class: 'red' }, 'Hello, ', dsl.strong('world!'));
element.textContent;
// ⮕ 'Hello, world!'
Create custom nodes:
import { Node } from 'flyweight-dom';
class MyNode extends Node {
readonly nodeName = '#my-node';
readonly nodeType = 100;
}
const myNode = new MyNode();
const element = new Element('div');
element.appendChild(myNode);
element.firstChild;
// ⮕ myNode
Custom nodes can extend
ChildNode
and
ParenNode
:
import { Node, ChildNode, ParentNode } from 'flyweight-dom';
interface MyNode extends ChildNode, ParentNode {}
class MyNode extends Node {
readonly nodeName = '#my-node';
readonly nodeType = 100;
}
ChildNode.extend(MyNode);
ParentNode.extend(MyNode);
For better performance, prefer nextSibling
and previousSibling
over childNodes
and children
whenever possible.
for (let child = node.firstChild; child !== null; child = child.nextSibling) {
// Process the child
}
When you read the childNodes
or children
properties for the first time an array of nodes is created and then stored
on the node instance. Later when you modify child nodes using appendChild
, removeChild
or any other method, these
arrays are updated which may introduce a performance impact.
FAQs
The extremely fast DOM implementation.
The npm package flyweight-dom receives a total of 3 weekly downloads. As such, flyweight-dom popularity was classified as not popular.
We found that flyweight-dom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.