2015-02-02

FluentDOM 5.2 - New Features

FluentDOM 5.2 is released and here some new features:

FluentDOM::load()

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(
  'string(//phoneNumbers/*[type="home"]/number)'
);

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');

FluentDOM\Query::find()

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.
x