Welcome to mirror list, hosted at ThFree Co, Russian Federation.

x-html.js « directives « src « alpinejs « packages « alpinejs - github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d434ec25b986e100fa1420a604f5675a26bf081e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { directive } from '../directives'
import { initTree } from '../lifecycle'
import { mutateDom } from '../mutation'

directive('html', (el, { expression }, { effect, evaluateLater }) => {
    let evaluate = evaluateLater(expression)

    effect(() => {
        evaluate(value => {
            mutateDom(() => {
                el.innerHTML = value

                el._x_ignoreSelf = true
                initTree(el)
                delete el._x_ignoreSelf
            })
        })
    })
})