Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Symfony/Component/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,6 @@ public function addNodes(array $nodes)
*/
public function addNode(\DOMNode $node)
{
if (null !== $this->document && $this->document !== $node->ownerDocument) {
@trigger_error('Attaching DOM nodes from multiple documents in a Crawler is deprecated as of 2.8 and will be forbidden in 3.0.', E_USER_DEPRECATED);
}

if (null === $this->document) {
$this->document = $node->ownerDocument;
}

if ($node instanceof \DOMDocument) {
$node = $node->documentElement;
}
Expand All @@ -329,6 +321,14 @@ public function addNode(\DOMNode $node)
throw new \InvalidArgumentException(sprintf('Nodes set in a Crawler must be DOMElement or DOMDocument instances, "%s" given.', get_class($node)));
}

if (null !== $this->document && $this->document !== $node->ownerDocument) {
@trigger_error('Attaching DOM nodes from multiple documents in a Crawler is deprecated as of 2.8 and will be forbidden in 3.0.', E_USER_DEPRECATED);
}

if (null === $this->document) {
$this->document = $node->ownerDocument;
}

parent::attach($node);
}

Expand Down