瀏覽代碼

fix: work around old Chrome bug

fix #6601
Evan You 8 年之前
父節點
當前提交
0f2cb09444
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/platforms/web/runtime/modules/dom-props.js

+ 5 - 0
src/platforms/web/runtime/modules/dom-props.js

@@ -28,6 +28,11 @@ function updateDOMProps (oldVnode: VNodeWithData, vnode: VNodeWithData) {
     if (key === 'textContent' || key === 'innerHTML') {
       if (vnode.children) vnode.children.length = 0
       if (cur === oldProps[key]) continue
+      // #6601 work around Chrome version <= 55 bug where single textNode
+      // replaced by innerHTML/textContent retains its parentNode property
+      if (elm.childNodes.length === 1) {
+        elm.removeChild(elm.childNodes[0])
+      }
     }
 
     if (key === 'value') {