Vue技术内幕 出去看看吧 榨干部分小细节

vue\src\platforms\web\entry-runtime-with-compiler.js

/**
 * Get outerHTML of elements, taking care
 * of SVG elements in IE as well.
 */
function getOuterHTML (el: Element): string {
  if (el.outerHTML) {
    return el.outerHTML
  } else {
    const container = document.createElement('div')
   //true 递归复制当前节点的所有子孙节点, false 复制当前节点 container.appendChild(el.cloneNode(
true))
  //innerHTML 返回元素内容
return container.innerHTML } }

 

posted @ 2018-10-12 18:14  翰弟  阅读(430)  评论(0编辑  收藏  举报