tmpvar/jsdom — pull request #716 by lawnsea (2014-01-04 17:24:08+00:00)
Title: Dont dunder proto

Use `Object.create` instead of setting `__proto__` to create prototype chains.

The first two commits in this PR should not be controversial (except that the utility method lacks tests, which I will add when #713 is merged).

The third, fourth and fifth commits handle a slightly different case than the first two: assigning `__proto__` on something other than a `.prototype` or from something other than a `.prototype`. I considered adding another utility method for this case, but decided to get feedback first. The fifth commit also removes some code that I believe had no effect.

The final commit is made of bummersauce. Unfortunately, there is one assignment to `__proto__` that cannot be replaced with an equivalent appeal to `Object.create`. In `level2/events`, `core.Node.prototype.__proto__` is set to `EventTarget.prototype`. Unfortunately, other constructors already have the original prototype value in their chains (`core.Element`, e.g.). So, in this case, we feature-detect `__proto__` and if not found, extend instead of assigning. *This is not an equivalent operation.* See 34e8707.