LearnBoost/expect.js — pull request #37 by abbakym (2012-11-08 16:56:45+00:00)
Title: fix "sort of comparison" for dom nodes

`expect.eql` failed to perform "sort of comparison" for DOM nodes, always returning true for nodes even if they were of different types (say, text node and div). I stumbled upon this recently when saw this test passing:

```javascript
var div = document.createElement('div');
var a = document.createTextNode('a');
var b = document.createTextNode('b');
div.innerHTML = ' ';
var c = div.firstChild;
var d = div.lastChild;
expect([a, b]).to.be.eql([c, d]);
```

After digging through `expect.js` code with breakpoints and `console.log`s I understood that basically the [CommonJS Unit Testing 1.0 spec](http://wiki.commonjs.org/wiki/Unit_Testing/1.0) implemented by `expect.js` has no special algo for comparing nodes. So they are treated as mere objects and as such are considered "sort of equal" because their prototypes are undefined and their keys are empty (in fact, sometimes Firefox returns "constructor" as as a result of keys check, in this case this works better, but this unreliable and insufficient and also quite strange).

What I've implemented is deep `for-in` check for nodes (this in fact is what QUnit does and why comparing nodes with `deepEqual` works well there).

P. S. Sorry for multiple commits, I'm a github noob. If this needs to be cleaned up, I can create another pull request.