Releases: PhpGt/Dom
December 2020
A few minor updates to the CI process have been made, along with a new test and functionality fix to innerHTML
thanks to @speich.
September 2020
- Bugfix: When working with a textarea's
value
attribute, getting and setting on the same request would not persist data. - Feature: Boolean attributes are implemented and tested: attributes like
disabled
,checked
, etc. all correspond to their correct HTML attributes. - Tests: XML documents tested for querySelector and querySelectorAll functions.
- Tests: Body and title elements are inferred by default when there is a minimal-style HTML document created.
- Moved to using Github Actions for our CI.
Optimised innerHTML
This release is very minor in scope, but has knock-on effects to DomTemplate, specifically PhpGt/DomTemplate#124
The changes in this release mean that setting an innerHTML of an empty string is much more efficient, and this can now be done on DocumentFragments too. Before, this would cause an exception, due to there not being a parent element.
Changes in DomTemplate are incoming so that binding an empty dataset to an list element will set the innerHTML to an empty string, which means that the :empty CSS selector will now be valid for empty lists.
Compatibility and test improvement
There are no new features included within this release, just improvements to the way Element object properties are handled, and how Element and Document objects are tested. Have fun.
Element improvements and debugging
Unit test coverage on the Element
class is now improved to 100%, thanks to @Jelmergu.
The Element class has been improved to take advantage of the new CssXPath updates, along with fixing getter/setter for the value attribute, and a check for the property map constant which improves working with non-html documents such as XML.
Improved Element value getter/setter
The value property of Elements is made more consistent in this release. Certain element types behave differently when getting or setting the value property - some access the value attribute directly, others affect the state of their children.
PSR-7 Interoperability
The PSR-7 StreamInterface has been implemented on the Document/HTMLDocument classes to improve interoperability when used within other frameworks. There is no new functionality due to this, so only a minor version increment is necessary.
Along with the interface implementation, a couple of bugfixes are released here too:
- Rewind HTMLCollection iterators before use, to avoid throwing a RunetimeException when used outside of a foreach.
- Don't format the HTML output at document render. There will be some efficiency gains here on large document trees.
August 2019 bugfixes
No new features in this release, just a selection of bugfixes and improvements.
- Fix problem where attribute value contains comma - it's possible to use a CSS selector that contains a comma in the actual selector. Previously the CSS to XPath translator was splitting queries based on the comma character with no context as to where the comma appeared in the string. This improvement checks to see if the comma is within a quoted string, and if so, treats it as part of a selector.
- Test innerHTML does not encode JSON with HTML encoding - Harden tests around unicode support with the innerHTML property.
- Default value getter/setter property - The value property of Elements should behave differently if the element can represent a value, such as input, option, etc. This change improves the use of shorthand value property, rather than having to use getAttribute/setAttribute.
Efficiency improvements
This release is minor in footprint, but potentially major in efficiency increase. This is only noticable on large trees, but when you have thousands of Nodes in a Document, you can cut the page render time in half.
Main improvements lie in the iteration of NodeList objects. There is also improvement to the distinction between a NodeList and HTMLCollection (HTMLCollection objects can only contain Elements, not Nodes).