conveyal/modeify

View on GitHub
client/components/segmentio/reactive-child/0.0.1/index.js

Summary

Maintainability
A
0 mins
Test Coverage
module.exports = function(reactive) {
  reactive.bind('reactive', function(el, attr){
    this.change(function(){
      var view = this.reactive.view;
      view.children || (view.children = {});
      var parent = el.parentNode;
      var child = this.value(attr);
      if(!child) return;
      parent.replaceChild(child.el, el);
      view.children[attr] = child;
    });
  });
};