pull-dom-mutants

1.0.1 • Public • Published

pull-dom-mutants

pull-stream source of mutations to a dom element using Mutation Observer. Emits Mutation Records

Example

var pullMutants = require('pull-dom-mutants')
var pull = require('pull-stream')
var test = require('tape')
 
test('emitter emits a value when child element appended', function (t) {
  var elem = document.createElement('main')
  var child = document.createElement('h1')
  pull(
    pullMutants(elem, {childList: true}),
    pull.take(1),
    pull.drain(function (mutation) {
      var addedChild = mutation.target.querySelector('h1')
      t.equal(addedChild, child)
      t.end()
      window.close()
    })
  )
 
  t.false(elem.querySelector('h1'))
  elem.appendChild(child)
})
 

API

  pullMutants(elem [, opts])

Where opts are the options to pass along to Mutation Observer, defaults to {childList: true}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i pull-dom-mutants

Weekly Downloads

1

Version

1.0.1

License

ISC

Last publish

Collaborators

  • pietgeursen