remove_callback() публичный Метод

remove callback function
public remove_callback ( )
Пример #1
0
}
$dom->load($str);
$dom->set_callback('callback_3');
assert($dom == '<img src="foo"><p>foo</p><img src="foo">');
function callback_4($e)
{
    if ($e->tag === 'img') {
        $e->id = 'foo';
    }
}
$dom->set_callback('callback_4');
assert($dom == '<img src="foo" id="foo"><p>foo</p><img src="foo" id="foo">');
// -----------------------------------------------
// attributes test2
//$dom = str_get_dom($str);
$dom->load($str);
$dom->remove_callback();
$dom->find('img', 0)->id = "foo";
assert($dom == '<img src="src0" id="foo"><p>foo</p><img src="src2">');
function callback_5($e)
{
    if ($e->src === 'src0') {
        unset($e->id);
    }
}
$dom->set_callback('callback_5');
assert($dom == $str);
// -----------------------------------------------------------------------------
// tear down
$dom->clear();
unset($dom);