Skip to content

Releases: PhpGt/DomTemplate

Improvements to table binding with existing content

16 Nov 13:04
e4e2208
Compare
Choose a tag to compare

When a <table> element already exists on the page, it would be useful to utilise the contents of the table, retaining parts of it as a template when binding.

This minor release introduces improvements to help this case:

  • Existing <th> elements that don't match any bound data are preserved.
  • Bound data that doesn't match any existing headers is discarded.
  • Importantly: existing <tr> elements can be marked with data-template to add pre-templated row shapes for advanced designs.

Tidying up

15 Nov 17:48
6b06a89
Compare
Choose a tag to compare

The following tweaks have been made to this minor patch release:

  • null values can now be bound everywhere, without an exception being thrown.
  • Internally, the term Modular has been renamed to Partial to reflect the actual usage and documentation.
  • Another terminology change, cleanBindAttributes is renamed to cleanDatasets to better reflect what the function does.
  • Examples are added to the source code for helping developers get used to the library.

BindList improvements

13 Oct 14:31
ce56d65
Compare
Choose a tag to compare

This patch release introduces a bugfix, typehint improvements and a bump of dependencies:

  • Improvements to bind list context #275
  • Typehint improvements #273

Namespace standardisation

12 Oct 15:31
62f76e4
Compare
Choose a tag to compare

In this patch release:

  • Static analysis is improved: #271
  • "Partial" exceptions: #270
  • Clean data attributes: #269

Full Changelog: v2.1.0...v2.1.1

Callbacks to bindList, performance improvements, BindGetter and more!

12 Oct 10:28
d8006b5
Compare
Choose a tag to compare

This release is packed with small updates:

  • bindListCallback is introduced that allows a callback function to be called on each iteration of the binding of a list, allowing you to mutate the data per element, along with manually tweaking the templated HTMLElement.
  • BindableCache is introduced that significantly increases the speed of using Bind attributes.
  • Wherever a bindable object is used, if it has an asArray function, it will always be called.
  • It's now possible to leave a custom component empty without an exception being thrown.
  • Overall, unit tests have been strengthened significantly.

BindData objects

02 Oct 15:21
7533211
Compare
Choose a tag to compare

In this minor patch release, bindData() will now check for all objects' Bind attribute, adding to the flexibility of throwing an object to a Document for binding to the HTML.

DOM Facade release (v2)

15 Sep 18:57
ba90345
Compare
Choose a tag to compare

This release introduces no extra functionality, but changes the model in which the DOM is used, and how data is bound.

The major upgrade is that DOM v3 is now used, meaning that the DOM API is now more consistent with the W3C specification. With that, there are no longer any templating methods added to the DOM - instead there are specific classes that are used to bind data in different ways to different types of element. This is not only more readable, but enhances maintainability in your code by utilising the concept of dependency injection.

Have fun, and stay productive!

Github Actions

16 Feb 13:37
db553c1
Compare
Choose a tag to compare

This patch release includes two improvements:

  1. CI is handled by Github Actions now - you can check out the build history at https://github.com/PhpGt/Cli/actions

  2. PHPStan level 6 has been applied to the code, meaning certain type hints have been improved for greater readability and future maintainability.

September 2020

14 Sep 08:54
f0f8209
Compare
Choose a tag to compare

The following improvements have been made in this release:

  • Docblock improvements to resolve the issue of nested properties losing their DomTemplate extensions (for example $document->getElementById("test")->parentNode->nextElementSibling should still be Gt\DomTemplate\Element, but was sometimes indicating Gt\Dom\Element.
  • Dropped CircleCI for Github Actions - now everything is in once place (still to do: code quality scoring, currently handled by Scrutinizer)
  • Bind attributes are removed in bulk at the end of the page render, which slightly improves performance, but mainly catches the error where not all attributes were removed.
    _ bindNames implemented, allowing form elements to have their values bound by their names.

Bind keys of key-value-pairs to templates using unnamed bind parameters

24 May 19:48
151ed5f
Compare
Choose a tag to compare

Along with a dependency bump, this release brings the ability to bind the key of a key-value-pair data structure (such as an associative array) to a template element, with unnamed bind parameters.

Using the _key bind parameter will bind whatever the key is in a key-value-pair iterator. Nice for passing around associative arrays.

An example:

<ul>
  <li data-template> 
    Name: <span data-bind:text="_key">Person Name</span>, 
    Age: <span data-bind:text>0</span>
  </li>
</ul>