Răsfoiți Sursa

fix: work around old Chrome bug

fix #6601
Evan You 8 ani în urmă
părinte
comite
0f2cb09444
1 a modificat fișierele cu 5 adăugiri și 0 ștergeri
  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') {