Miss any of our Open RFC calls?Watch the recordings here! »

dom-wrap-all

0.0.4 • Public • Published

Build Status

dom-wrap-all

Wrap multiple DOM nodes with a wrapper element.

Installation

npm i dom-wrap-all

Usage

Given the following markup:

<p>1</p>
<p id="message">Hello, world!</p>
<p>2</p>
<p>3</p>
<li>Apples</li><li>Bananas</li>
<p>4</p>
<li>Cherries</li>
<p>5</p>
<li>Dates</li>
<p>6</p>
import wrapAll from 'dom-wrap-all'

var fruits = document.getElementsByTagName('li');
var ol = document.createElement('ol');
wrapAll(fruits, ol);

outputs

<p>1</p>
<p id="message">Hello, world!</p>
<p>2</p>
<p>3</p>
<ol>
    <li>Apples</li>
    <li>Bananas</li>
    <li>Cherries</li>
    <li>Dates</li>
</ol>
<p>4</p>
<p>5</p>
<p>6</p>

Install

npm i dom-wrap-all

DownloadsWeekly Downloads

7

Version

0.0.4

License

ISC

Unpacked Size

3.13 kB

Total Files

5

Last publish

Collaborators

  • avatar