diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-07-21 10:57:00 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-07-21 11:08:24 +0300 |
commit | 9446184f84a8a678b6712bd3f49bdb282d1e14e7 (patch) | |
tree | 897cdf9da6b322d70dfe6774f52047e1b631e1bc /alpinejs/packages/alpinejs/src/utils/bind.js | |
parent | 99f542f0c2fb665466c4e1ec3d11713d086d31cf (diff) |
Update to Alpine 3.10.3HEADalpinejs/v3.21000.20300main
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 } |