Releases: canjs/can-bind
Adding missing can-log dependency
Bind in domQueue
This enables binding in the DOM queue. This will happen by default if an element
is passed:
new Bind({
parent, child,
element: element
})
The queue can also be specified:
new Bind({
parent, child,
element: element,
queue: "dom"
})
Tests using canReflect.getName in assertions fail in IE11
Test failed due to canReflect.getName
returning a certain value fail in IE11 because of how we name functions differently in IE11. With this fix, the tests use regular expressions to make the assertions less strict.
Warn when a sticky binding is converted on the wrong side.
In a "sticky" two-way binding, one side of the binding should defer to the other for deciding what value the shared object should have. If the wrong side of the binding is changing or converting the value when set, this will cause the values to become desynchronized. With this release, the user is warned in development mode when the non-sticky side changes its value when the binding is started.
Example:
import DefineMap from 'can-define/map/';
import SettableObservable from 'can-simple-observable/settable/';
import Bind from 'can-bind';
var User = DefineMap.extend("User", {
name: "string"
});
var child = new SettableObservable(val => {
return val instanceof User ? val : new User(val);
});
var parentMap = new SettableObservable(val => {
return val instanceof DefineMap ? val : new DefineMap(val);
}, {
user: {
name: "Brad"
}
});
new Bind({
parent,
child,
sticky: "childSticksToParent"
}).start();
The child observable is converting the DefineMap held by the parent to a User object, so on startup the two sides of the observable will not hold the same value. Only the parent should update the value, and a warning will be generated in the console to reflect this.
QUNIT2 upgrade
This updates the tests to use QUnit@2.x.x.
parent and child properties
const binding = new Bind({
child: child,
parent: parent
});
binding.child //-> child
binding.parent //-> parent
Added onEmit / offEmit to listenAndUpdate methods for emitted values
Allows for the ability to not initialise the parent
speed up tests by not group logging
v1.1.1 1.1.1