Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function setProperty (dom: TaroElement, name: string, value: unknown, oldValue?: unknown) {
name = name === 'className' ? 'class' : name
if (
name === 'key' ||
name === 'children' ||
name === 'ref'
) {
// skip
} else if (name === 'style') {
const style = dom.style
if (isString(value)) {
style.cssText = value
} else {
if (isString(oldValue)) {
style.cssText = ''
oldValue = null
}
if (isObject(oldValue)) {
for (const i in oldValue) {
if (!(value && i in (value as StyleValue))) {
setStyle(style, i, '')
}
}
}
if (isObject(value)) {
for (const i in value) {
if (!oldValue || value[i] !== (oldValue as StyleValue)[i]) {
setStyle(style, i, value[i])
function setProperty (dom: TaroElement, name: string, value: unknown, oldValue?: unknown) {
name = name === 'className' ? 'class' : name
if (
name === 'key' ||
name === 'children' ||
name === 'ref'
) {
// skip
} else if (name === 'style') {
const style = dom.style
if (isString(value)) {
style.cssText = value
} else {
if (isString(oldValue)) {
style.cssText = ''
oldValue = null
}
if (isObject(oldValue)) {
for (const i in oldValue) {
if (!(value && i in (value as StyleValue))) {
setStyle(style, i, '')
}
}
}
if (isObject(value)) {