Implement document.compatMode

Spec:
http://dom.spec.whatwg.org/#dom-document-compatmode

This is a sub-task for #1428.