Ejemplo n.º 1
0
 function test_toDoc()
 {
     $html = '<html><head><meta charset="UTF8"></head><body></body></html>';
     $doc = HtmlUtils::toDoc($html);
     $this->assertTrue(is_object($doc));
     $this->assertTrue($doc->isHtml());
     $doc1 = HtmlUtils::toDoc($doc);
     $this->assertTrue(is_object($doc1));
     $this->assertTrue($doc1->isHtml());
     $this->assertEquals($doc1, $doc);
 }
Ejemplo n.º 2
0
 /**
  * Append the give HTML code to the HTML page head section.
  * 
  * @param  string|phpQueryObject $html  html page or a phpQueryObject
  * @param  [type] $code [description]
  * @return [type]       [description]
  */
 public static function appendToHead($html, $code)
 {
     $doc = HtmlUtils::toDoc($html);
     phpQuery::pq('head', $doc)->append($code);
     return $doc;
 }