Good call :)
As for the nastiness, these are the objects we can have as dom argument:

``
[ { type: 'tag',
    name: 'someelem',
    attribs: { someattribute: 'something' },
    children: [ [Object] ],
    next: null,
    prev: null,
    parent: 
     { type: 'tag',
       name: 'g',
       attribs: {},
       children: [Circular],
       next: null,
       prev: null,
       parent: null,
       root: [Object] } } ]
```

```
{ '0': 
   { type: 'tag',
     name: 'span',
     attribs: {},
     children: [],
     next: null,
     prev: null,
     parent: null,
     root: 
      { type: 'root',
        name: 'root',
        parent: null,
        prev: null,
        next: null,
        children: [Object] } },
  options: 
   { normalizeWhitespace: false,
     xmlMode: false,
     decodeEntities: true },
  length: 1 }
```

```
{ type: 'tag',
  name: 'span',
  attribs: {},
  children: 
   [ { data: 'foo',
       type: 'text',
       next: null,
       prev: null,
       parent: [Circular] } ],
  next: null,
  prev: null,
  parent: null,
  root: 
   { type: 'root',
     name: 'root',
     parent: null,
     prev: null,
     next: null,
     children: [ [Circular] ] } }
```

Open to suggestions. :)