dist/wx/common/vendor.js
// Note: this is a browser-only function so we can assume elms are DOM nodes.
this is a browser-only function so we can assume elms are DOM nodes.
this is a browser - only function so we can assume elms are DOM nodes .
function hydrate (elm, vnode, insertedVnodeQueue) {
    if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
      vnode.elm = elm;
      vnode.isAsyncPlaceholder = true;
      return true
    }
    vnode.elm = elm;
    var tag = vnode.tag;
    var data = vnode.data;
    var children = vnode.children;
    if (isDef(data)) {
      if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true ); }
      if (isDef(i = vnode.componentInstance)) {
        initComponent(vnode, insertedVnodeQueue);
        return true
      }
    }
    if (isDef(tag)) {
      if (isDef(children)) {
        if (!elm.hasChildNodes()) {
          createChildren(vnode, children, insertedVnodeQueue);
        } else {
          var childrenMatch = true;
          var childNode = elm.firstChild;
          for (var i$1 = 0; i$1 < children.length; i$1++) {
            if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
              childrenMatch = false;
              break
            }
            childNode = childNode.nextSibling;
          }
          if (!childrenMatch || childNode) {
            if (false
            ) {
              bailed = true;
              console.warn('Parent: ', elm);
              console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
            }
            return false
          }
        }
      }
      if (isDef(data)) {
        for (var key in data) {
          if (!isRenderedModule(key)) {
            invokeCreateHooks(vnode, insertedVnodeQueue);
            break
          }
        }
      }
    } else if (elm.data !== vnode.text) {
      elm.data = vnode.text;
    }
    return true
  }
function hydrate ( elm , vnode , insertedVnodeQueue ) { if ( isTrue ( vnode . isComment ) && isDef ( vnode . asyncFactory ) ) { vnode . elm = elm ; vnode . isAsyncPlaceholder = true ; return true } vnode . elm = elm ; var tag = vnode . tag ; var data = vnode . data ; var children = vnode . children ; if ( isDef ( data ) ) { if ( isDef ( i = data . hook ) && isDef ( i = i . init ) ) { i ( vnode , true ) ; } if ( isDef ( i = vnode . componentInstance ) ) { initComponent ( vnode , insertedVnodeQueue ) ; return true } } if ( isDef ( tag ) ) { if ( isDef ( children ) ) { if ( ! elm . hasChildNodes ( ) ) { createChildren ( vnode , children , insertedVnodeQueue ) ; } else { var childrenMatch = true ; var childNode = elm . firstChild ; for ( var i$1 = 0 ; i$1 < children . length ; i$1 ++ ) { if ( ! childNode || ! hydrate ( childNode , children [ i$1 ] , insertedVnodeQueue ) ) { childrenMatch = false ; break } childNode = childNode . nextSibling ; } if ( ! childrenMatch || childNode ) { if ( false ) { bailed = true ; console . warn ( 'Parent: ' , elm ) ; console . warn ( 'Mismatching childNodes vs. VNodes: ' , elm . childNodes , children ) ; } return false } } } if ( isDef ( data ) ) { for ( var key in data ) { if ( ! isRenderedModule ( key ) ) { invokeCreateHooks ( vnode , insertedVnodeQueue ) ; break } } } } else if ( elm . data !== vnode . text ) { elm . data = vnode . text ; } return true }
Note: this is a browser-only function so we can assume elms are DOM nodes.
Note : this is a browser - only function so we can assume elms are DOM nodes .
/* hydrating */ // child component. it should have hydrated its own tree. // empty element, allow client to pick up and populate children // if childNode is not null, it means the actual childNodes list is // longer than the virtual children list.