diff options
Diffstat (limited to 'alpinejs/packages/alpinejs/src/utils/bind.js')
-rw-r--r-- | alpinejs/packages/alpinejs/src/utils/bind.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/alpinejs/packages/alpinejs/src/utils/bind.js b/alpinejs/packages/alpinejs/src/utils/bind.js index fc89b20..2c3b2a9 100644 --- a/alpinejs/packages/alpinejs/src/utils/bind.js +++ b/alpinejs/packages/alpinejs/src/utils/bind.js @@ -7,7 +7,7 @@ export default function bind(el, name, value, modifiers = []) { if (! el._x_bindings) el._x_bindings = reactive({}) el._x_bindings[name] = value - + name = modifiers.includes('camel') ? camelCase(name) : name switch (name) { @@ -129,21 +129,21 @@ function attributeShouldntBePreservedIfFalsy(name) { } export function getBinding(el, name, fallback) { - // First let's get it out of Alpine bound data. + // First let's get it out of Alpine bound data. if (el._x_bindings && el._x_bindings[name] !== undefined) return el._x_bindings[name] - // If not, we'll return the literal attribute. + // If not, we'll return the literal attribute. let attr = el.getAttribute(name) // Nothing bound: if (attr === null) return typeof fallback === 'function' ? fallback() : fallback - + if (isBooleanAttr(name)) { return !! [name, 'true'].includes(attr) } - // The case of a custom attribute with no value. Ex: <div manual> + // The case of a custom attribute with no value. Ex: <div manual> if (attr === '') return true - + return attr } |