public function remove($selector = null)
{
$loop = $selector ? $this->filter($selector)->elements : $this->elements;
foreach ($loop as $node) {
if (!$node->parentNode) {
continue;
}
if (isset($node->tagName)) {
$this->debug("Removing '{$node->tagName}'");
}
$node->parentNode->removeChild($node);
// Mutation event
$event = new DOMEvent(array('target' => $node, 'type' => 'DOMNodeRemoved'));
phpQueryEvents::trigger($this->getDocumentID(), $event->type, array($event), $node);
}
return $this;
}