Templates, Attributes & Repeated Blocks
SynergyJS uses standard HTML5 <template> elements as its sole templating syntax. Because templates are inert DOM fragments parsed natively by the browser, there is no proprietary compiler or build-time AST transform.
Text & Attribute Interpolation
Wrap any property or getter name in double curly braces {{ expression }} inside text nodes or HTML attributes. Boolean attributes such as disabled, hidden, and checked are automatically added or removed based on truthiness.
<template id="status-banner">
<div class="banner {{ severity }}" hidden="{{ !visible }}">
<strong>{{ headline }}</strong>
<span>{{ summary }}</span>
</div>
</template>
Repeated Blocks with each
Render arrays by nesting a <template each="item in items"> block. SynergyJS keys each cloned fragment against the array item so incremental pushes, splices, or replacements only touch affected DOM nodes.
<template id="release-notes">
<ul>
<template each="release in releases">
<li>
<strong>{{ release.version }}</strong> — {{ release.notes }}
</li>
</template>
</ul>
</template>
Conditional Blocks with if
Use <template if="condition"> when sections should be mounted or unmounted from the DOM rather than merely hidden with CSS. This keeps heavy subtrees out of memory until needed.
Continue to SSR Prerendering & Search Hydration or Forms & Event Bindings.