before() public method

This will take the give data (XML or HTML) and put it before each of the items that the DOMQuery object currently contains. Contrast this with after().
See also: insertBefore()
See also: after()
See also: append()
See also: prepend()
public before ( mixed $data )
$data mixed The data to be inserted. This can be XML in a string, a DomFragment, a DOMElement, or the other usual suspects. (See {@link qp()}).
示例#1
0
 /**
  * Insert the current elements into the destination document.
  * The items are inserted before each element in the given DOMQuery document.
  * That is, they will be siblings with the current elements.
  *
  * @param DOMQuery $dest
  *  Destination DOMQuery document.
  * @retval object DOMQuery
  *  The current DOMQuery object, unaltered. Only the destination DOMQuery
  *  object is altered.
  * @see before()
  * @see insertAfter()
  * @see appendTo()
  * @throws QueryPath::Exception
  *  Thrown if $data is an unsupported object type.
  */
 public function insertBefore(DOMQuery $dest)
 {
     foreach ($this->matches as $m) {
         $dest->before($m);
     }
     return $this;
 }