Bind dynamic data to reusable HTML components.
MIT License
Bot releases are visible (Hide)
Published by g105b about 5 years ago
For attributes that don't have a value, like disabled
, selected
, checked
, etc. a new bind rule is added in this release, meaning the attribute will be added if a boolean condition is met.
The attribute value is marked with a preceding question mark. For example: <input type="checkbox" data-bind:checked="?isChecked" />
Small but powerful when working with large repeating datasets.
Have fun and stay productive!
Published by g105b about 5 years ago
This release changes the internal mechanism for binding lists to the DOM. Rather than appending Elements to the DOM tree in-place, a list is built up in a separate DocumentFragment, and once complete, the fragment is appended to the ParentNode, greatly improving page render speeds on complex documents with many nodes.
Another efficiency improvement is the addition of data-bind
parameter` attribute, which now must be added to any Element that will have its parameters bound inline, using curly braces. This is a small backwards breaking change, hence the minor version increment, as before any parameters containing curly braces would be automatically bound.
Published by g105b about 5 years ago
This release introduces the fixes made to the Dom repository upstream.
Published by g105b about 5 years ago
The introduction of the two new interfaces DataBindMapper and DataBindGetter allow the developer to state that a class can be used in the DomTemplate bind functions, without having to expose the data as public properties.
DataBindMapper defines a function, dataBindMap
which must return an associative array, and will be called in the bind process.
DataBindGetter does not define any functions, but instead indicates to DomTemplate that the class should have its get* functions called for any keys that are bound. For example, binding a key of id
will try to call the getId
function on the class.
Published by g105b over 5 years ago
With a small bump of dependencies, this release contains only one minor change: the ability to pass bound keys and values as null. When a null value is bound, it is treated as an empty string.
Published by g105b over 5 years ago
Typehints have been made less strict in some areas, so objects or associative arrays can be used as the data.
The bind
function has been introduced as an alias to the bindKeyValue
function.
In the binding of list items, the data is bound to the nodes after they are inserted into the DOM to avoid incorrect referencing issues after complete.
Published by g105b over 5 years ago
Before a stable release could be made, the way that data was bound to the DOM needed to be addressed. Currently (v0.6.x) this was too complex, because no matter what type of data you had, everything was bound to the DOM through the Element::bind()
function. That included key value pair storage, lists, and if there was data that needed to be bound to a nested list it was impossible to bind without iterating over it yourself.
The stable release introduce introduces, amongst a generous amount of bugfixes and test hardening, the addition of the following new functions:
They should be self-explanatory now, and depending on the data that you wish to bind to the page, should be very obvious as to which function you should be calling.
Have fun, and stay productive!
Published by g105b over 5 years ago
Throughout the repository, all classes have received PHP Doc Block comments to describe to IDEs what types are being returned by inherited functions. This is required because of the use of DOMDocument::registerNodeClass
, which has some unusual side effects with the way classes are inherited in the DOM.
Published by g105b over 5 years ago
PHPUnit 8 has been introduced and tests adjusted accordingly. Continuous Integration services are now updated to work with the latest version of PHP.
Published by g105b almost 6 years ago
Consistency has been improved with other PHP.Gt repositories, specifically the use of "contains" over "has" to match other DOM APIs.
Type checking has been made safer with the use of the null coalescing operator rather than emitting warnings or throwing errors.
Published by g105b about 6 years ago
Published by g105b over 6 years ago
-t
prefix when XPath name usedPublished by g105b over 6 years ago
Published by g105b over 6 years ago
Components behave better when mixed with templates.
Notably, a component can be nested within a template element, and its value will be expanded as soon as the template is used, rather than when the template is rendered to the page. This allows the developer to manipulate the contents of the component on-the-fly.
Published by g105b almost 7 years ago
The final planned feature for v1 is now implemented: bindable class lists.
Automatically toggle a class name of an element depending on a truthy value of the dataset.
Published by g105b almost 7 years ago
Published by g105b almost 7 years ago
All originally scoped features are now implemented, but some real world use-cases must be tested before we get close to a production release.
Published by g105b almost 7 years ago
Published by g105b almost 7 years ago
Published by g105b almost 7 years ago
Bindable introduces the next feature: dynamic data binding.