UNPKG

jsdom

Version:

A JavaScript implementation of many web standards

1,650 lines (1,366 loc) 85.2 kB
"use strict"; const conversions = require("webidl-conversions"); const utils = require("./utils.js"); const ElementCreationOptions = require("./ElementCreationOptions.js"); const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; const Node = require("./Node.js"); const HTMLElement = require("./HTMLElement.js"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; const interfaceName = "Document"; exports.is = function is(obj) { return utils.isObject(obj) && utils.hasOwn(obj, implSymbol) && obj[implSymbol] instanceof Impl.implementation; }; exports.isImpl = function isImpl(obj) { return utils.isObject(obj) && obj instanceof Impl.implementation; }; exports.convert = function convert(obj, { context = "The provided value" } = {}) { if (exports.is(obj)) { return utils.implForWrapper(obj); } throw new TypeError(`${context} is not of type 'Document'.`); }; exports.create = function create(globalObject, constructorArgs, privateData) { if (globalObject[ctorRegistrySymbol] === undefined) { throw new Error("Internal error: invalid global object"); } const ctor = globalObject[ctorRegistrySymbol]["Document"]; if (ctor === undefined) { throw new Error("Internal error: constructor Document is not installed on the passed global object"); } let obj = Object.create(ctor.prototype); obj = exports.setup(obj, globalObject, constructorArgs, privateData); return obj; }; exports.createImpl = function createImpl(globalObject, constructorArgs, privateData) { const obj = exports.create(globalObject, constructorArgs, privateData); return utils.implForWrapper(obj); }; exports._internalSetup = function _internalSetup(obj, globalObject) { Node._internalSetup(obj, globalObject); Object.defineProperties( obj, Object.getOwnPropertyDescriptors({ get location() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["location"]); }, set location(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } this.location.href = V; } }) ); Object.defineProperties(obj, { location: { configurable: false } }); }; exports.setup = function setup(obj, globalObject, constructorArgs = [], privateData = {}) { privateData.wrapper = obj; exports._internalSetup(obj, globalObject); Object.defineProperty(obj, implSymbol, { value: new Impl.implementation(globalObject, constructorArgs, privateData), configurable: true }); obj[implSymbol][utils.wrapperSymbol] = obj; if (Impl.init) { Impl.init(obj[implSymbol], privateData); } return obj; }; exports.install = function install(globalObject) { if (globalObject.Node === undefined) { throw new Error("Internal error: attempting to evaluate Document before Node"); } class Document extends globalObject.Node { constructor() { return exports.setup(Object.create(new.target.prototype), globalObject, undefined); } getElementsByTagName(qualifiedName) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'getElementsByTagName' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'getElementsByTagName' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].getElementsByTagName(...args)); } getElementsByTagNameNS(namespace, localName) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 2) { throw new TypeError( "Failed to execute 'getElementsByTagNameNS' on 'Document': 2 arguments required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; if (curArg === null || curArg === undefined) { curArg = null; } else { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'getElementsByTagNameNS' on 'Document': parameter 1" }); } args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'getElementsByTagNameNS' on 'Document': parameter 2" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].getElementsByTagNameNS(...args)); } getElementsByClassName(classNames) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'getElementsByClassName' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'getElementsByClassName' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].getElementsByClassName(...args)); } createElement(localName) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'createElement' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createElement' on 'Document': parameter 1" }); args.push(curArg); } { let curArg = arguments[1]; if (curArg !== undefined) { if (curArg === null || curArg === undefined) { curArg = ElementCreationOptions.convert(curArg, { context: "Failed to execute 'createElement' on 'Document': parameter 2" }); } else if (utils.isObject(curArg)) { curArg = ElementCreationOptions.convert(curArg, { context: "Failed to execute 'createElement' on 'Document': parameter 2" + " dictionary" }); } else { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createElement' on 'Document': parameter 2" }); } } args.push(curArg); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return utils.tryWrapperForImpl(esValue[implSymbol].createElement(...args)); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } createElementNS(namespace, qualifiedName) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 2) { throw new TypeError( "Failed to execute 'createElementNS' on 'Document': 2 arguments required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; if (curArg === null || curArg === undefined) { curArg = null; } else { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createElementNS' on 'Document': parameter 1" }); } args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createElementNS' on 'Document': parameter 2" }); args.push(curArg); } { let curArg = arguments[2]; if (curArg !== undefined) { if (curArg === null || curArg === undefined) { curArg = ElementCreationOptions.convert(curArg, { context: "Failed to execute 'createElementNS' on 'Document': parameter 3" }); } else if (utils.isObject(curArg)) { curArg = ElementCreationOptions.convert(curArg, { context: "Failed to execute 'createElementNS' on 'Document': parameter 3" + " dictionary" }); } else { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createElementNS' on 'Document': parameter 3" }); } } args.push(curArg); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return utils.tryWrapperForImpl(esValue[implSymbol].createElementNS(...args)); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } createDocumentFragment() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol].createDocumentFragment()); } createTextNode(data) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'createTextNode' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createTextNode' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].createTextNode(...args)); } createCDATASection(data) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'createCDATASection' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createCDATASection' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].createCDATASection(...args)); } createComment(data) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'createComment' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createComment' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].createComment(...args)); } createProcessingInstruction(target, data) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 2) { throw new TypeError( "Failed to execute 'createProcessingInstruction' on 'Document': 2 arguments required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createProcessingInstruction' on 'Document': parameter 1" }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createProcessingInstruction' on 'Document': parameter 2" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].createProcessingInstruction(...args)); } importNode(node) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'importNode' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = Node.convert(curArg, { context: "Failed to execute 'importNode' on 'Document': parameter 1" }); args.push(curArg); } { let curArg = arguments[1]; if (curArg !== undefined) { curArg = conversions["boolean"](curArg, { context: "Failed to execute 'importNode' on 'Document': parameter 2" }); } else { curArg = false; } args.push(curArg); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return utils.tryWrapperForImpl(esValue[implSymbol].importNode(...args)); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } adoptNode(node) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'adoptNode' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = Node.convert(curArg, { context: "Failed to execute 'adoptNode' on 'Document': parameter 1" }); args.push(curArg); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return utils.tryWrapperForImpl(esValue[implSymbol].adoptNode(...args)); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } createAttribute(localName) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'createAttribute' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createAttribute' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].createAttribute(...args)); } createAttributeNS(namespace, qualifiedName) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 2) { throw new TypeError( "Failed to execute 'createAttributeNS' on 'Document': 2 arguments required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; if (curArg === null || curArg === undefined) { curArg = null; } else { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createAttributeNS' on 'Document': parameter 1" }); } args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createAttributeNS' on 'Document': parameter 2" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].createAttributeNS(...args)); } createEvent(interface_) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'createEvent' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'createEvent' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].createEvent(...args)); } createRange() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol].createRange()); } createNodeIterator(root) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'createNodeIterator' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = Node.convert(curArg, { context: "Failed to execute 'createNodeIterator' on 'Document': parameter 1" }); args.push(curArg); } { let curArg = arguments[1]; if (curArg !== undefined) { curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'createNodeIterator' on 'Document': parameter 2" }); } else { curArg = 0xffffffff; } args.push(curArg); } { let curArg = arguments[2]; if (curArg !== undefined) { if (curArg === null || curArg === undefined) { curArg = null; } else { curArg = utils.tryImplForWrapper(curArg); } } else { curArg = null; } args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].createNodeIterator(...args)); } createTreeWalker(root) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'createTreeWalker' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = Node.convert(curArg, { context: "Failed to execute 'createTreeWalker' on 'Document': parameter 1" }); args.push(curArg); } { let curArg = arguments[1]; if (curArg !== undefined) { curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'createTreeWalker' on 'Document': parameter 2" }); } else { curArg = 0xffffffff; } args.push(curArg); } { let curArg = arguments[2]; if (curArg !== undefined) { if (curArg === null || curArg === undefined) { curArg = null; } else { curArg = utils.tryImplForWrapper(curArg); } } else { curArg = null; } args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].createTreeWalker(...args)); } getElementsByName(elementName) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'getElementsByName' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'getElementsByName' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].getElementsByName(...args)); } open() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } const args = []; { let curArg = arguments[0]; if (curArg !== undefined) { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'open' on 'Document': parameter 1" }); } else { curArg = "text/html"; } args.push(curArg); } { let curArg = arguments[1]; if (curArg !== undefined) { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'open' on 'Document': parameter 2" }); } else { curArg = ""; } args.push(curArg); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return utils.tryWrapperForImpl(esValue[implSymbol].open(...args)); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } close() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return esValue[implSymbol].close(); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } write() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } const args = []; for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'write' on 'Document': parameter " + (i + 1) }); args.push(curArg); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return esValue[implSymbol].write(...args); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } writeln() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } const args = []; for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'writeln' on 'Document': parameter " + (i + 1) }); args.push(curArg); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return esValue[implSymbol].writeln(...args); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } hasFocus() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol].hasFocus(); } clear() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol].clear(); } captureEvents() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol].captureEvents(); } releaseEvents() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol].releaseEvents(); } getSelection() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol].getSelection()); } getElementById(elementId) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'getElementById' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'getElementById' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].getElementById(...args)); } prepend() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } const args = []; for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; if (Node.is(curArg)) { curArg = utils.implForWrapper(curArg); } else { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'prepend' on 'Document': parameter " + (i + 1) }); } args.push(curArg); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return esValue[implSymbol].prepend(...args); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } append() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } const args = []; for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; if (Node.is(curArg)) { curArg = utils.implForWrapper(curArg); } else { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'append' on 'Document': parameter " + (i + 1) }); } args.push(curArg); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return esValue[implSymbol].append(...args); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } querySelector(selectors) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'querySelector' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'querySelector' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].querySelector(...args)); } querySelectorAll(selectors) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'querySelectorAll' on 'Document': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'querySelectorAll' on 'Document': parameter 1" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].querySelectorAll(...args)); } get implementation() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "implementation", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["implementation"]); }); } get URL() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["URL"]; } get documentURI() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["documentURI"]; } get compatMode() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["compatMode"]; } get characterSet() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["characterSet"]; } get charset() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["charset"]; } get inputEncoding() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["inputEncoding"]; } get contentType() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["contentType"]; } get doctype() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["doctype"]); } get documentElement() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["documentElement"]); } get referrer() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["referrer"]; } get cookie() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["cookie"]; } set cookie(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = conversions["USVString"](V, { context: "Failed to set the 'cookie' property on 'Document': The provided value" }); esValue[implSymbol]["cookie"] = V; } get lastModified() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["lastModified"]; } get readyState() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["readyState"]); } get title() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return esValue[implSymbol]["title"]; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set title(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'title' property on 'Document': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { esValue[implSymbol]["title"] = V; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get dir() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return esValue[implSymbol]["dir"]; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set dir(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'dir' property on 'Document': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { esValue[implSymbol]["dir"] = V; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get body() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return utils.tryWrapperForImpl(esValue[implSymbol]["body"]); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set body(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } if (V === null || V === undefined) { V = null; } else { V = HTMLElement.convert(V, { context: "Failed to set the 'body' property on 'Document': The provided value" }); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { esValue[implSymbol]["body"] = V; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get head() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["head"]); } get images() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "images", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["images"]); }); } get embeds() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "embeds", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["embeds"]); }); } get plugins() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "plugins", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["plugins"]); }); } get links() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "links", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["links"]); }); } get forms() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "forms", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["forms"]); }); } get scripts() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "scripts", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["scripts"]); }); } get currentScript() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["currentScript"]); } get defaultView() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["defaultView"]); } get onreadystatechange() { const esValue = this !== null && this !== undefined ? this : globalObject; return utils.tryWrapperForImpl(esValue[implSymbol]["onreadystatechange"]); } set onreadystatechange(V) { const esValue = this !== null && this !== undefined ? this : globalObject; V = utils.tryImplForWrapper(V); esValue[implSymbol]["onreadystatechange"] = V; } get anchors() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "anchors", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["anchors"]); }); } get applets() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "applets", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["applets"]); }); } get styleSheets() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.getSameObject(this, "styleSheets", () => { return utils.tryWrapperForImpl(esValue[implSymbol]["styleSheets"]); }); } get hidden() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return esValue[implSymbol]["hidden"]; } get visibilityState() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["visibilityState"]); } get onvisibilitychange() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["onvisibilitychange"]); } set onvisibilitychange(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["onvisibilitychange"] = V; } get onabort() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["onabort"]); } set onabort(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["onabort"] = V; } get onauxclick() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["onauxclick"]); } set onauxclick(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["onauxclick"] = V; } get onblur() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["onblur"]); } set onblur(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["onblur"] = V; } get oncancel() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["oncancel"]); } set oncancel(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["oncancel"] = V; } get oncanplay() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["oncanplay"]); } set oncanplay(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["oncanplay"] = V; } get oncanplaythrough() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["oncanplaythrough"]); } set oncanplaythrough(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["oncanplaythrough"] = V; } get onchange() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["onchange"]); } set onchange(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["onchange"] = V; } get onclick() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["onclick"]); } set onclick(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["onclick"] = V; } get onclose() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["onclose"]); } set onclose(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["onclose"] = V; } get oncontextmenu() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextmenu"]); } set oncontextmenu(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["oncontextmenu"] = V; } get oncuechange() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["oncuechange"]); } set oncuechange(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["oncuechange"] = V; } get ondblclick() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(esValue[implSymbol]["ondblclick"]); } set ondblclick(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError("Illegal invocation"); } V = utils.tryImplForWrapper(V); esValue[implSymbol]["ondblclick"] = V; } get ondrag() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!expo