You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thomas Weinert edited this page Jul 12, 2018
·
3 revisions
FluentDOM\Query::addBack()
FluentDOM\Query addBack();
Add the previous selection to the current selection.
Usage
$xml = <<<XML<html> <head> <title>Examples: FluentDOM\Query::addBack()</title> </head> <body> <p>I would like to say: <b>HELLO</b></p> <b>HELLO</b> <div>Another list of childNodes</div> </body></html>XML;
$fdQuery = FluentDOM($xml);
echo$fdQuery
->find('//p')
->find('.//b')
->addBack()
->toggleClass('inB');
Output
<?xml version="1.0"?>
<html>
<head>
<title>Examples: FluentDOM\Query::addBack()</title>
</head>
<body>
<pclass="inB">I would like to say: <bclass="inB">HELLO</b></p>
<b>HELLO</b>
<div>Another list of childNodes</div>
</body>
</html>