@expressen/tallahassee
Advanced tools
Comparing version 14.3.0 to 14.4.0
@@ -59,5 +59,12 @@ "use strict"; | ||
Object.defineProperty(document, "_window", { | ||
get() { | ||
return window; | ||
Object.defineProperties(document, { | ||
defaultView: { | ||
get() { | ||
return window; | ||
} | ||
}, | ||
_window: { | ||
get() { | ||
return window; | ||
} | ||
} | ||
@@ -64,0 +71,0 @@ }); |
@@ -19,2 +19,3 @@ "use strict"; | ||
const locationSymbol = Symbol.for("location"); | ||
const windowSymbol = Symbol.for("window"); | ||
const referrerSymbol = Symbol.for("referrer"); | ||
@@ -25,5 +26,6 @@ const fullscreenElementSymbol = Symbol.for("fullscreenElement"); | ||
module.exports = class Document extends Node { | ||
constructor(source, cookieJar) { | ||
constructor(source, cookieJar, window) { | ||
const $ = cheerio.load(source.text || "", {decodeEntities: false}); | ||
super(null, $.root()); | ||
this[windowSymbol] = window; | ||
this[locationSymbol] = source.location || new Location(this, source.url); | ||
@@ -43,2 +45,5 @@ this[referrerSymbol] = source.referrer || ""; | ||
} | ||
get defaultView() { | ||
return this[windowSymbol] || null; | ||
} | ||
get location() { | ||
@@ -45,0 +50,0 @@ return this[locationSymbol]; |
@@ -48,3 +48,3 @@ "use strict"; | ||
const contextExtensions = [this]; | ||
if (document?._window) contextExtensions.push(document._window); | ||
if (document?.defaultView) contextExtensions.push(document.defaultView); | ||
this[name] = vm.compileFunction(value, ["event"], { contextExtensions }); | ||
@@ -389,11 +389,2 @@ } | ||
} | ||
removeChild(child) { | ||
if (this.$elm[0].children.indexOf(child.$elm[0]) === -1) { | ||
throw new DOMException("Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node."); | ||
} | ||
child.$elm.remove(); | ||
this._emitter.emit("_insert"); | ||
return child; | ||
} | ||
replaceChild(newChild, oldChild) { | ||
@@ -400,0 +391,0 @@ if (!newChild) { |
@@ -16,2 +16,3 @@ "use strict"; | ||
const HTMLImageElement = require("./HTMLImageElement"); | ||
const HTMLIFrameElement = require("./HTMLIFrameElement"); | ||
const HTMLVideoElement = require("./HTMLVideoElement"); | ||
@@ -30,2 +31,3 @@ const Text = require("./Text"); | ||
img: HTMLImageElement, | ||
iframe: HTMLIFrameElement, | ||
form: HTMLFormElement, | ||
@@ -32,0 +34,0 @@ input: HTMLInputElement, |
@@ -16,4 +16,4 @@ "use strict"; | ||
_runScript() { | ||
return vm.runInNewContext(this.innerText, this.ownerDocument._window); | ||
return vm.runInNewContext(this.innerText, this.ownerDocument.defaultView); | ||
} | ||
}; |
"use strict"; | ||
const DOMException = require("domexception"); | ||
const nodeTypes = require("./nodeTypes"); | ||
@@ -134,4 +135,10 @@ const NodeList = require("./NodeList"); | ||
} | ||
removeChild() { | ||
throw new Error("Not implemented"); | ||
removeChild(child) { | ||
if (this.$elm[0].children.indexOf(child.$elm[0]) === -1) { | ||
throw new DOMException("Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node."); | ||
} | ||
child.$elm.remove(); | ||
this._emitter.emit("_insert"); | ||
return child; | ||
} | ||
@@ -138,0 +145,0 @@ replaceChild() { |
@@ -15,2 +15,5 @@ "use strict"; | ||
} | ||
set nodeValue(value) { | ||
return this.$elm[0].data = value; | ||
} | ||
}; |
@@ -20,2 +20,3 @@ "use strict"; | ||
const HTMLImageElement = require("./HTMLImageElement"); | ||
const HTMLIFrameElement = require("./HTMLIFrameElement"); | ||
@@ -123,2 +124,5 @@ const kResponse = Symbol.for("response"); | ||
} | ||
get HTMLIFrameElement() { | ||
return HTMLIFrameElement; | ||
} | ||
get FormData() { | ||
@@ -125,0 +129,0 @@ return FormData; |
{ | ||
"name": "@expressen/tallahassee", | ||
"version": "14.3.0", | ||
"version": "14.4.0", | ||
"description": "Lightweight client testing framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130182
63
3705