lib/doc.js
function ensureDoc($node) {
  // FIXME if isVNode(node) use cx on node
  var cx = (0, _vnode.getContext)(this, inode);
  return (0, _just.default)($node).pipe((0, _operators.concatMap)(function (node) {
    if (!(0, _vnode.isVNode)(node)) {
      var type = cx.getType(node);

      if (type == 9 || type == 11) {
        var root = cx.first(node);
        return (0, _just.default)(cx.vnode(root, cx.vnode(node), 1, 0));
      } else {
        // create a document-fragment by default!
        var doc = t.bind(cx)();

        var _root = cx.vnode(node, doc, 1, 0);

        return (0, _just.default)(doc).pipe((0, _operators.concatMap)(function (doc) {
          doc = doc.push([0, _root.node]);
          var next = doc.first();
          return next ? (0, _just.default)(doc.vnode(next, doc, doc.depth + 1, 0)) : (0, _just.default)();
        }));
      }
    }

    if (typeof node.node === "function") {
      // NOTE never bind to current node.cx, but purposely allow cross-binding
      return (0, _just.default)(t.bind(cx)(node)).pipe((0, _operators.concatMap)(function (node) {
        var next = node.first();
        return next ? (0, _just.default)(node.vnode(next, node, node.depth + 1, 0)) : (0, _just.default)();
      }));
    }

    return (0, _just.default)(node);
  }));
}
function ensureDoc($node) {
  // FIXME if isVNode(node) use cx on node
  var cx = (0, _vnode.getContext)(this, inode);
  return (0, _just.default)($node).pipe((0, _operators.concatMap)(function (node) {
    if (!(0, _vnode.isVNode)(node)) {
      var type = cx.getType(node);

      if (type == 9 || type == 11) {
        var root = cx.first(node);
        return (0, _just.default)(cx.vnode(root, cx.vnode(node), 1, 0));
      } else {
        // create a document-fragment by default!
        var doc = t.bind(cx)();

        var _root = cx.vnode(node, doc, 1, 0);

        return (0, _just.default)(doc).pipe((0, _operators.concatMap)(function (doc) {
          doc = doc.push([0, _root.node]);
          var next = doc.first();
          return next ? (0, _just.default)(doc.vnode(next, doc, doc.depth + 1, 0)) : (0, _just.default)();
        }));
      }
    }

    if (typeof node.node === "function") {
      // NOTE never bind to current node.cx, but purposely allow cross-binding
      return (0, _just.default)(t.bind(cx)(node)).pipe((0, _operators.concatMap)(function (node) {
        var next = node.first();
        return next ? (0, _just.default)(node.vnode(next, node, node.depth + 1, 0)) : (0, _just.default)();
      }));
    }

    return (0, _just.default)(node);
  }));
}
function ensureDoc ( $node ) { // FIXME if isVNode(node) use cx on node var cx = ( 0 , _vnode . getContext ) ( this , inode ) ; return ( 0 , _just . default ) ( $node ) . pipe ( ( 0 , _operators . concatMap ) ( function ( node ) { if ( ! ( 0 , _vnode . isVNode ) ( node ) ) { var type = cx . getType ( node ) ; if ( type == 9 || type == 11 ) { var root = cx . first ( node ) ; return ( 0 , _just . default ) ( cx . vnode ( root , cx . vnode ( node ) , 1 , 0 ) ) ; } else { // create a document-fragment by default! var doc = t . bind ( cx ) ( ) ; var _root = cx . vnode ( node , doc , 1 , 0 ) ; return ( 0 , _just . default ) ( doc ) . pipe ( ( 0 , _operators . concatMap ) ( function ( doc ) { doc = doc . push ( [ 0 , _root . node ] ) ; var next = doc . first ( ) ; return next ? ( 0 , _just . default ) ( doc . vnode ( next , doc , doc . depth + 1 , 0 ) ) : ( 0 , _just . default ) ( ) ; } ) ) ; } } if ( typeof node . node === "function" ) { // NOTE never bind to current node.cx, but purposely allow cross-binding return ( 0 , _just . default ) ( t . bind ( cx ) ( node ) ) . pipe ( ( 0 , _operators . concatMap ) ( function ( node ) { var next = node . first ( ) ; return next ? ( 0 , _just . default ) ( node . vnode ( next , node , node . depth + 1 , 0 ) ) : ( 0 , _just . default ) ( ) ; } ) ) ; } return ( 0 , _just . default ) ( node ) ; } ) ) ; }
Document-related functions
@module doc
 
Wraps a document into a document-fragment if it doesn't have a document root
@param  {any} $node  Observable, VNode or any kind of node mathing the provided document implementation context
@return {Observable} Observable yielding a single VNode
Document - related functions