Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81152 views
1
/**
2
* Copyright 2013-2014, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @providesModule getTestDocument
10
*/
11
12
"use strict";
13
14
function getTestDocument(markup) {
15
var iframe = document.createElement('iframe');
16
iframe.style.display = 'none';
17
document.body.appendChild(iframe);
18
19
var testDocument = iframe.contentDocument || iframe.contentWindow.document;
20
testDocument.open();
21
testDocument.write(
22
markup || '<!doctype html><html><meta charset=utf-8><title>test doc</title>'
23
);
24
testDocument.close();
25
26
iframe.parentNode.removeChild(iframe);
27
return testDocument;
28
}
29
30
module.exports = getTestDocument;
31
32