Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A lightweight DOM & Event manipulation.
CDN
Also supports ES6 Module, CommonJS, AMD and UMD style.
import {create, add} from 'realdom';
let div = create('DIV');
div.addClass('panel');
let span = add('SPAN', div);
span.html('Hello world');
// ...
Here are several examples:
import {
ready,
create,
add,
get,
query,
queryAll
} from 'realdom';
let rows = queryAll('table tr');
rows.forEach((row) => {
row.style.backgroundColor = 'red';
});
Returned elements have several helpful methods as below:
import { Event } from 'realdom';
Examples:
import {
ready,
add,
all,
Event
} from 'realdom';
ready(() => {
// Add a new element to document.body
let container = add('DIV');
// then add a DIV element into container
let div1 = add('DIV', container);
// then add a class "sub-item" to child DIV
div1.addClass('sub-item');
// more a child DIV
let div2 = add('DIV', container);
// also add a class "sub-item"
div2.addClass('sub-item');
// now, we can extract list of elements by class name:
let subItems = all('.sub-item');
console.log(subItems);
// create a button
let btn = add('INPUT');
// add some attributes
btn.setProperty({
type: 'button',
id: 'btnLogin',
value: 'Login'
});
// specify css style
btn.setStyle({
color: 'red',
fontSize: 15,
backgroundColor: '#ff6',
maxWidth: 500,
'padding-top': '2px'
});
// set an event listener
Event.on(btn, 'click', () => {
alert('Hello! How it\'s going?');
});
// simulate a click event on there (it works as same as jQuery.trigger method)
Event.simulate(btn, 'click');
});
git clone https://github.com/ndaidong/realdom.git
cd realdom
npm install
npm test
The MIT License (MIT)
FAQs
Unknown package
The npm package realdom receives a total of 3 weekly downloads. As such, realdom popularity was classified as not popular.
We found that realdom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.