What is the idiomatic, efficient technique to construct a DOMQuery
object that will contain the exact, caller-provided sequence of DOMNode
objects? Detailed requirements:
- the
DOMNode
objects in the resulting collection must be the same objects as those provided; cloning of nodes is undesirable - the method should be as efficient as possible
Things that don't work:
(new DOMQuery())->append($firstNode)->append($secondNode)
... will append to the elements of the collection, rather than to the collection itselfnew DOMQuery($firstNode)
only works with one node, and there seems to be no way to add more nodesanything that involves
DOMDocumentFragment
launches its own horror story arc with a lot of predicted StackOverflow traffic
So, how do I?