FakeDocument = function (dom) {
        var self = this;
        this.dom = dom;
        this.nodeMap = dom.nodeMap;

        // Walk the DOM looking for html/head/body tags. We can't use the nodeMap for this
        // because it might be nulled out in the cases where we're simulating the browser
        // creating implicit html/head/body tags.
        function walk(node) {
            if (node.tag === "html") {
                self.documentElement = node;
            } else if (node.tag === "head" || node.tag === "body") {
                self[node.tag] = node;
            }

            if (node.children) {
                node.children.forEach(walk);
            }
        }

        walk(dom);
    }
The RemoteFunctions code that applies edits to the DOM expects only a few things to
be present on the document object. This FakeDocument bridges the gap between a
SimpleDOM and real DOM for the purposes of applying edits.

@param {Object} dom The DOM we're wrapping with this document.