Skip to content

Repository files navigation

fd-replace

Build Statusnpm version

replace DOM element in a functional way.

Installation

npm install fd-replace --save

Usage

importelemfrom'fd-elem';importappendfrom'fd-append';importreplacefrom'replace';letappendtoBody=append(document.body),h1=elem('h1','meow'),h2=elem('h2','bow');appendtoBody(h1);replace(document.body,h2,h1);assert.equal(document.body.lastChild.textContent,'bow');// True.

API

append :: parent -> oldNode -> newNode

A curried function that takes in:

  • parent -> Parent element in which the DOM must be replaced.

  • oldNode -> DOM element that is to be replaced.

  • newNode -> New DOM element.

About

replace DOM element in a functional way.

Resources

Contributing

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages