Example #1
0
File: XPath.php Project: volux/dom
 /**
  * @param string|array $expression
  * @param null|\DOMNode|\DOMDocument|Document|Html|Table|Form|Attr|Element|Tag|Field|Text|Cdata|Comment $contextnode
  * @param bool $registerNodeNS
  *
  * @return Set
  */
 public function query($expression, \DOMNode $contextnode = null, $registerNodeNS = true)
 {
     $prepared = $this->expression($expression);
     $result = @parent::query($prepared, $contextnode, $registerNodeNS);
     $this->doc->debug(array('result', $expression, $prepared, $result));
     return $this->doc->set($result);
 }
Example #2
0
File: Html.php Project: volux/dom
 /**
  * @param string $version
  * @param string $encoding
  */
 public function __construct($version = self::VERSION, $encoding = self::ENCODING)
 {
     parent::__construct($version, $encoding);
     $this->root('html');
     $this->head = $this->root()->append('head')->text(false);
     $this->body = $this->root()->append('body')->text(false);
     $this->container = new Document();
     $this->container->root('keep');
     $this->scripts = $this->container->root()->append('scripts');
     $this->ajax = $this->container->root()->append(self::AJAX_ROOT);
 }
Example #3
0
 /**
  * @param $wrapper
  *
  * @return Element|Tag|Field
  */
 public function wrap($wrapper)
 {
     $parent = $this->parentNode;
     $wrapper = $parent->appendChild($this->ownerDocument->check($wrapper));
     $wrapper->appendChild($this->cloneNode(true));
     $parent->replaceChild($wrapper, $this);
     return $wrapper;
 }
Example #4
0
 public function testDomHtml()
 {
     $this->assertEquals($this->text, $this->dom->find('.content')->text());
     $this->assertEquals($this->text, $this->dom->find('#test')->text());
 }
Example #5
0
File: Cdata.php Project: volux/dom
 /**
  * @param $element
  *
  * @return Element|Field|Tag
  */
 public function before($element)
 {
     return $this->parent()->insertBefore($this->ownerDocument->importNode($this->ownerDocument->check($element)), $this);
 }
Example #6
0
 /**
  * @return string
  */
 public function __toString()
 {
     return $this->ownerDocument->saveXML($this);
 }
Example #7
0
File: Set.php Project: volux/dom
 /**
  * @todo make faster!!!
  * @param string $xslFile
  * @param array $xsltParameters
  *
  * @return $this|Set
  */
 public function xslt($xslFile, $xsltParameters = array())
 {
     return $this->ownerDocument->xslt($xslFile, $xsltParameters, $this);
 }