Skip to content
Thomas Weinert edited this page Jul 31, 2014 · 1 revision

FluentDOM\Query::clone()

FluentDOM\Query clone();

Clone matched DOM Elements and select the clones.

Usage

$html = <<<HTML
<html>
  <head>
    <title>Examples: FluentDOM\Query::children()</title>
  </head>
  <body>
    <span>I have nothing more to say... </span>
    <div id="foo">FOO! </div>
  </body>
</html>
HTML;

echo FluentDOM($html)
  ->find('//span')
  ->clone()
  ->appendTo('//div[@id = "foo"]');

Output

<?xml version="1.0"?>
<html>
  <head>
    <title>Examples: FluentDOM\Query::children()</title>
  </head>
  <body>
    <span>I have nothing more to say... </span>
    <div id="foo">FOO! <span>I have nothing more to say... </span></div>
  </body>
</html>
Clone this wiki locally