Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function hydrate (node: TaroElement | TaroText): MiniData {
if (isText(node)) {
return {
[Shortcuts.Text]: node.nodeValue,
[Shortcuts.NodeName]: node.nodeName
}
}
const data: MiniData = {
...node.props,
[Shortcuts.Childnodes]: node.childNodes.map(hydrate),
[Shortcuts.NodeName]: node.nodeName,
uid: node.uid
}
if (node.className) {
data[Shortcuts.Class] = node.className
}
if (node.cssText) {
function buildPlainTextTemplate (level: number): string {
return `
<template name="tmpl_${level}_#text">
{{i.${Shortcuts.Text}}}
</template>
`
}
public set textContent (text: string) {
this._value = text
this.enqueueUpdate({
path: `${this._path}.${Shortcuts.Text}`,
value: text
})
}