# Collection.byDomOrder

Returns a sorted copy using compareDocumentPosition; items without comparable mounted elements
retain an equivalent ordering position.

## Signatures

```ts
export declare function byDomOrder<ItemType extends Item<unknown, object>>(items: readonly ItemType[]): readonly ItemType[];
```

## Why

Separating this deterministic policy from event wiring lets applications test it directly and
reuse it in custom composites.

## Ownership and lifetime

This is a synchronous calculation. It acquires no resources and does not mutate the input array,
state, event, or DOM.

## Examples

```ts
import * as Collection from "@typed/ui/Collection";

const ordered = Collection.byDomOrder([{ id: "body", element: document.body }]);
```
