https://github.com/serapath/replace-dom
replace a node in the DOM with a given node
https://github.com/serapath/replace-dom
Last synced: about 1 year ago
JSON representation
replace a node in the DOM with a given node
- Host: GitHub
- URL: https://github.com/serapath/replace-dom
- Owner: serapath
- License: mit
- Created: 2016-11-21T00:02:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-21T00:14:13.000Z (over 9 years ago)
- Last Synced: 2025-03-20T05:47:03.517Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/replace-dom
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# replace-dom
replace a node in the DOM with a given node
# usage
`npm install replace-dom`
```js
// prepare example
var foo = document.createElement('h1')
foo.innerHTML = 'hello foo'
var bar = document.createElement('h1')
bar.innerHTML = 'hello bar'
var element = foo
document.body.appendChild(element)
// use
var replace = require('replace-dom')
console.log(element === foo)
element = replace(element, bar)
console.log(element === bar)
```