public function __construct(\SPLObjectStorage $splos, $initialized = false, $scopeNode = null)
{
$this->psHandler = new \QueryPath\CSS\DOMTraverser\PseudoClass();
$this->initialized = $initialized;
// Re-use the initial splos
$this->matches = $splos;
if (count($splos) != 0) {
$splos->rewind();
$first = $splos->current();
if ($first instanceof \DOMDocument) {
$this->dom = $first;
//->documentElement;
} else {
$this->dom = $first->ownerDocument;
//->documentElement;
}
if (empty($scopeNode)) {
$this->scopeNode = $this->dom->documentElement;
} else {
$this->scopeNode = $scopeNode;
}
}
// This assumes a DOM. Need to also accomodate the case
// where we get a set of elements.
/*
$this->dom = $dom;
$this->matches = new \SplObjectStorage();
$this->matches->attach($this->dom);
*/
}