aboutsummaryrefslogtreecommitdiff
path: root/node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js')
-rw-r--r--node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js b/node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js
new file mode 100644
index 0000000..820deb2
--- /dev/null
+++ b/node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js
@@ -0,0 +1,40 @@
+"use strict";
+
+const { nodeRoot } = require("../helpers/node");
+const { mixin } = require("../../utils");
+
+const DocumentFragment = require("./DocumentFragment-impl").implementation;
+const DocumentOrShadowRootImpl = require("./DocumentOrShadowRoot-impl").implementation;
+const InnerHTMLImpl = require("../domparsing/InnerHTML-impl").implementation;
+
+class ShadowRootImpl extends DocumentFragment {
+ constructor(globalObject, args, privateData) {
+ super(globalObject, args, privateData);
+
+ const { mode } = privateData;
+ this._mode = mode;
+ }
+
+ _getTheParent(event) {
+ if (!event.composed && this === nodeRoot(event._path[0].item)) {
+ return null;
+ }
+
+ return this._host;
+ }
+
+ get mode() {
+ return this._mode;
+ }
+
+ get host() {
+ return this._host;
+ }
+}
+
+mixin(ShadowRootImpl.prototype, DocumentOrShadowRootImpl.prototype);
+mixin(ShadowRootImpl.prototype, InnerHTMLImpl.prototype);
+
+module.exports = {
+ implementation: ShadowRootImpl
+};