FluentDOM 5.2 - New Features

FluentDOM 5.2 is released and here some new features:


The new static FluentDOM::load() function allows to use the loaders to get a FluentDOM\Document instance.
$json = FluentDOM::load($json, 'text/json');
echo $json(

DOM Living Standard

A large part of the DOM Living Standard is implemented. It adds properties like $element->firstElementChild and methods like $element->remove().

Query selectors are not implemented yet. Still thinking about that. If you have an opinion please add a comment to the issue.

Two New Loaders

Loader Plugins

It was already possible to use the loaders directly or to set the loaders for a FluentDOM\Query object. It is now possible to register them on the FluentDOM class. This makes them available to the FluentDOM() and FluentDOM::load() functions.

Additional packages like FluentDOM/HTML5 can register their loaders with specific content types. Just require the package with Composer and you're ready to go:
$dom = FluentDOM::load($html, 'text/html5');


The behavior of find() has been changed to allow two modes. FIND_MODE_MATCH executes the selector directly. It should be faster and work better with XPath. FIND_MODE_FILTER filters the descendant nodes of the current context - like the jQuery documentation describes it.


Surface Pro - USB Hub

The Surface Pro is a cool device but USB connectivity is one of its weak point. It has a single USB 3 port that is not fully powered. Devices that need the more power like an USB monitor will not work.

Up until now I used a hub with 3 USB ports and LAN (RJ45). An Y cable connected the USB port on the power supply to provide additional power to the hub.

I found something better. 
  • Really small form factor
  • 2 USB 3 ports, 
  • 1 RJ45 LAN port
  • Card reader (SD and Micro SD)
  • Micro USB power connector
So I loose 1 USB port, but get the SD card reader. The form factor is really nice. The killer feature is the Micro USB port. Finally a powered USB hub that does not need a special power supply.

Take a look:

I tested it connected to the Surface Pro power supply and the Asus MB168B+ USB monitor. Works fine.  


FluentDOM 5.1 - New Features

FluentDOM 5.1 is now available. Here are some of the highlights:


The classes can now be called as functions to navigate in a DOM with XPath expressions. The following example fetches all link hrefs attributes from an HTML page:
$dom = new \FluentDOM\Document();

$links = [];
foreach ($dom('//a[@href]/@href') as $href) {
  $links[] = (string)$href;

This works for most of the nodes in a DOM. 


The new Creator class provides short syntax to create DOM nodes. More detailed information can be found in the wiki.
$_ = FluentDOM::create();
echo $_(
  ['class' => 'navigation'],
  $_('li', 'FluentDOM')


Several serializers/loaders for JSON where added. JSONML, Rayfish, BadgerFish and RabbitFish are supported.
echo "XML -> JsonML\n\n";
$json = json_encode(
  new FluentDOM\Serializer\Json\JsonML($dom), 
echo $json;

echo "\n\nJsonML -> XML\n\n";
echo FluentDOM(
  $json, 'application/jsonml+json')->formatOutput();

The Release