Initial history.length should be 1, not 0.

This brings jsdom in line with both the spec and with browsers, and fixes an issue
where calling `history.pushState()` and then `history.back()` would fail to trigger a
`popstate` event for the `back()` call, since there was no initial history entry to
navigate back to.

From https://html.spec.whatwg.org/multipage/browsers.html#browsing-context:

"When a browsing context is first created, it must be created with a single Document in its session history..."
pushState()/replaceState() shouldn't fire popstate

The spec doesn't say that `pushState()` or `replaceState()` should trigger a
`popstate` event, and browsers don't fire a `popstate` event after a `pushState()` or
`replaceState()` call. `popstate` should only be fired during traversal.

https://html.spec.whatwg.org/multipage/browsers.html#history-1
Cleanups to the living level

This more clearly modularizes the code while avoiding side effects.
JSHint cleanup
Add a helper to define constants on an object and its .prototype
Add support for NodeFilter constants
Version 1.2.0
Correct handling of the <template> tag content fragments. Fixes #942
Some minor cleanups
Require latest parse5, for <template> support
Version 1.2.1
Remove duplicate included file in test/runner
Add support for passing arrays to querySelectorAll
Add toString to core.HTMLDocument.prototype, fixes #935
Coerce to string when setting .data on text nodes
Version 1.2.2
Remove utils.intercept; it has performance issues.

This issue arises because v8 does not optimize any function that abuses `arguments`.

Fixes #948.
Version 1.2.3
Move focus() and blur() into HTMLElement proto
Add living-html/focus test for existence of HTMLElement.focus