| Server IP : 139.59.63.204 / Your IP : 216.73.217.62 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/customerportal/node_modules/alpinejs/src/ |
Upload File : |
import { effect, release, overrideEffect } from "./reactivity"
import { initTree, isRoot } from "./lifecycle"
import { walk } from "./utils/walk"
export let isCloning = false
export function skipDuringClone(callback, fallback = () => {}) {
return (...args) => isCloning ? fallback(...args) : callback(...args)
}
export function onlyDuringClone(callback) {
return (...args) => isCloning && callback(...args)
}
let interceptors = []
export function interceptClone(callback) {
interceptors.push(callback)
}
export function cloneNode(from, to)
{
interceptors.forEach(i => i(from, to))
isCloning = true
// We don't need reactive effects in the new tree.
// Cloning is just used to seed new server HTML with
// Alpine before "morphing" it onto live Alpine...
dontRegisterReactiveSideEffects(() => {
initTree(to, (el, callback) => {
// We're hijacking the "walker" so that we
// only initialize the element we're cloning...
callback(el, () => {})
})
})
isCloning = false
}
export let isCloningLegacy = false
/** deprecated */
export function clone(oldEl, newEl) {
if (! newEl._x_dataStack) newEl._x_dataStack = oldEl._x_dataStack
isCloning = true
isCloningLegacy = true
dontRegisterReactiveSideEffects(() => {
cloneTree(newEl)
})
isCloning = false
isCloningLegacy = false
}
/** deprecated */
export function cloneTree(el) {
let hasRunThroughFirstEl = false
let shallowWalker = (el, callback) => {
walk(el, (el, skip) => {
if (hasRunThroughFirstEl && isRoot(el)) return skip()
hasRunThroughFirstEl = true
callback(el, skip)
})
}
initTree(el, shallowWalker)
}
function dontRegisterReactiveSideEffects(callback) {
let cache = effect
overrideEffect((callback, el) => {
let storedEffect = cache(callback)
release(storedEffect)
return () => {}
})
callback()
overrideEffect(cache)
}