@@ -1,6 +1,9 @@
|
||||
// __UNSAFE__
|
||||
// Reason: potentially setting innerHTML.
|
||||
// This can come from explicit usage of v-html or innerHTML as a prop in render
|
||||
|
||||
import { warn } from '@vue/runtime-core'
|
||||
|
||||
// functions. The user is reponsible for using them with only trusted content.
|
||||
export function patchDOMProp(
|
||||
el: any,
|
||||
@@ -35,6 +38,17 @@ export function patchDOMProp(
|
||||
// e.g. <div :id="null">
|
||||
el[key] = ''
|
||||
} else {
|
||||
el[key] = value
|
||||
// some properties perform value validation and throw
|
||||
try {
|
||||
el[key] = value
|
||||
} catch (e) {
|
||||
if (__DEV__) {
|
||||
warn(
|
||||
`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
|
||||
`value ${value} is invalid.`,
|
||||
e
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user