Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
if (str === '') {
return
}
const rules = str.split(';')
for (let i = 0; i < rules.length; i++) {
const rule = rules[i].trim()
if (rule === '') {
continue
}
const [propName, val] = rule.split(':')
if (isUndefined(val)) {
continue
}
this.setProperty(propName.trim(), val.trim())
}
}
export function createEvent (event: MpEvent, element: TaroElement) {
const domEv = new TaroEvent(event.type, { bubbles: true, cancelable: true })
for (const key in event) {
if (key === 'currentTarget' || key === 'target') {
domEv[key] = {
...event[key],
...event.detail
}
} else {
domEv[key] = event[key]
}
}
if (isUndefined(domEv.currentTarget)) {
domEv.currentTarget = domEv.target
}
if (element.dataset !== EMPTY_OBJ) {
domEv.currentTarget.dataset = { ...element.dataset }
}
return domEv
}
public hasAttribute (qualifiedName: string) {
return !isUndefined(this.props[qualifiedName])
}
public setProperty (propertyName: string, value?: string | null) {
propertyName = toCamelCase(propertyName)
if (isUndefined(value)) {
return
}
if (value === null || value === '') {
this.removeProperty(propertyName)
} else {
this[propertyName] = value
}
}