File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 1- // __UNSAFE__
2- // Reason: potentially setting innerHTML.
3- // This can come from explicit usage of v-html or innerHTML as a prop in render
4-
51import { DeprecationTypes , compatUtils , warn } from '@vue/runtime-core'
62import { includeBooleanAttr } from '@vue/shared'
3+ import { unsafeToTrustedHTML } from '../nodeOps'
74
85// functions. The user is responsible for using them with only trusted content.
96export function patchDOMProp (
@@ -12,11 +9,15 @@ export function patchDOMProp(
129 value : any ,
1310 parentComponent : any ,
1411) : void {
12+ // __UNSAFE__
13+ // Reason: potentially setting innerHTML.
14+ // This can come from explicit usage of v-html or innerHTML as a prop in render
1515 if ( key === 'innerHTML' || key === 'textContent' ) {
1616 // null value case is handled in renderer patchElement before patching
1717 // children
18- if ( value == null ) return
19- el [ key ] = value
18+ if ( value != null ) {
19+ el [ key ] = key === 'innerHTML' ? unsafeToTrustedHTML ( value ) : value
20+ }
2021 return
2122 }
2223
Original file line number Diff line number Diff line change @@ -31,9 +31,8 @@ if (tt) {
3131// This function merely perform a type-level trusted type conversion
3232// for use in `innerHTML` assignment, etc.
3333// Be careful of whatever value passed to this function.
34- const unsafeToTrustedHTML : ( value : string ) => TrustedHTML | string = policy
35- ? val => policy . createHTML ( val )
36- : val => val
34+ export const unsafeToTrustedHTML : ( value : string ) => TrustedHTML | string =
35+ policy ? val => policy . createHTML ( val ) : val => val
3736
3837export const svgNS = 'http://www.w3.org/2000/svg'
3938export const mathmlNS = 'http://www.w3.org/1998/Math/MathML'
You can’t perform that action at this time.
0 commit comments