mancha 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var _a, _b, _c, _d;
11
+ var _a, _b, _c, _d, _e;
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  const Mancha = require("./web.js");
14
14
  self["Mancha"] = Mancha;
@@ -16,9 +16,11 @@ if ((_b = (_a = self.document) === null || _a === void 0 ? void 0 : _a.currentSc
16
16
  const vars = JSON.parse(self.document.currentScript.dataset["vars"] || "{}");
17
17
  const fsroot = self.location.href.split("/").slice(0, -1).join("/") + "/";
18
18
  const targets = ((_d = (_c = self.document.currentScript) === null || _c === void 0 ? void 0 : _c.getAttribute("target")) === null || _d === void 0 ? void 0 : _d.split(",")) || ["body"];
19
- targets.forEach((target) => __awaiter(void 0, void 0, void 0, function* () {
20
- const node = self.document[target];
21
- node.innerHTML = yield Mancha.renderContent(node.innerHTML, vars, fsroot);
22
- }));
19
+ (_e = self.document) === null || _e === void 0 ? void 0 : _e.addEventListener("load", () => {
20
+ targets.forEach((target) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const node = self.document[target];
22
+ node.innerHTML = yield Mancha.renderContent(node.innerHTML, vars, fsroot);
23
+ }));
24
+ });
23
25
  }
24
26
  exports.default = Mancha;