File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/platforms/web/runtime/modules Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
/* @flow */
2
2
3
3
import { isDef , isUndef , extend , toNumber } from 'shared/util'
4
+ import { isSVG } from 'web/util/index'
5
+
6
+ let svgContainer
4
7
5
8
function updateDOMProps ( oldVnode : VNodeWithData , vnode : VNodeWithData ) {
6
9
if ( isUndef ( oldVnode . data . domProps ) && isUndef ( vnode . data . domProps ) ) {
@@ -55,6 +58,17 @@ function updateDOMProps (oldVnode: VNodeWithData, vnode: VNodeWithData) {
55
58
if ( shouldUpdateValue ( elm , strCur ) ) {
56
59
elm . value = strCur
57
60
}
61
+ } else if ( key === 'innerHTML' && isSVG ( elm . tagName ) && isUndef ( elm . innerHTML ) ) {
62
+ // IE doesn't support innerHTML for SVG elements
63
+ svgContainer = svgContainer || document . createElement ( 'div' )
64
+ svgContainer . innerHTML = `<svg>${ cur } </svg>`
65
+ const svg = svgContainer . firstChild
66
+ while ( elm . firstChild ) {
67
+ elm . removeChild ( elm . firstChild )
68
+ }
69
+ while ( svg . firstChild ) {
70
+ elm . appendChild ( svg . firstChild )
71
+ }
58
72
} else {
59
73
elm [ key ] = cur
60
74
}
You can’t perform that action at this time.
0 commit comments