1 | Object.defineProperty(exports, "__esModule", { value: true });
|
2 | var static_1 = require("../static");
|
3 | var create_1 = require("../runtime/browser-emulation/create");
|
4 | var stylesheets_1 = require("./stylesheets");
|
5 | var svg_1 = require("./svg");
|
6 | exports.transformInplace = function (path, snapshot, options) {
|
7 | if (options.inlineStylesheets || options.inlineVectorGraphics) {
|
8 | var uri = static_1.ApplicationFallbackOptions.fallbackUri;
|
9 | var window_1 = create_1.createModernWindow(snapshot.renderedDocument, uri);
|
10 | try {
|
11 | if (options.inlineStylesheets) {
|
12 | stylesheets_1.inlineStylesheets(path, window_1.document);
|
13 | }
|
14 | if (options.inlineVectorGraphics) {
|
15 | svg_1.inlineVectorGraphics(window_1.document);
|
16 | }
|
17 | snapshot.renderedDocument = window_1.document.documentElement.outerHTML;
|
18 | }
|
19 | finally {
|
20 | window_1.close();
|
21 | }
|
22 | }
|
23 | if (/^<\!DOCTYPE html>/i.test(snapshot.renderedDocument) === false) {
|
24 | snapshot.renderedDocument = "<!DOCTYPE html>" + snapshot.renderedDocument;
|
25 | }
|
26 | };
|
27 |
|
\ | No newline at end of file |