wip
machty-ify the API

this commit will be squashed for the final PR
Merge pull request #1 from machty/tim-evans-doctitle

Integrate @machty's changes to document.title PR.