@hexlet/html-tags

1.0.2 • Public • Published

js-html-tags

github action status

Install

npm install @hexlet/html-tags

Usage example

import {
  node, addChild, make, append, toString, hasChildren,
} from '@hexlet/html-tags';

const p = node('p', 'paragraph');
const ul = node('ul');
const ul2 = addChild(ul, node('li', 'body'));
const ul3 = addChild(ul2, node('li', 'another body'));
const dom1 = make();
const dom2 = append(dom1, p);
const dom3 = append(dom2, ul3);

toString(dom3);
// '<p>paragraph</p><ul><li>body</li><li>another body</li></ul>';

getName(p); // 'p'
getValue(p); // 'paragraph'
hasChildren(p); // false

For more information, see the Full Documentation

Hexlet Ltd. logo

This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet (in Russian).

/@hexlet/html-tags/

    Package Sidebar

    Install

    npm i @hexlet/html-tags

    Weekly Downloads

    2

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    12.6 kB

    Total Files

    10

    Last publish

    Collaborators

    • dzencot
    • grozwalker
    • mshkv
    • mokevnin
    • corsicanec82