Skip to content

Releases: PhpGt/Dom

Improvements to Attr class

17 Jun 13:28
4eb31b1
Compare
Choose a tag to compare

The Attr class has received typehints for the Node types it returns, and the introduction of Attr::remove() adds a missing functionality not shared by Element::remove()

Introduction of Php.Gt's own CSS translator

14 Jun 15:33
a5419ea
Compare
Choose a tag to compare

The major change featured in this release is the introduction of PHP.Gt/CssXPath - our own CSS to XPath translator, meaning we can remove the huge dependency tree of Symfony Components and concentrate on a much more terse and efficient codebase.

All current v1 unit tests have been kept with the introduction of our own translator, so in theory there will not be any backwards-breaking changes, but theory is only ever as good as its latest observation. Please let us know using the issue tracker if this release affects your codebase (also, let us know if it has a positive effect - we'd love to hear from you).

Other notable changes in this release include:

  • All typehints are updated so that all LibXML functions that return native DOMDocument objects now know about the Gt/Dom extension objects (the same can be said with the PHP.Gt/DomTempalte repository too!)
  • In minimal HTML5 documents, a missing <body> tag will be automatically inferred, as is the same in web browsers
  • All element attributes can be set by using live properties, which was a missing feature in v1. A common example of this is setting the "href" attribute of a link: $link->href = "/page"; versus the longhand $link->setAttribute("href", "/page");
  • Following on from that point, special properties are now handled correctly, such as the way only a single radiobutton in the same group can have its checked property set to true.

Please feedback to the contributors how you find this release, either through the issue tracker, or drop a message to [email protected]

Have fun and stay productive!

Input "multiple" and "selected" properties

10 Jun 14:36
12011a4
Compare
Choose a tag to compare

Amongst many updates to the unit tests, this release introduces new tests and functionality for "multiple" select elements, along with proper handling of the "selected" property of checkboxes, radioboxes and selects.

Form feature tests

03 Oct 19:38
d50e8e0
Compare
Choose a tag to compare

Thanks to @ognjen-petrovic we now have a FormTest class specifically for testing form-related functionality.

Implemented in this release is the checked attribute on Form elements, along with the following small changes:

  • Symfony's CSS selector has been fixed at version 3.2.14 as it will be replaced entirely by github.com/PhpGt/CssXPath in the next major release.
  • Code sniffer has fixes some issues.

Element dataset functionality

21 Sep 22:36
00a6b16
Compare
Choose a tag to compare

The dataset property on the HTMLElement interface provides read/write access to all the custom data attributes (data-*) set on the element. This access is available both in HTML and within the DOM. It is a StringMap, one entry for each custom data attribute. Note that the dataset property itself can be read, but not directly written. Instead, all writes must be to the individual properties within the dataset, which in turn represent the data attributes. Note also that an HTML data-attribute and its corresponding DOM dataset.property do not share the same name, but they are always similar.

Read more here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset

Improvements to core

16 Sep 18:16
e2ea6dd
Compare
Choose a tag to compare

The following two improvements have been made to better reflect the standard DOM behaviour:

  • innerHTML - a fragment must be used to set the innerHTML of an element, but fragments do not allow non-XML content to be appended! A temporary document is created to overcome this flaw in libxml.
  • NodeList Iterator - it is possible for an item in the iterator to be set to null (https://dom.spec.whatwg.org/#interface-nodelist)

Bug fix and dependency bump

27 Apr 02:49
020a6dc
Compare
Choose a tag to compare

Thanks to @jaroslavtyc for catching a bug that affected getting ID by magic __get access. The PHP return type now allows the correct nullable type for when there is no element by the provided ID.

Dependencies have been bumped up with this minor release.

Bugfixes

17 Apr 12:59
343babc
Compare
Choose a tag to compare
  • innerText synonymous for textContent on Element
  • getAttribute compatibility with DOM Level 4
  • Retrieving an out-of-bounds NodeList element returns null
  • NodeList bug fixed where Countable affects Iterator key

Many minor improvements

22 Dec 11:04
865d16d
Compare
Choose a tag to compare
  • Tests improved
  • Standardisation of scope resolution
  • Methods wrapped with extended types
  • Methods return types standardised
  • Dropped templates from documentation - use DomTemplate instead
  • Updated code to match StyleGuide
  • Introduced CircleCI 2.0
  • Upgraded PHPUnit to v6

Full DOM compatibility

29 May 22:25
Compare
Choose a tag to compare
  • All DOM class implementations' methods/properties tested
  • UTF-8 compatible
  • Level 4 methods (matches, remove, etc.)
  • TokenList
  • Fully type-hinted to PHP 7.0 capabilities, docblocks used where needed