Version 2.0.0-alpha.1
Pre-release
Pre-release
- Significant rendering speed and memory optimizations
kff.BindingView
: implement counting of rendered (filtered) collection. Number of rendered collection items is propagated into an attribute of some model. Model + attribute are specified in element's attributedata-kff-count
usingmodel.attr
format. Every time a collection is rerendered, the count attribute is updated.kff.BindingView
: implement live sorting in collection binding. Live sorting (sorting of bound collection) is done in similar way as filtering. Sort function is specified in attributdata-kff-sort
usingmodel.compareFunction
format. It watches any change in collection or in collection item, which can lead to an overhead in some situations but DOM manipulation is done only on actual change in order, so it should not be critical.kff.BindingView
: diff based rerendering of collection bindings. When rendering filtered list, do not maintain index map of rendered items. Instead, create a new filtered collection and reuse already rendered nodes with new model items. This allows for better performance of heavily modified/filtered/sorted collections.kff.Binder
: experimental feature - when bound object is not an instance of kff.Model, render it as plain JS object (like:nobind
).kff.FrontController
: decouple hashchange observer from FrontController and provide separate service for state manipulation instead. A new service HashStateHandler provides legacyhashchange
event manipulation/listening. It can be easily replaced by HTML5 pushState API wrapper service or another state handler (i. e. state handler that works completely without url).- include IE8/9 polyfills (classList and standards compliant DOM events for IE8) into kff build
kff.createModelClass
: a new helper function that creates specific "model" class. This function creates a class constructor like the kff.createClass function but generates getter/setter function for every attribute.kff.Collection
: new methods corresponding to native array methods:concat
,join
,map
,reduce
,reduceRight
,slice
,push
,pop
,shift
,unshift
,kff.Collection
: filter method should be non-mutating + mutating behavior should be accomplished by remove method with function argument (BREAKING CHANGE)kff.Collection
: a new method 'createItem' for creating collection items using provided itemFactory or itemTypekff.ModelView
: a simple view class with implicit empty model accessible as*
in data bindings (just like an item in collection binding).- Simplified configuration of
kff.App
. It was necessary to create full FrontController and Router DI configuration to use router or non-default PageView. Now it is possible to use simpler App config. - make
:fill
binding mode work inside collection binding. When:fill
was used inside colelction binding, it wouldn't work because cloned input didn't have the original value anymore. To make it work, I get the input value in constructor and save it for later use in fill method (only when options.fill is set). - Removed internal
kff.List
class, all its behaviour is now merged intokff.Collection
- Removed all dependecies to jQuery
- add
nobind
modifier to binding syntax to slightly speed up rendering when no model od DOM changes are expected kff.View
: allow using model keypath in model events. When declaring model events, it should be possible to use model keypath as the first argument (not just model name), i.e.:
['foo.bar', 'change:attr', 'method]
kff.Binder
: add pseudo-param@attr
to getter and setterkff.InsertBinder
(orinsert
): a new binder for conditionally inserting/removing view element into/from the DOM- Getters and setters (:get and :set binding modifiers) now can take variable-length arguments. Arguments are evaluated as model keypaths in current view scope. If no argument are specified, legacy behaviour is used (= standard attr/val arguments).
kff.Router
: router now can fill url parameters to a model objectkff.Model
: addunsetAll
method for unsetting all model attributeskff.Model
: add methodunset
for unsetting (deleting) model attribute(s)kff.View
: added rerender method- prevent displaying
null
in binders in MSIE kff.StyleBinder
: add optional second argument for CSS unitstaticProperties
renamed to juststatics
in class definition- View rendering is splitted into two phase process: render (generating and traversing of DOM node of the view) and run (initialization of data-bindings and DOM/model events, actual running of the view). Those phases are triggered by methods renderAll and runAll (generates/runs the whole tree of views).
kff.ServiceContainer
now creates not only instances of classes (default) but also factory functions (type = 'factory'
), direct references to function objects (type = 'function'
) or even references to arbitrary javascript object (automatically detected).kff.ServiceContainer
function has a new optional parameter (loader), which is a function that accepts service name and returns service object (reference). The default loader searches for service in global window object. This can be used for getting services from browserify bundle or even from require calls in node.js. Note that the loader must be synchronous.