Text and HTML bindings
ef-text="expression" (or data-ef-text)
Sets the element’s textContent from the expression (HTML is escaped). Updates automatically when scope changes.
ef-html="expression" (or data-ef-html)
Sets the element’s innerHTML from the expression. Use only with trusted content — no automatic escaping. Risk of XSS if the value comes from user input.
data-ef-text or [[ ... ]] when the value is not fully trusted.
One-way attribute bindings: ef-href, ef-title, ef-alt, ef-placeholder
Use these when you want scope-driven attributes without writing full [[ ... ]] strings in markup.
ef-href/data-ef-hrefef-title/data-ef-titleef-alt/data-ef-altef-placeholder/data-ef-placeholder
Two-way form binding: ef-value / data-ef-value / data-template-value
ef-value="path" (or data-ef-value / data-template-value) on input, select, or textarea binds the control to a dot path in scope (e.g. checkout.customer.email, billing.name).
- Scope → element: Engine sets value/checked from scope automatically on updates.
- Element → scope: On
inputorchange, the engine writes the control’s value back to the path (creating nested objects as needed), then updates dependent UI.
Supported controls
| Control | Path type | Behavior |
|---|---|---|
input text, email, tel, etc. | String | value ↔ scope path |
input type="checkbox" | Boolean | checked ↔ scope path |
input type="radio" | Selected value (string) | One ef-value/data-ef-value/data-template-value on a radio (or each); path holds selected value; same name = one group. |
textarea | String | value ↔ scope path |
select | String (single) or array (multiple) | Single: path is string; multiple: path is array of selected option values |
Example: checkout fields
checkout.shipping_same_as_billing updates and dependent blocks (like <template-if data-condition="!checkout.shipping_same_as_billing">) react automatically.
data-set-onload
When present, if the scope path is undefined on the first run, the element’s current value/checked is written to scope. Useful so HTML defaults (e.g. checked on a checkbox) drive template logic on load.
One-way bindings: :checked, :disabled, :value
Vue-style one-way bindings: the expression is evaluated and the DOM property is set on each update. The attribute is removed after first apply and the expression is stored in memory so the DOM stays clean.
:checked="expression"— Setselement.checked(e.g.:checked="bumpSelected").:disabled="expression"— Setselement.disabled.:value="expression"— Setselement.value.
ef-value (or aliases) for two-way binding.
Event handlers: @click and others
@click="expression" runs the expression when the element (or a child) is clicked. The expression is evaluated in a context that includes $event / event (the DOM event) and $el / $target (element). Assignments in the expression (e.g. items = [], item.open = !item.open) mutate scope and the UI re-renders automatically.
Aliases
@click— Short form.data-ef-on:click,data-ef-on-click,data-ef-click— Attribute forms.
@submit, @change, @input, @blur, @focus, etc. The engine discovers used event names from the DOM and binds them once.
Examples
false from the expression calls preventDefault() on the event.
Cart and bumps
For cart quantity and remove, prefer the cart plugin’s data attributes so behavior is consistent without custom script:- Decrease qty:
data-cart-qty-minusanddata-code="[[ item.code ]]"(so the plugin gets the actual code); optionaldata-disable-when-oneto disable whenitem.quantity <= 1. - Increase qty:
data-cart-qty-plusanddata-code="[[ item.code ]]". - Remove:
data-cart-qty-removeanddata-code="[[ item.code ]]".
window.ef.addToCart(code, options?, quantity?), ef.setCartQuantity(code, quantity), ef.removeFromCart(code, allowClear?) if the app exposes window.ef.
Reactivity summary
[[ expression ]]— Re-evaluated automatically after relevant scope changes.- Mounted
template-ifandtemplate-foreach— Re-render automatically when dependencies change. ef-value/ aliases — Scope → element on updates; element → scope on input / change.ef-text/ef-html/ef-src/ef-href/ef-title/ef-alt/ef-placeholder/:checked/:disabled/:value— Applied on reactive updates.