2019-10-15
BC BREAK for compatibility with Symfony 4.3 and up
-
HtmlPageCrawler::html()
is now just the parentCrawler::html()
and acts as getter only. Setting HTML content viaHtmlPageCrawler::html($html)
is not possible any more, useHtmlPageCrawler::setInnerHtml($html)
instead -
HtmlPageCrawler::text()
is now just the parentCrawler::text()
and acts as getter only that returns the text content from the first node only. For setting text content, useHtmlPageCrawler::setText($text)
instead. -
HtmlPageCrawler::attr()
is now just the parentCrawler::attr()
and acts as getter only. For setting attributes useHtmlPageCrawler::setAttribute($name, $value)
instead -
new method
HtmlPageCrawler::getCombinedText()
that returns the combined text from all nodes (as jQuery'stext()
function does and previous versions ofHtmlPageCrawler::text()
did) -
removed method
HtmlPageCrawler::isDisconnected()
2019-10-15
- undo deprecation of getInnerHtml()
- deprecate setter use of attr()
- deprecate isDisconnected()
2019-06-28
- Bugfix: setText() should convert special chars. Closes #34.
2019-05-17
Preparation for a smooth migration to 2.x / Symfony 4.3:
- deprecate setter use of html() and text(),
- deprecate getInnerHtml(),
- new methods setText() and getCombinedText()
2019-04-18
- Mark this version as incompatible to Symfony DomCrawler 4.3
2016-10-06
-
new method
unwrapInner
(thanks to @ttk) -
it's now possible to get the number of nodes in the crawler using the
$crawler->length
property like in Javascript instead ofcount($crawler)
2015-11-06
- new methods
HtmlPage::minify()
andHtmlPage::indent()
for compressing or nicely indenting the HTML document. These functions rely on the packagewa72/html-pretty-min
that is suggested in composer.json.
2015-05-20
-
text()
function now returns combined text of all elements in set (as jQuery does; previously only the nodeValue of the first element was returned) and can act as a settertext($string)
that sets the nodeValue of all elements to the specified string -
function
hasClass
now returns true if any of the elements in the Crawler has the specified class (previously, only the first element was checked). -
new function
makeClone
as equivalent to jQuery'sclone
function ("clone" is not a valid function name in PHP). As previously, you can alternatively use PHP's clone operator:$r = $c->makeClone()
is the same as$r = clone $c
, but the new function allows chaining. -
new function
removeAttr
aliasingremoveAttribute
for compatibility with jQuery -
appendTo
,insertBefore
,insertAfter
, andreplaceAll
now always return a new Crawler object containing the aggregate set of all elements appended to the target elements (this is the behavior of jQuery 1.9 and newer). -
attr
function can now act as setterattr($name, $value)
which is an alias forsetAttribute($name, $value)
(previously it accepted only one argument and was a getter equivalent togetAttribute($name)
only, like it is in parent DomCrawler) -
attr($name)
andgetAttribute($name)
now always returnnull
if the attribute does not exist (previously, an empty string was returned when used with Symfony 2.3)