- Fixed reading templates from
<script>
tags in IE8 (#1908) - Components with a
css
property can be created in node.js (#1927) - Leading/trailing newlines inside elements are removed (#1851)
- Two-way contenteditable binding works with the
lazy: true
option (#1933) - Better error for undefined/null templates (#1893)
- Internal tweaks (dependency updates, removal of .DS_Store files, fix tests in Firefox/Safari)
ractive.runtime.js
works again (sorry everyone!) (#1860)- Methods that clash with non-function config properties trigger a warning (#1857)
- Using
intro-outro
on a component triggers the same warning asintro
oroutro
by themselves (#1866) - Fix for bug caused by broken
Array.prototype.map
polyfill in old versions of Prototype.js (#1872) - Observers are cancelled when their instance is torn down (#1865)
- Prevent internal logging function from failing in certain edge cases (#1890)
- Fix version snafu
-
Breaking changes
ractive.data
is no longer exposed. Useractive.get()
andractive.set()
rather than accessingdata
directly- When instantiating or extending components,
data
properties on the instance/child component always override parent data
-
Deprecated features
ractive.debug
is replaced with a globalRactive.DEBUG
flag (see below)- Inline partial definition comments (
<!-- {{>myPartial}} -->...
) should be replaced with inline partial sections (see below) options.data
should, if supplied, be a plain old JavaScript object (non-POJOs) or a function that returns one. Non-POJOs and arrays should only exist as properties ofoptions.data
-
New properties
ractive.parent
- reference to parent componentractive.container
- reference to container component (e.g. in<x><y/></x>
,x === y.container
)ractive.root
- reference to a component's top level parent (i.e. created withnew Ractive()
)
-
New methods
ractive.findParent(name)
- finds the nearest parent component matchingname
ractive.findContainer(name)
- finds the nearest container component matchingname
ractive.resetPartial('name', template)
- updates all instances of{{>name}}
ractive.toHtml()
is an alias forractive.toHTML()
ractive.once()
andractive.observeOnce()
are self-cancelling versions ofractive.on()
andractive.observe()
Ractive.getNodeInfo(node)
returns information aboutnode
's owner and the context in which it lives
-
Other features
- Rearchitecture of inter-component mappings, resulting in much faster updates.
Ractive.DEBUG
flag controls whether warnings for non-fatal errors are printed to the consoleconsole
can be accessed inside template expressions (e.g.{{console.log(this)}}
), for debuggingelseif
in templates:{{#if something}}...{{elseif otherthing}}...{{/if}}
- Element-level
twoway
directive for granular control over two-way binding - Element-level
lazy
directive, e.g.lazy=true
orlazy=250
to prevent or throttle data updates from user input - Inline partial section definitions (
{{#partial myPartial}}...{{/partial}}
). As well as defining partials within a template, they are used with named yields inside components (see next). Partial definitions must exist at the top level of a template, or as an immediate child of an element/component ractive.set()
can be used to set multiple 'wildcard' keypaths simultaneouslyractive.toggle(wildcardKeypath)
toggles all keypaths matchingwildcardKeypath
individually. Dittoractive.add()
andractive.subtract()
- Better parse errors for malformed templates
- Sourcemaps
-
Bug fixes - too many to list...
- Breaking changes
- If
obj
has no keys, then theelse
half of{{#each obj}}...{{else}}...{{/each}}
will render
- If
- Other changes
this.event
available in method calls- Deprecation warnings are printed regardless of whether
debug
is true - HTML entity decoding is done at parse time, not render time
- Special
@keypath
reference resolves to the current context @index
,@key
and@keypath
references are resolved at render time, not parse time (fixes #1303)- Centralised reference resolution logic
console
is a supported global in expression - e.g.{{console.log('debugging',foo)}}
- Fixes for #1046, #1175, #1190, #1209, #1255, #1273, #1278, #1285, #1293, #1295, #1303, #1305, #1313, #1314, #1320, #1322, #1326, #1337, #1340, #1346, #1357, #1360, #1364, #1365, #1369, #1373, #1383, #1390, #1393, #1395, and #1399
- Breaking changes:
new Ractive()
now inherits all options as methods/properties including event hooks.- The deprecated
init()
function (see below) is mapped toonrender()
and will fire more than once, and no longer contains options argument - New reserved events (see below)
- Setting uninitialised data on a component will no longer cause it to leak out into the parent scope
- 'Smart updates', via
ractive.merge()
andractive.shift()
etc, work across component boundaries
- Deprecated:
beforeInit()
,init()
, andcomplete()
- replaced withonconstruct()
,onrender()
andoncomplete()
methods
- New features
- Event hooks:
onconstruct()
,onconfig()
,oninit()
,onrender()
,oncomplete()
,onunrender()
,onteardown()
. These all have equivalent events, e.g.this.on('render',...)
, which are reserved (i.e. you cannot use them as proxy events in templates) - Conditional attributes, e.g.
<div {{#if selected}}class='selected'{{/if}}>...</div>
- Safe to specify touch events for browsers that do not support them
- Added support for
{{else}}
in{{#with}}
block - Added support for
{{#each...}}...{{else}}...{{/each}}
with empty objects (#1299) - Within event handlers, the
event
object is available asthis.event
, and has aname
property (useful alongsideractive.on('*',...)
). - Character position is include alongside line and column information when parsing with
includeLinePositions: true
- Computed values and expressions are more efficient, and will not recompute unnecessarily
- Event hooks:
- Fixes for #868, #871, #1046, #1184, #1206, #1208, #1209, #1220, #1228, #1232, #1239, #1275, #1278, #1294, #1295, #1305, #1313, #1314, #1320 plus a few IE8 bugs
- Huge parser speed boost (see #1227)
- Fixes for #1204, #1214, #1218, #1221, #1223
- Partial names can be specified dynamically as references or expressions
- Release script got pooched; there was a tag mix-up of some sort with npm and 0.5.6 contained source files but not all the build files.
- Fixes for #1166, #1169, #1174, and #1183
- Breaking changes:
- Use of other elements besides
<script>
for templates is an error - Removed CSS length interpolator
- Use of other elements besides
- New features
{{yield}}
operator - see ractivejs#1141- Event bubbling - see ractivejs#1117
- Method calls from templates - see ractivejs#1146
- Parse errors contain
line
andcharacter
data for debugging inside live editors - Partials have an optional context, e.g.
{{>item foo}}
- Fixes for #618, #837, #983, #990, #995, #996, #1003, #1007, #1009, #1011, #1014, #1019, #1024, #1033, #1035, #1036, #1038, #1055, #1053, #1057, #1072, #1074, #1078, #1079, #1082, #1094, #1104, #1106, #1109, #1121, #1124, #1128, #1133, #1134, #1137, #1147, #1149, #1155, #1157
- Other changes
- Initial changes from
ractive.animate()
are applied immediately, not on the next frame
- Initial changes from
- Breaking changes:
- Removed debug option from
ractive.observe()
(#970)
- Removed debug option from
- Fixes for #713, #941, #942, #943, #945, #950, #951, #952, #953, #960, #965, #967 and #974
- No actual changes, just wrestling with npm and bower!
- Fix for #939
-
Code organisation
- Codebase is now structured as ES6 modules, which can use new ES6 features such as arrow functions
- Simpler, more efficient runloop
- Encapsulated viewmodel logic
-
Breaking changes:
- errors in observers and evaluators are no longer caught
- Nodes are detached as soon as any outro transitions are complete (if any), rather than when all transitions are complete
- The options argument of
init: function(options)
is now strictly what was passed into the constructor, usethis.option
to access configured value. data
with properties on prototype are no longer cloned when accessed.data
from "baseClass" is no longer deconstructed and copied.- Use of a
<script>
tag for specifying inline templates is not enforced. - Options specified on component constructors will not be picked up as defaults.
debug
now ondefaults
, not constructor - Select bindings follow general browser rules for choosing options. Disabled options have no value.
- Input values are not coerced to numbers, unless input type is
number
orrange
{{this.foo}}
in templates now means same thing as{{.foo}}
- Rendering to an element already render by Ractive causes that element to be torn down (unless appending).
- Illegal javascript no longer allowed by parser in expressions and will throw
- Parsed template format changed to specify template spec version.
- Proxy-event representation
- Non-dynamic (bound) fragments of html are no longer stored as single string
- See https://github.com/ractivejs/template-spec for current spec.
- Arrays being observed via
array.*
no longer senditem.length
event on mutation changes - Reserved event names in templates ('change', 'reset', 'teardown', 'update') will cause the parser to throw an error
{{else}}
support in both handlebars-style blocks and regular mustache conditional blocks, but is now a restricted keyword that cannot be used as a regular reference- Child components are created in data order
- Keypath expressions resolve left to right and follow same logic as regular mustache references (bind to root, not context, if left-most part is unresolved).
- Improved attribute parsing and handling:
- character escaping and whitespace handling in attribute directive arguments
- boolean and empty string attributes
-
Other new features
- Better errors and debugging info
- Duplicate, repetitive console.warn messages are not repeated.
- Improved error handling and line numbers for parsing
- Warn on bad two-way radio bindings
- Support for handlebars style blocks:
#if
,#with
,#each
,#unless
and corresponding@index
and@key
- Array mutation methods are now also available as methods on
Ractive.prototype
- e.g.ractive.push('items', newItem)
. The return value is a Promise that fulfils when any transitions complete - Support for static mustache delimiters that do one-time binding
{{./foo}}
added as alias for{{.foo}}
- Leading
~/
keypath specifier, eg{{~/foo}}
, for accessing root data context in keypaths - Observers with wildcards now receive actual wildcard values as additional arguments
- The following plugins: adaptors, components, decorators, easing, events, interpolators, partials, transitions, when used in components will be looked up in the view hierarchy if they cannot be found in the inheritance chain.
ractive.set
supports pattern observers, egractive.set('foo.*.bar')
- Support for specifying multiple events in single
on
, egractive.on( 'foo bar baz', handleFooBarOrBaz )
- Unnecessary leading and trailing whitespace in templates is removed
- Better support for post-init render/insert
- Computed properties can be updated with
ractive.update(property)
updateModel
returns aPromise
- Media queries work correctly in encapsulated component CSS
Component.extend
is writable (can be extended)append
option can now take a target element, behavior same asractive.insert
- All configuration options, except plugin registries, can be specified on
Ractive.defaults
andComponent.defaults
- Any configuration option except registries and computed properties can be specfied using a function that returns a value
ractive.reset()
will re-render if template or partial specified by a function changes its value- New
ractive.resetTemplate()
method that re-renders with new template - Value of key/value pair for partials and components can be specified using a function
ractive.off()
returns instance making it chainable- Improved support for extending Components with Components
- Better errors and debugging info
-
Bug fixes:
- Component names not restricted by array method name conflicts
- Ensure all change operations update DOM synchronously
- Unrooted and unresolved keypath expression work correctly
- Uppercase tag names bind correctly
- Falsey values in directives (
0
,''
,false
, etc) - IE8 fixes and working test suite
- Keypath expressions in binding attributes
- Edge case for keypath expression that include regular expression
- Input blur correctly updates model AND view
- Component parameters data correctly sync with parents
- Correct components.json format
- Variety of edge cases with rebindings caused by array mutations
- Partials aware of parent context
foreignObject
correctly defaults to HTML namespace- Edge cases with bind, rebind, unrender in Triples
- Sections (blocks) in attributes
- Remove unncessary evaluator function calls
- Incorrect "Computed properties without setters are read-only in the current version" error
- Handle emulated touch events for nodes that are defined on
window
in the browser - Never initialiased decorators being torndown
- File inputs without mustache refs are not bound
- Pattern observers with empty array
- Callbacks that throw cause promise reject
- Clean-up
input
andoption
binding edge cases - Using
this._super
safe if baseclass or it's method doesn't actually exist. - Leading
.
on keypaths do not throw errors and are removed for purposes of processing - Post-blur validation via observer works correctly
- Radio buttons with static attributes work correctly
- DOCTYPE declarations are uppercased
- Transitioned elements not detaching if window is not active
- CSS transitions apply correctly
- wildcard
*
can be used as first part of observer keypath
- BREAKING: Filenames are now lowercase. May affect you if you use Browserify etc.
- BREAKING:
set()
,update()
,teardown()
,animate()
,merge()
,add()
,subtract()
, andtoggle()
methods return a Promise that fulfils asynchronously when any resulting transitions have completed - BREAKING: Elements are detached when all transitions are complete for a given instance, not just transitions on descendant nodes
- BREAKING: Default options are placed on
Ractive.defaults
(andComponent.defaults
, whereComponent = Ractive.extend(...)
) - BREAKING: The
adaptors
option is nowadapt
. It can be a string rather than an array if you're only using one adaptor - Reactive computed properties
- Two-way binding works with 'keypath expressions' such as
{{foo[bar]}}
- Support for single-file component imports via loader plugins such as http://ractivejs.github.io/ractive-load/
- A global runloop handles change propagation and other batchable operations, resulting in performance improvements across the board
- Promises are used internally, and exposed as
Ractive.Promise
(Promises/A+ compliant, a la ES6 Promises) - Components can have encapsulated styles, passed in as the
css
option (disable withnoCssTransform: true
) ractive.reset()
method allows you to replace an instance'sdata
object- Decorators are updated when their arguments change (with specified
update()
method if possible, otherwise by tearing down and reinitialising) - Inline components inherit surrounding data context, unless defined with
isolated: true
- Transitions will use JavaScript timers if CSS transitions are unavailable
- A global variable (
window.Ractive
) is always exported, butRactive.noConflict()
is provided to prevent clobbering existingRactive
variable - Inline component
init()
methods are only called once the component has entered the DOM - Any section can be closed with
{{/...}}
, where...
can be any string other than the closing delimiter - Evaluators that throw exceptions will print an error to the console in debug mode
ractive.observe(callback)
- i.e. with no keypath - observes everythingractive.observe('foo bar baz', callback)
will observe all three keypaths (passed to callback as third argument)- Better whitespace preservation and indenting when using
ractive.toHTML()
- Calling
ractive.off()
with no arguments removes all event listeners - Triples work inside SVG elements
<option>{{foo}}</option>
works the same as<option value='{{foo}}'>{{foo}}</option>
- More robust data/event propagation between components
- More robust magic mode
- Fixed a host of edge case bugs relating to array mutations
- Many minor fixes and tweaks: #349, #351, #353, #369, #370, #376, #377, #390, #391, #393, #398, #401, #406, #412, #425, #433, #434, #439, #441, #442, #446, #451, #460, #462, #464, #465, #467, #479, #480, #483, #486, #520, #530, #536, #553, #556
ractive.findComponent()
andractive.findAllComponents()
methods, for getting references to components- Expression results are wrapped if necessary (e.g.
{{getJSON(url)}}
wrapped by @lluchs' Promise adaptor) - Mustaches referring to wrapped values render the facade, not the value
- Directive arguments are parsed more reliably
- Components inherit adaptors from their parents
- Adapto
- Changes to transitions API
- SVG support is detected and exposed as
Ractive.svg
- If subclass has data, it is used as prototype for instance data
- Reorganised project into AMD modules, using amdclean during build
- Decorators - decorate elements with functionality, e.g. tooltips, jQuery UI widgets, etc
- Moved plugins (adaptors, decorators, custom events, transitions) out of the main codebase and into separate repositories. Note: plugin APIs have changed!
ractive.merge()
- merge items from one array into another (e.g. updating with data from a server)- Pattern observers - observe e.g.
items[*].status
- Contenteditable support (thanks @aphitiel and @Nijikokun)
ractive.insert()
andractive.detach()
methods for moving a Ractive instance in and out of the DOM without destroying itractive.toHTML()
replacesractive.renderHTML()
ractive.findAll( selector, { live: true })
maintains a live list of elements matching any CSS selector- Various bugfixes
- Adaptors - use external libraries like Backbone seamlessly with Ractive
- Dependency tracking within functions, by monitoring
ractive.get()
) - Create live nodelists with the
findAll()
method - Observers are guaranteed to fire before DOM updates, unless
{defer:true}
is passed as an option toractive.observe()
- Triples behave correctly inside table elements etc (issue #167)
- Delimiters ('{{' and '}}') can be overridden globally with
Ractive.delimiters
andRactive.tripleDelimiters
- Fix #130 (event handler parameters and array modification)
- Tap event respects spacebar keypresses while a suitable element is focused
- updateModel() method to resync two-way bindings if they are manipulated external (e.g.
$(input).val(newValue)
) - Better handling of HTML entities
- Expressions with unresolved references will still render, using
undefined
in place of unknown references - Hover event fires on the equivalent of mouseenter/mouseleave rather than mouseover/mouseout
- Various bugfixes and stability/performance improvements
- Better two-way binding - support for multiple checkboxes and file inputs
- Experimental 'magic mode' - use ES5 getters and setters instead of .set() and .get(). See #110
- More efficient event binding, and dynamic proxy event names
- Support for pointer events with
tap
- thanks lluchs - Iterate through properties of an object - see #115
- Bugfixes and refactoring
- Experimental support for components - see this thread for details
- Support for component - thanks CamShaft
- Option to use
on-click
style event binding (as opposed toproxy-click
) - Bug fixes
ractive.find()
andractive.findAll()
convenience methods (equivalent toractive.el.querySelector()
andractive.el.querySelectorAll()
)- Subclasses created with
Ractive.extend()
can now have abeforeInit
method that will be called before rendering - Expressions no longer need to be wrapped in parentheses. Section closing mustaches for expression sections can have any content
- Various minor bugfixes and improvements
- Maintenance and bugfixes
- IE8 support!
- Transitions - fine-grained control over how elements are rendered and torn down
- Inline partials
- ractive.observe() method
- Smart updates when using array mutator methods, reducing the amount of DOM manipulation that happens
- Changed proxy event and event definition API (BREAKING CHANGE!)
- Improved Ractive.extend
- SVG elements no longer require the xmlns='http://www.w3.org/2000/svg' attribute - it is assumed, as it is in browsers
- ractive.animate() can accept a map of keypaths to values
- fullscreen convenience methods
- removed ractive.render() method
- added ractive.renderHTML() method, for rendering template+data (in browser or server environment)
- Major overhaul, particularly of the parser
- Expressions - JS-like expressions within templates, with robust tracking of multiple dependencies. These replace formatters
- Renamed Ractive.compile -> Ractive.parse
- Added adaptors (e.g. Backbone Model adaptors)
- Various performance enhancements and bug fixes
- Added event proxies. In lieu of documentation, for now, see #27
- Made array modification more robust and performant
- Cleaned up some redundant code following 0.2.0 overhaul, some minor performance benefits
- Linting and refactoring
- Fixed bug where Ractive would attempt to use innerHTML with non-HTML elements (i.e. SVG text)
- Major architectural overhaul. Data is now stored on the Ractive instance rather than on a separate viewmodel, allowing for cleaner and more efficient code (at the cost of the ability to share one viewmodel among many instances - a theoretical benefit at best). Data is flattened and cached, permitting lightning-fast lookups even with complex data.
- Templates can be sanitized at compile-time to remove script tags and other hypothetical security risks. In lieu of documentation see issue #12
- More complete compliance with mustache test suite
- More efficient compilation (consecutive text nodes are concatenated, etc)
- Cleaned up public API, internal functions now kept private
.animate()
now interpolates between arrays, and between objects- Complex element attributes wait until the end of a
.set()
cycle to update, to avoid repeatedly modifying the DOM unnecessarily - Element property names are used instead of attributes wherever possible (e.g. we use
node.className='...'
instead ofnode.setAttribute('class','...')
internally) - Various bug fixes
- Now using DOM fragments for better performance
- Better support for legacy browsers
- Vastly better two-way data binding
- set() and get() now accept arrays of keys, for edge cases involving keys with periods
- Bug fixes and refactoring
- Renamed project from Anglebars to Ractive
- Added support for animation
- A shed-load of bug fixes, and a big dollop of refactoring
- Bug fixes!
- Modify arrays so that
pop
,push
and other mutator methods trigger a view update - Removed half-finished, flaky async code. Async mode may return later
set
events are called when a)view.set()
is called, b) twoway bindings trigger them, c) array mutator methods cause an update
- Split into Anglebars.compile and Anglebars.runtime, to shave a few kilobytes off in production
- Simplified API - removed
compiled
andcompiledPartials
init options (in favour of allowing either compiled or string templates), and removedobserve
andunobserve
instance methods - Added event methods -
on
,off
andfire
Anglebars.extend
for creating subclasses with default options (e.g. templates) and additional methods- Support passing in jQuery collections (and lookalikes), and CSS selectors (if browser supports
document.querySelector
) - Index references -
{{#section:i}}<!-- {{i}} evaluates to array index inside here -->{{/section}}
- started maintaining a changelog...