Skip to content

timoxley/wrap-text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wrap-text

Wrap text nodes.

Installation

$ component install timoxley/wrap-text

Example

  var wrapText = require('wrap-text')
  var wrapper = document.createElement('span')

  // Wrap text in each paragraph with the wrapper
  wrapText(document.querySelectorAll('p'), wrapper) 

Example Input:

<p>
  Lorem Ipsum, <strong>Dolar sit</strong> amet.
</p>

Example Output:

<p>
  <span>Lorem Ipsum, </span><strong><span>Dolar sit</span></strong><span> amet.</span>
</p>

License

MIT

About

Wrap and unwrap text nodes

Resources

Stars

Watchers

Forks

Packages

No packages published