protected function context() { $el = $this->document->dom->documentElement; if ($el === null) { // Whether there is not a root node // the DOMDocument is promoted as root node. $el = $this->document->dom; } if ($this->context === null || $el !== $this->contextEl) { // The user can prepend a root node to the current root node. // In this case we have to update the context with the new first root node. $this->context = new FluidContext($this->document, $this->handler, $el); $this->contextEl = $el; } return $this->context; }