node_modules/hast-util-to-parse5/index.js
/* Patch a tree recursively, by adding namespaces
 * and parent references where needed. */
Patch a tree recursively, by adding namespaces
and parent references where needed.
Patch a tree recursively by adding namespaces and parent references where needed .
function patch(node, parent, ns) {
  var location = node.__location;
  var children = node.childNodes;
  var name = node.tagName;
  var replacement = {};
  var length;
  var index;
  var key;
  for (key in node) {
    if (customProps.indexOf(key) === -1) {
      replacement[key] = node[key];
    }
  }
  if (own.call(namespaces, name)) {
    ns = namespaces[name];
  }
  if (own.call(replacement, 'tagName')) {
    replacement.namespaceURI = ns;
  }
  if (children) {
    replacement.childNodes = children;
    length = children.length;
    index = -1;
    while (++index < length) {
      children[index] = patch(children[index], replacement, ns);
    }
  }
  if (name === 'template') {
    replacement.content = patch(node.content, null, ns);
  }
  if (parent) {
    replacement.parentNode = parent;
  }
  if (location) {
    replacement.__location = location;
  }
  return replacement;
}
function patch ( node , parent , ns ) { var location = node . __location ; var children = node . childNodes ; var name = node . tagName ; var replacement = { } ; var length ; var index ; var key ; for ( key in node ) { if ( customProps . indexOf ( key ) === - 1 ) { replacement [ key ] = node [ key ] ; } } if ( own . call ( namespaces , name ) ) { ns = namespaces [ name ] ; } if ( own . call ( replacement , 'tagName' ) ) { replacement . namespaceURI = ns ; } if ( children ) { replacement . childNodes = children ; length = children . length ; index = - 1 ; while ( ++ index < length ) { children [ index ] = patch ( children [ index ] , replacement , ns ) ; } } if ( name === 'template' ) { replacement . content = patch ( node . content , null , ns ) ; } if ( parent ) { replacement . parentNode = parent ; } if ( location ) { replacement . __location = location ; } return replacement ; }
Patch a tree recursively, by adding namespaces
 and parent references where needed.
Patch a tree recursively by adding namespaces and parent references where needed .