foo HTML; $dom->load($str); assert($dom->find('div', 0)==$str); // ----------------------------------------------- $str = <<foo HTML; $dom->load($str); assert($dom->find('div', 0)==$str); // ----------------------------------------------------------------------------- // innertext test $str = <<
test $str = <<
ok0link0
ok1link1
ok2link2
HTML; $dom->load($str); $es = $dom->find('p'); assert($es[0]->innertext=='ok0link0'); assert($es[1]->innertext=='ok1link1'); assert($es[2]->innertext=='ok2link2'); assert($dom->find('p', 0)->plaintext=='ok0link0'); assert($dom->find('p', 1)->plaintext=='ok1link1'); assert($dom->find('p', 2)->plaintext=='ok2link2'); $count = 0; foreach($dom->find('p') as $p) { $a = $p->find('a'); assert($a[0]->innertext=='link'.$count); ++$count; } $es = $dom->find('p a'); assert($es[0]->innertext=='link0'); assert($es[1]->innertext=='link1'); assert($es[2]->innertext=='link2'); assert($dom->find('p a', 0)->plaintext=='link0'); assert($dom->find('p a', 1)->plaintext=='link1'); assert($dom->find('p a', 2)->plaintext=='link2'); // ----------------------------------------------------------------------------- // HTML; $dom->load($str); $e = $dom->find('embed', 0); assert($e->src=='../graphics/sounds/1812over.mid'); assert($e->height=='60'); assert($e->width=='144'); assert($e==strtolower($str)); // ----------------------------------------------------------------------------- //test $str = <<HTML; $dom->load($str); //assert(count($dom->find('input'))==0); // ----------------------------------------------------------------------------- //test $str = <<
HTML; $dom->load($str); assert(count($dom->find('code'))==1); //assert(count($dom->find('input'))==0); // ----------------------------------------------------------------------------- // tear down $dom->clear(); unset($dom); ?>