
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
html-tag-js
Advanced tools
A simple library for creating and manipulating DOM using JavaScript DOM API.
A simple library for creating and manipulating DOM using JavaScript DOM api with out of the box support for JSX like syntax.
npm i html-tag-js
or directly import into browser
path/to/html-tag-js/dist/tag.js
To enable JSX like syntax, use html-tag-js/tag-loader as loader in webpack.
module.exports = {
module: {
...
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: ['html-tag-js/jsx/tag-loader.js'],
},
...
],
},
};
And in add following lines in babel configuration file.
{
...
"plugins": [
"html-tag-js/jsx/jsx-to-tag.js",
"html-tag-js/jsx/syntax-parser.js",
...
],
...
}
To create elements, use tag function. It accepts tag name, options and children as arguments. Checkout tag for more details.
import 'html-tag-js/dist/polyfill'; // optional
// no need to import tag from 'html-tag-js'
// if you are using tag-loader
import tag from 'html-tag-js';
Reactive to create reactive nodeTo create a reactive node, use Reactive constructor. It accepts initial value and returns an object with value property to get/set the value and onChange callback to listen for value changes. Checkout Reactive for more details.
import Reactive from 'html-tag-js/Reactive';
const count = Reactive(0);
document.body.append(
<div>
<h1>{count}</h1>
<button onclick={() => count.value++}>Increment</button>
</div>
);
Ref to get reference of the nodeTo get reference of the node, use Ref constructor. It accepts a callback function which will be called with the node as argument. Checkout Ref for more details.
import Ref from 'html-tag-js/Ref';
const ref = Ref(node => {
console.log(node); // <h1>Hello</h1>
});
// Change style of the node before or after referencing
ref.style.color = 'red';
document.body.append(
<div>
<h1 ref={ref}>Hello</h1>
</div>
);
FAQs
A simple library for creating and manipulating DOM using JavaScript DOM API.
The npm package html-tag-js receives a total of 147 weekly downloads. As such, html-tag-js popularity was classified as not popular.
We found that html-tag-js 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.