diff options
Diffstat (limited to 'vanilla/node_modules/jsdom/lib')
532 files changed, 0 insertions, 105897 deletions
diff --git a/vanilla/node_modules/jsdom/lib/api.js b/vanilla/node_modules/jsdom/lib/api.js deleted file mode 100644 index 6040d4f..0000000 --- a/vanilla/node_modules/jsdom/lib/api.js +++ /dev/null @@ -1,373 +0,0 @@ -"use strict"; -const path = require("path"); -const { pathToFileURL } = require("url"); -const fs = require("fs").promises; -const vm = require("vm"); -const toughCookie = require("tough-cookie"); -const sniffHTMLEncoding = require("html-encoding-sniffer"); -const whatwgURL = require("whatwg-url"); -const { legacyHookDecode } = require("@exodus/bytes/encoding.js"); -const { URL } = require("whatwg-url"); -const { MIMEType } = require("whatwg-mimetype"); -const { getGlobalDispatcher } = require("undici"); -const idlUtils = require("./jsdom/living/generated/utils.js"); -const VirtualConsole = require("./jsdom/virtual-console.js"); -const { createWindow } = require("./jsdom/browser/Window.js"); -const { parseIntoDocument } = require("./jsdom/browser/parser"); -const { fragmentSerialization } = require("./jsdom/living/domparsing/serialization.js"); -const createDecompressInterceptor = require("./jsdom/browser/resources/decompress-interceptor.js"); -const { - JSDOMDispatcher, DEFAULT_USER_AGENT, fetchCollected -} = require("./jsdom/browser/resources/jsdom-dispatcher.js"); -const requestInterceptor = require("./jsdom/browser/resources/request-interceptor.js"); - -class CookieJar extends toughCookie.CookieJar { - constructor(store, options) { - // jsdom cookie jars must be loose by default - super(store, { looseMode: true, ...options }); - } -} - -const window = Symbol("window"); -let sharedFragmentDocument = null; - -class JSDOM { - constructor(input = "", options = {}) { - const mimeType = new MIMEType(options.contentType === undefined ? "text/html" : options.contentType); - const { html, encoding } = normalizeHTML(input, mimeType); - - options = transformOptions(options, encoding, mimeType); - - this[window] = createWindow(options.windowOptions); - - const documentImpl = idlUtils.implForWrapper(this[window]._document); - - options.beforeParse(this[window]._globalProxy); - - parseIntoDocument(html, documentImpl); - - documentImpl.close(); - } - - get window() { - // It's important to grab the global proxy, instead of just the result of `createWindow(...)`, since otherwise - // things like `window.eval` don't exist. - return this[window]._globalProxy; - } - - get virtualConsole() { - return this[window]._virtualConsole; - } - - get cookieJar() { - // TODO NEWAPI move _cookieJar to window probably - return idlUtils.implForWrapper(this[window]._document)._cookieJar; - } - - serialize() { - return fragmentSerialization(idlUtils.implForWrapper(this[window]._document), { requireWellFormed: false }); - } - - nodeLocation(node) { - if (!idlUtils.implForWrapper(this[window]._document)._parseOptions.sourceCodeLocationInfo) { - throw new Error("Location information was not saved for this jsdom. Use includeNodeLocations during creation."); - } - - return idlUtils.implForWrapper(node).sourceCodeLocation; - } - - getInternalVMContext() { - if (!vm.isContext(this[window])) { - throw new TypeError("This jsdom was not configured to allow script running. " + - "Use the runScripts option during creation."); - } - - return this[window]; - } - - reconfigure(settings) { - if ("windowTop" in settings) { - this[window]._top = settings.windowTop; - } - - if ("url" in settings) { - const document = idlUtils.implForWrapper(this[window]._document); - - const url = whatwgURL.parseURL(settings.url); - if (url === null) { - throw new TypeError(`Could not parse "${settings.url}" as a URL`); - } - - document._URL = url; - document._origin = whatwgURL.serializeURLOrigin(document._URL); - this[window]._sessionHistory.currentEntry.url = url; - document._clearBaseURLCache(); - } - } - - static fragment(string = "") { - if (!sharedFragmentDocument) { - sharedFragmentDocument = (new JSDOM()).window.document; - } - - const template = sharedFragmentDocument.createElement("template"); - template.innerHTML = string; - return template.content; - } - - static async fromURL(url, options = {}) { - options = normalizeFromURLOptions(options); - - // Build the dispatcher for the initial request - // For the initial fetch, we default to "usable" instead of no resource loading, since fromURL() implicitly requests - // fetching the initial resource. This does not impact further resource fetching, which uses options.resources. - const resourcesForInitialFetch = options.resources !== undefined ? options.resources : "usable"; - const { effectiveDispatcher } = extractResourcesOptions(resourcesForInitialFetch, options.cookieJar); - - const headers = { Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" }; - if (options.referrer) { - headers.Referer = options.referrer; - } - - const response = await fetchCollected(effectiveDispatcher, { - url, - headers - }); - - if (!response.ok) { - throw new Error(`Resource was not loaded. Status: ${response.status}`); - } - - options = Object.assign(options, { - url: response.url, - contentType: response.headers["content-type"] || undefined, - referrer: options.referrer, - resources: options.resources - }); - - return new JSDOM(response.body, options); - } - - static async fromFile(filename, options = {}) { - options = normalizeFromFileOptions(filename, options); - const nodeBuffer = await fs.readFile(filename); - - return new JSDOM(nodeBuffer, options); - } -} - -function normalizeFromURLOptions(options) { - // Checks on options that are invalid for `fromURL` - if (options.url !== undefined) { - throw new TypeError("Cannot supply a url option when using fromURL"); - } - if (options.contentType !== undefined) { - throw new TypeError("Cannot supply a contentType option when using fromURL"); - } - - // Normalization of options which must be done before the rest of the fromURL code can use them, because they are - // given to request() - const normalized = { ...options }; - - if (options.referrer !== undefined) { - normalized.referrer = (new URL(options.referrer)).href; - } - - if (options.cookieJar === undefined) { - normalized.cookieJar = new CookieJar(); - } - - return normalized; - - // All other options don't need to be processed yet, and can be taken care of in the normal course of things when - // `fromURL` calls `new JSDOM(html, options)`. -} - -function extractResourcesOptions(resources, cookieJar) { - // loadSubresources controls whether PerDocumentResourceLoader fetches scripts, stylesheets, etc. - // XHR always works regardless of this flag. - let userAgent, baseDispatcher, userInterceptors, loadSubresources; - - if (resources === undefined) { - // resources: undefined means no automatic subresource fetching, but XHR still works - userAgent = DEFAULT_USER_AGENT; - baseDispatcher = getGlobalDispatcher(); - userInterceptors = []; - loadSubresources = false; - } else if (resources === "usable") { - // resources: "usable" means use all defaults - userAgent = DEFAULT_USER_AGENT; - baseDispatcher = getGlobalDispatcher(); - userInterceptors = []; - loadSubresources = true; - } else if (typeof resources === "object" && resources !== null) { - // resources: { userAgent?, dispatcher?, interceptors? } - userAgent = resources.userAgent !== undefined ? resources.userAgent : DEFAULT_USER_AGENT; - baseDispatcher = resources.dispatcher !== undefined ? resources.dispatcher : getGlobalDispatcher(); - userInterceptors = resources.interceptors !== undefined ? resources.interceptors : []; - loadSubresources = true; - } else { - throw new TypeError(`resources must be undefined, "usable", or an object`); - } - - // User interceptors come first (outermost), then decompress interceptor - const allUserInterceptors = [ - ...userInterceptors, - createDecompressInterceptor() - ]; - - return { - userAgent, - effectiveDispatcher: new JSDOMDispatcher({ - baseDispatcher, - cookieJar, - userAgent, - userInterceptors: allUserInterceptors - }), - loadSubresources - }; -} - -function normalizeFromFileOptions(filename, options) { - const normalized = { ...options }; - - if (normalized.contentType === undefined) { - const extname = path.extname(filename); - if (extname === ".xhtml" || extname === ".xht" || extname === ".xml") { - normalized.contentType = "application/xhtml+xml"; - } - } - - if (normalized.url === undefined) { - normalized.url = pathToFileURL(path.resolve(filename)).href; - } - - return normalized; -} - -function transformOptions(options, encoding, mimeType) { - const transformed = { - windowOptions: { - // Defaults - url: "about:blank", - referrer: "", - contentType: "text/html", - parsingMode: "html", - parseOptions: { - sourceCodeLocationInfo: false, - scriptingEnabled: false - }, - runScripts: undefined, - encoding, - pretendToBeVisual: false, - storageQuota: 5000000, - - // Defaults filled in later - dispatcher: undefined, - loadSubresources: undefined, - userAgent: undefined, - virtualConsole: undefined, - cookieJar: undefined - }, - - // Defaults - beforeParse() { } - }; - - // options.contentType was parsed into mimeType by the caller. - if (!mimeType.isHTML() && !mimeType.isXML()) { - throw new RangeError(`The given content type of "${options.contentType}" was not a HTML or XML content type`); - } - - transformed.windowOptions.contentType = mimeType.essence; - transformed.windowOptions.parsingMode = mimeType.isHTML() ? "html" : "xml"; - - if (options.url !== undefined) { - transformed.windowOptions.url = (new URL(options.url)).href; - } - - if (options.referrer !== undefined) { - transformed.windowOptions.referrer = (new URL(options.referrer)).href; - } - - if (options.includeNodeLocations) { - if (transformed.windowOptions.parsingMode === "xml") { - throw new TypeError("Cannot set includeNodeLocations to true with an XML content type"); - } - - transformed.windowOptions.parseOptions = { sourceCodeLocationInfo: true }; - } - - transformed.windowOptions.cookieJar = options.cookieJar === undefined ? - new CookieJar() : - options.cookieJar; - - transformed.windowOptions.virtualConsole = options.virtualConsole === undefined ? - (new VirtualConsole()).forwardTo(console) : - options.virtualConsole; - - if (!(transformed.windowOptions.virtualConsole instanceof VirtualConsole)) { - throw new TypeError("virtualConsole must be an instance of VirtualConsole"); - } - - const { userAgent, effectiveDispatcher, loadSubresources } = - extractResourcesOptions(options.resources, transformed.windowOptions.cookieJar); - transformed.windowOptions.userAgent = userAgent; - transformed.windowOptions.dispatcher = effectiveDispatcher; - transformed.windowOptions.loadSubresources = loadSubresources; - - if (options.runScripts !== undefined) { - transformed.windowOptions.runScripts = String(options.runScripts); - if (transformed.windowOptions.runScripts === "dangerously") { - transformed.windowOptions.parseOptions.scriptingEnabled = true; - } else if (transformed.windowOptions.runScripts !== "outside-only") { - throw new RangeError(`runScripts must be undefined, "dangerously", or "outside-only"`); - } - } - - if (options.beforeParse !== undefined) { - transformed.beforeParse = options.beforeParse; - } - - if (options.pretendToBeVisual !== undefined) { - transformed.windowOptions.pretendToBeVisual = Boolean(options.pretendToBeVisual); - } - - if (options.storageQuota !== undefined) { - transformed.windowOptions.storageQuota = Number(options.storageQuota); - } - - return transformed; -} - -function normalizeHTML(html, mimeType) { - let encoding = "UTF-8"; - - if (html instanceof Uint8Array) { - // leave as-is - } else if (ArrayBuffer.isView(html)) { - html = new Uint8Array(html.buffer, html.byteOffset, html.byteLength); - } else if (html instanceof ArrayBuffer) { - html = new Uint8Array(html); - } - - if (html instanceof Uint8Array) { - encoding = sniffHTMLEncoding(html, { - xml: mimeType.isXML(), - transportLayerEncodingLabel: mimeType.parameters.get("charset") - }); - html = legacyHookDecode(html, encoding); - } else { - html = String(html); - } - - return { html, encoding }; -} - -exports.JSDOM = JSDOM; - -exports.VirtualConsole = VirtualConsole; -exports.CookieJar = CookieJar; -exports.requestInterceptor = requestInterceptor; - -exports.toughCookie = toughCookie; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/Window.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/Window.js deleted file mode 100644 index 666e0fd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/Window.js +++ /dev/null @@ -1,1024 +0,0 @@ -"use strict"; -const vm = require("vm"); -const webIDLConversions = require("webidl-conversions"); -const { CSSStyleDeclaration } = require("cssstyle"); -const whatwgURL = require("whatwg-url"); -const { notImplementedMethod } = require("./not-implemented"); -const { installInterfaces } = require("../living/interfaces"); -const { define, mixin } = require("../utils"); -const Element = require("../living/generated/Element"); -const EventTarget = require("../living/generated/EventTarget"); -const EventHandlerNonNull = require("../living/generated/EventHandlerNonNull"); -const IDLFunction = require("../living/generated/Function"); -const OnBeforeUnloadEventHandlerNonNull = require("../living/generated/OnBeforeUnloadEventHandlerNonNull"); -const OnErrorEventHandlerNonNull = require("../living/generated/OnErrorEventHandlerNonNull"); -const { fireAPageTransitionEvent } = require("../living/helpers/page-transition-event"); -const windowProperties = require("../living/window-properties"); -const DOMException = require("../living/generated/DOMException"); -const idlUtils = require("../living/generated/utils"); -const WebSocketImpl = require("../living/websockets/WebSocket-impl").implementation; -const BarProp = require("../living/generated/BarProp"); -const documents = require("../living/documents.js"); -const External = require("../living/generated/External"); -const Navigator = require("../living/generated/Navigator"); -const Performance = require("../living/generated/Performance"); -const Screen = require("../living/generated/Screen"); -const Crypto = require("../living/generated/Crypto"); -const Storage = require("../living/generated/Storage"); -const Selection = require("../living/generated/Selection"); -const reportException = require("../living/helpers/runtime-script-errors"); -const { getCurrentEventHandlerValue } = require("../living/helpers/create-event-accessor.js"); -const { fireAnEvent } = require("../living/helpers/events"); -const SessionHistory = require("../living/window/SessionHistory"); -const { getDeclarationForElement, getResolvedValue, propertiesWithResolvedValueImplemented, - SHADOW_DOM_PSEUDO_REGEXP } = require("../living/helpers/style-rules.js"); -const CustomElementRegistry = require("../living/generated/CustomElementRegistry"); -const MessageEvent = require("../living/generated/MessageEvent"); -const jsGlobals = require("./js-globals.json"); - -const GlobalEventHandlersImpl = require("../living/nodes/GlobalEventHandlers-impl").implementation; -const globalEventHandlersEvents = require("../living/nodes/GlobalEventHandlers-impl").events; -const WindowEventHandlersImpl = require("../living/nodes/WindowEventHandlers-impl").implementation; - -const events = new Set([ - // GlobalEventHandlers (but we have to remove error below) - ...globalEventHandlersEvents, - - // WindowEventHandlers - "afterprint", - "beforeprint", - "hashchange", - "languagechange", - "message", - "messageerror", - "offline", - "online", - "pagehide", - "pageshow", - "popstate", - "rejectionhandled", - "storage", - "unhandledrejection", - "unload" - - // "error" and "beforeunload" are added separately -]); -events.delete("error"); - -const jsGlobalEntriesToInstall = Object.entries(jsGlobals).filter(([name]) => name in global); - -exports.createWindow = options => { - const makeVMContext = options.runScripts === "outside-only" || options.runScripts === "dangerously"; - - // Bootstrap with an empty object from the Node.js realm. We'll muck with its prototype chain shortly. - let window = {}; - - // Make window into a global object: either via vm, or just aliasing the Node.js globals. - // Also set _globalObject and _globalProxy. - // - // TODO: don't expose _globalObject and _globalProxy as public properties. While you're there, audit usage sites to - // see how necessary they really are. - if (makeVMContext) { - window = vm.createContext(vm.constants.DONT_CONTEXTIFY); - - window._globalObject = window; - window._globalProxy = vm.runInContext("this", window); - - // Without this, these globals will only appear to scripts running inside the context using vm.runScript; they will - // not appear to scripts running from the outside, including to JSDOM implementation code. - for (const [globalName, globalPropDesc] of jsGlobalEntriesToInstall) { - const propDesc = { ...globalPropDesc, value: vm.runInContext(globalName, window) }; - Object.defineProperty(window, globalName, propDesc); - } - } else { - window._globalObject = window._globalProxy = window; - - // Without contextifying the window, none of the globals will exist. So, let's at least alias them from the Node.js - // context. See https://github.com/jsdom/jsdom/issues/2727 for more background and discussion. - for (const [globalName, globalPropDesc] of jsGlobalEntriesToInstall) { - const propDesc = { ...globalPropDesc, value: global[globalName] }; - Object.defineProperty(window, globalName, propDesc); - } - } - - // Create instances of all the web platform interfaces and install them on the window. - installInterfaces(window, ["Window"]); - - // Now we have an EventTarget contructor so we can work on the prototype chain. - - // eslint-disable-next-line func-name-matching, func-style - const WindowConstructor = function Window() { - throw new TypeError("Illegal constructor"); - }; - Object.setPrototypeOf(WindowConstructor, window.EventTarget); - - Object.defineProperty(window, "Window", { - configurable: true, - writable: true, - value: WindowConstructor - }); - - const windowPropertiesObject = windowProperties.create(window.EventTarget.prototype, window); - - const windowPrototype = Object.create(windowPropertiesObject); - Object.defineProperties(windowPrototype, { - constructor: { - value: WindowConstructor, - writable: true, - configurable: true - }, - [Symbol.toStringTag]: { - value: "Window", - configurable: true - } - }); - - WindowConstructor.prototype = windowPrototype; - Object.setPrototypeOf(window, windowPrototype); - if (makeVMContext) { - Object.setPrototypeOf(window._globalProxy, windowPrototype); - Object.setPrototypeOf(window.EventTarget.prototype, window.Object.prototype); - } - - // Now that the prototype chain is fully set up, call the superclass setup. - EventTarget.setup(window, window); - - installEventHandlers(window); - - installOwnProperties(window, options); - - // Not sure why this is necessary... TODO figure it out. - Object.defineProperty(idlUtils.implForWrapper(window), idlUtils.wrapperSymbol, { get: () => window._globalProxy }); - - // Fire or prepare to fire load and pageshow events. - process.nextTick(() => { - if (!window.document) { - return; // window might've been closed already - } - - if (window.document.readyState === "complete") { - fireAnEvent("load", window, undefined, {}, true); - } else { - window.document.addEventListener("load", () => { - fireAnEvent("load", window, undefined, {}, true); - if (!window._document) { - return; // window might've been closed already - } - - const documentImpl = idlUtils.implForWrapper(window._document); - if (!documentImpl._pageShowingFlag) { - documentImpl._pageShowingFlag = true; - fireAPageTransitionEvent("pageshow", window, false); - } - }); - } - }); - - return window; -}; - -function installEventHandlers(window) { - mixin(window, WindowEventHandlersImpl.prototype); - mixin(window, GlobalEventHandlersImpl.prototype); - window._initGlobalEvents(); - - Object.defineProperty(window, "onbeforeunload", { - configurable: true, - enumerable: true, - get() { - return idlUtils.tryWrapperForImpl(getCurrentEventHandlerValue(window, "beforeunload")); - }, - set(V) { - if (!idlUtils.isObject(V)) { - V = null; - } else { - V = OnBeforeUnloadEventHandlerNonNull.convert(window, V, { - context: "Failed to set the 'onbeforeunload' property on 'Window': The provided value" - }); - } - window._setEventHandlerFor("beforeunload", V); - } - }); - - Object.defineProperty(window, "onerror", { - configurable: true, - enumerable: true, - get() { - return idlUtils.tryWrapperForImpl(getCurrentEventHandlerValue(window, "error")); - }, - set(V) { - if (!idlUtils.isObject(V)) { - V = null; - } else { - V = OnErrorEventHandlerNonNull.convert(window, V, { - context: "Failed to set the 'onerror' property on 'Window': The provided value" - }); - } - window._setEventHandlerFor("error", V); - } - }); - - for (const event of events) { - Object.defineProperty(window, `on${event}`, { - configurable: true, - enumerable: true, - get() { - return idlUtils.tryWrapperForImpl(getCurrentEventHandlerValue(window, event)); - }, - set(V) { - if (!idlUtils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(window, V, { - context: `Failed to set the 'on${event}' property on 'Window': The provided value` - }); - } - window._setEventHandlerFor(event, V); - } - }); - } -} - -function installOwnProperties(window, options) { - const windowInitialized = performance.now(); - - // ### PRIVATE DATA PROPERTIES - - window._dispatcher = options.dispatcher; - window._loadSubresources = options.loadSubresources; - window._userAgent = options.userAgent; - - // List options explicitly to be clear which are passed through - window._document = documents.createWrapper(window, { - parsingMode: options.parsingMode, - contentType: options.contentType, - encoding: options.encoding, - cookieJar: options.cookieJar, - url: options.url, - lastModified: options.lastModified, - referrer: options.referrer, - parseOptions: options.parseOptions, - defaultView: window._globalProxy, - global: window, - parentOrigin: options.parentOrigin - }, { alwaysUseDocumentClass: true }); - - const documentOrigin = idlUtils.implForWrapper(window._document)._origin; - window._origin = documentOrigin; - - // https://html.spec.whatwg.org/#session-history - window._sessionHistory = new SessionHistory({ - document: idlUtils.implForWrapper(window._document), - url: idlUtils.implForWrapper(window._document)._URL, - stateObject: null - }, window); - - window._virtualConsole = options.virtualConsole; - - window._runScripts = options.runScripts; - - // Set up the window as if it's a top level window. - // If it's not, then references will be corrected by frame/iframe code. - window._parent = window._top = window._globalProxy; - window._frameElement = null; - - // This implements window.frames.length, since window.frames returns a - // self reference to the window object. This value is incremented in the - // HTMLFrameElement implementation. - window._length = 0; - - // https://dom.spec.whatwg.org/#window-current-event - window._currentEvent = undefined; - - window._pretendToBeVisual = options.pretendToBeVisual; - window._storageQuota = options.storageQuota; - - // Some properties (such as localStorage and sessionStorage) share data - // between windows in the same origin. This object is intended - // to contain such data. - if (options.commonForOrigin && options.commonForOrigin[documentOrigin]) { - window._commonForOrigin = options.commonForOrigin; - } else { - window._commonForOrigin = { - [documentOrigin]: { - localStorageArea: new Map(), - sessionStorageArea: new Map(), - windowsInSameOrigin: [window] - } - }; - } - - window._currentOriginData = window._commonForOrigin[documentOrigin]; - - // ### WEB STORAGE - - window._localStorage = Storage.create(window, [], { - associatedWindow: window, - storageArea: window._currentOriginData.localStorageArea, - type: "localStorage", - url: window._document.documentURI, - storageQuota: window._storageQuota - }); - window._sessionStorage = Storage.create(window, [], { - associatedWindow: window, - storageArea: window._currentOriginData.sessionStorageArea, - type: "sessionStorage", - url: window._document.documentURI, - storageQuota: window._storageQuota - }); - - // ### SELECTION - - // https://w3c.github.io/selection-api/#dfn-selection - window._selection = Selection.createImpl(window); - - // https://w3c.github.io/selection-api/#dom-window - window.getSelection = function () { - return window._selection; - }; - - // ### GETTERS - - const locationbar = BarProp.create(window); - const menubar = BarProp.create(window); - const personalbar = BarProp.create(window); - const scrollbars = BarProp.create(window); - const statusbar = BarProp.create(window); - const toolbar = BarProp.create(window); - const external = External.create(window); - const navigator = Navigator.create(window); - const performanceImpl = Performance.create(window, [], { - timeOrigin: performance.timeOrigin + windowInitialized, - nowAtTimeOrigin: windowInitialized - }); - const screen = Screen.create(window); - const crypto = Crypto.create(window); - window._customElementRegistry = CustomElementRegistry.create(window); - - let status = ""; - - define(window, { - name: "", - get status() { - return status; - }, - set status(value) { - status = webIDLConversions.DOMString(value); - }, - get devicePixelRatio() { - return 1; - }, - get innerWidth() { - return 1024; - }, - get innerHeight() { - return 768; - }, - get outerWidth() { - return 1024; - }, - get outerHeight() { - return 768; - }, - get pageXOffset() { - return 0; - }, - get pageYOffset() { - return 0; - }, - get screenX() { - return 0; - }, - get screenLeft() { - return 0; - }, - get screenY() { - return 0; - }, - get screenTop() { - return 0; - }, - get scrollX() { - return 0; - }, - get scrollY() { - return 0; - }, - get length() { - return window._length; - }, - get window() { - return window._globalProxy; - }, - get frameElement() { - return idlUtils.wrapperForImpl(window._frameElement); - }, - get frames() { - return window._globalProxy; - }, - get self() { - return window._globalProxy; - }, - get parent() { - return window._parent; - }, - get top() { - return window._top; - }, - get document() { - return window._document; - }, - get external() { - return external; - }, - get location() { - return idlUtils.wrapperForImpl(idlUtils.implForWrapper(window._document)._location); - }, - // [PutForwards=href]: - set location(value) { - Reflect.set(window.location, "href", value); - }, - get history() { - return idlUtils.wrapperForImpl(idlUtils.implForWrapper(window._document)._history); - }, - get navigator() { - return navigator; - }, - get locationbar() { - return locationbar; - }, - get menubar() { - return menubar; - }, - get personalbar() { - return personalbar; - }, - get scrollbars() { - return scrollbars; - }, - get statusbar() { - return statusbar; - }, - get toolbar() { - return toolbar; - }, - get performance() { - return performanceImpl; - }, - get screen() { - return screen; - }, - get crypto() { - return crypto; - }, - get origin() { - return window._origin; - }, - get localStorage() { - if (idlUtils.implForWrapper(window._document)._origin === "null") { - throw DOMException.create(window, [ - "localStorage is not available for opaque origins", - "SecurityError" - ]); - } - - return window._localStorage; - }, - get sessionStorage() { - if (idlUtils.implForWrapper(window._document)._origin === "null") { - throw DOMException.create(window, [ - "sessionStorage is not available for opaque origins", - "SecurityError" - ]); - } - - return window._sessionStorage; - }, - get customElements() { - return window._customElementRegistry; - }, - get event() { - return window._currentEvent ? idlUtils.wrapperForImpl(window._currentEvent) : undefined; - } - }); - - Object.defineProperties(window, { - // [Replaceable]: - self: makeReplaceablePropertyDescriptor("self", window), - locationbar: makeReplaceablePropertyDescriptor("locationbar", window), - menubar: makeReplaceablePropertyDescriptor("menubar", window), - personalbar: makeReplaceablePropertyDescriptor("personalbar", window), - scrollbars: makeReplaceablePropertyDescriptor("scrollbars", window), - statusbar: makeReplaceablePropertyDescriptor("statusbar", window), - toolbar: makeReplaceablePropertyDescriptor("toolbar", window), - frames: makeReplaceablePropertyDescriptor("frames", window), - parent: makeReplaceablePropertyDescriptor("parent", window), - external: makeReplaceablePropertyDescriptor("external", window), - length: makeReplaceablePropertyDescriptor("length", window), - screen: makeReplaceablePropertyDescriptor("screen", window), - origin: makeReplaceablePropertyDescriptor("origin", window), - event: makeReplaceablePropertyDescriptor("event", window), - innerWidth: makeReplaceablePropertyDescriptor("innerWidth", window), - innerHeight: makeReplaceablePropertyDescriptor("innerHeight", window), - scrollX: makeReplaceablePropertyDescriptor("scrollX", window), - pageXOffset: makeReplaceablePropertyDescriptor("pageXOffset", window), - scrollY: makeReplaceablePropertyDescriptor("scrollY", window), - pageYOffset: makeReplaceablePropertyDescriptor("pageYOffset", window), - screenX: makeReplaceablePropertyDescriptor("screenX", window), - screenLeft: makeReplaceablePropertyDescriptor("screenLeft", window), - screenY: makeReplaceablePropertyDescriptor("screenY", window), - screenTop: makeReplaceablePropertyDescriptor("screenTop", window), - outerWidth: makeReplaceablePropertyDescriptor("outerWidth", window), - outerHeight: makeReplaceablePropertyDescriptor("outerHeight", window), - devicePixelRatio: makeReplaceablePropertyDescriptor("devicePixelRatio", window), - - // [LegacyUnforgeable]: - window: { configurable: false }, - document: { configurable: false }, - location: { configurable: false }, - top: { configurable: false } - }); - - - // ### METHODS - - // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers - - // In the spec the list of active timers is a set of IDs. We make it a map of IDs to Node.js timer objects, so that - // we can call Node.js-side clearTimeout() when clearing, and thus allow process shutdown faster. - const listOfActiveTimers = new Map(); - let latestTimerId = 0; - - window.setTimeout = function (handler, timeout = 0, ...args) { - if (typeof handler !== "function") { - handler = webIDLConversions.DOMString(handler); - } - timeout = webIDLConversions.long(timeout); - - return timerInitializationSteps(handler, timeout, args, { methodContext: window, repeat: false }); - }; - window.setInterval = function (handler, timeout = 0, ...args) { - if (typeof handler !== "function") { - handler = webIDLConversions.DOMString(handler); - } - timeout = webIDLConversions.long(timeout); - - return timerInitializationSteps(handler, timeout, args, { methodContext: window, repeat: true }); - }; - - window.clearTimeout = function (handle = 0) { - handle = webIDLConversions.long(handle); - - const nodejsTimer = listOfActiveTimers.get(handle); - if (nodejsTimer) { - clearTimeout(nodejsTimer); - listOfActiveTimers.delete(handle); - } - }; - window.clearInterval = function (handle = 0) { - handle = webIDLConversions.long(handle); - - const nodejsTimer = listOfActiveTimers.get(handle); - if (nodejsTimer) { - // We use setTimeout() in timerInitializationSteps even for window.setInterval(). - clearTimeout(nodejsTimer); - listOfActiveTimers.delete(handle); - } - }; - - function timerInitializationSteps(handler, timeout, args, { methodContext, repeat, previousHandle }) { - // This appears to be unspecced, but matches browser behavior for close()ed windows. - if (!methodContext._document) { - return 0; - } - - // TODO: implement timer nesting level behavior. - - const methodContextProxy = methodContext._globalProxy; - const handle = previousHandle !== undefined ? previousHandle : ++latestTimerId; - - function task() { - if (!listOfActiveTimers.has(handle)) { - return; - } - - try { - if (typeof handler === "function") { - handler.apply(methodContextProxy, args); - } else if (window._runScripts === "dangerously") { - vm.runInContext(handler, window, { filename: window.location.href, displayErrors: false }); - } - } catch (e) { - reportException(window, e, window.location.href); - } - - if (listOfActiveTimers.has(handle)) { - if (repeat) { - timerInitializationSteps(handler, timeout, args, { methodContext, repeat: true, previousHandle: handle }); - } else { - listOfActiveTimers.delete(handle); - } - } - } - - if (timeout < 0) { - timeout = 0; - } - - const nodejsTimer = setTimeout(task, timeout); - listOfActiveTimers.set(handle, nodejsTimer); - - return handle; - } - - // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing - - window.queueMicrotask = function (callback) { - callback = IDLFunction.convert(window, callback); - - queueMicrotask(() => { - try { - callback(); - } catch (e) { - reportException(window, e, window.location.href); - } - }); - }; - - // https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames - - let animationFrameCallbackId = 0; - const mapOfAnimationFrameCallbacks = new Map(); - let animationFrameNodejsInterval = null; - - // Unlike the spec, where an animation frame happens every 60 Hz regardless, we optimize so that if there are no - // requestAnimationFrame() calls outstanding, we don't fire the timer. This helps us track that. - let numberOfOngoingAnimationFrameCallbacks = 0; - - if (window._pretendToBeVisual) { - window.requestAnimationFrame = function (callback) { - callback = IDLFunction.convert(window, callback); - - const handle = ++animationFrameCallbackId; - mapOfAnimationFrameCallbacks.set(handle, callback); - - ++numberOfOngoingAnimationFrameCallbacks; - if (numberOfOngoingAnimationFrameCallbacks === 1) { - animationFrameNodejsInterval = setInterval(() => { - runAnimationFrameCallbacks(performance.now() - windowInitialized); - }, 1000 / 60); - } - - return handle; - }; - - window.cancelAnimationFrame = function (handle) { - handle = webIDLConversions["unsigned long"](handle); - - removeAnimationFrameCallback(handle); - }; - - function runAnimationFrameCallbacks(now) { - // Converting to an array is important to get a sync snapshot and thus match spec semantics. - const callbackHandles = [...mapOfAnimationFrameCallbacks.keys()]; - for (const handle of callbackHandles) { - // This has() can be false if a callback calls cancelAnimationFrame(). - if (mapOfAnimationFrameCallbacks.has(handle)) { - const callback = mapOfAnimationFrameCallbacks.get(handle); - removeAnimationFrameCallback(handle); - try { - callback(now); - } catch (e) { - reportException(window, e, window.location.href); - } - } - } - } - - function removeAnimationFrameCallback(handle) { - if (mapOfAnimationFrameCallbacks.has(handle)) { - --numberOfOngoingAnimationFrameCallbacks; - if (numberOfOngoingAnimationFrameCallbacks === 0) { - clearInterval(animationFrameNodejsInterval); - } - } - - mapOfAnimationFrameCallbacks.delete(handle); - } - } - - function stopAllTimers() { - for (const nodejsTimer of listOfActiveTimers.values()) { - clearTimeout(nodejsTimer); - } - listOfActiveTimers.clear(); - - clearInterval(animationFrameNodejsInterval); - } - - function Option(text, value, defaultSelected, selected) { - if (text === undefined) { - text = ""; - } - text = webIDLConversions.DOMString(text); - - if (value !== undefined) { - value = webIDLConversions.DOMString(value); - } - - defaultSelected = webIDLConversions.boolean(defaultSelected); - selected = webIDLConversions.boolean(selected); - - const option = window._document.createElement("option"); - const impl = idlUtils.implForWrapper(option); - - if (text !== "") { - impl.text = text; - } - if (value !== undefined) { - impl.setAttributeNS(null, "value", value); - } - if (defaultSelected) { - impl.setAttributeNS(null, "selected", ""); - } - impl._selectedness = selected; - - return option; - } - Object.defineProperty(Option, "prototype", { - value: window.HTMLOptionElement.prototype, - configurable: false, - enumerable: false, - writable: false - }); - Object.defineProperty(window, "Option", { - value: Option, - configurable: true, - enumerable: false, - writable: true - }); - - function Image(...args) { - const img = window._document.createElement("img"); - const impl = idlUtils.implForWrapper(img); - - if (args.length > 0) { - impl.setAttributeNS(null, "width", String(args[0])); - } - if (args.length > 1) { - impl.setAttributeNS(null, "height", String(args[1])); - } - - return img; - } - Object.defineProperty(Image, "prototype", { - value: window.HTMLImageElement.prototype, - configurable: false, - enumerable: false, - writable: false - }); - Object.defineProperty(window, "Image", { - value: Image, - configurable: true, - enumerable: false, - writable: true - }); - - function Audio(src) { - const audio = window._document.createElement("audio"); - const impl = idlUtils.implForWrapper(audio); - impl.setAttributeNS(null, "preload", "auto"); - - if (src !== undefined) { - impl.setAttributeNS(null, "src", String(src)); - } - - return audio; - } - Object.defineProperty(Audio, "prototype", { - value: window.HTMLAudioElement.prototype, - configurable: false, - enumerable: false, - writable: false - }); - Object.defineProperty(window, "Audio", { - value: Audio, - configurable: true, - enumerable: false, - writable: true - }); - - window.postMessage = function (message, targetOrigin) { - if (arguments.length < 2) { - throw new TypeError("'postMessage' requires 2 arguments: 'message' and 'targetOrigin'"); - } - - targetOrigin = webIDLConversions.DOMString(targetOrigin); - - if (targetOrigin === "/") { - // TODO: targetOrigin === "/" requires getting incumbent settings object. - // Maybe could be done with Error stack traces?? - return; - } else if (targetOrigin !== "*") { - const parsedURL = whatwgURL.parseURL(targetOrigin); - if (parsedURL === null) { - throw DOMException.create(window, [ - "Failed to execute 'postMessage' on 'Window': " + - "Invalid target origin '" + targetOrigin + "' in a call to 'postMessage'.", - "SyntaxError" - ]); - } - targetOrigin = whatwgURL.serializeURLOrigin(parsedURL); - - if (targetOrigin !== idlUtils.implForWrapper(window._document)._origin) { - // Not implemented. - return; - } - } - - // TODO: event.source - requires reference to incumbent window - // TODO: event.origin - requires reference to incumbent window - // TODO: event.ports - // TODO: event.data - requires structured cloning - setTimeout(() => { - fireAnEvent("message", window, MessageEvent, { data: message }); - }, 0); - }; - - window.atob = function (str) { - try { - return atob(str); - } catch { - // Convert Node.js DOMException to one from our global. - throw DOMException.create(window, [ - "The string to be decoded contains invalid characters.", - "InvalidCharacterError" - ]); - } - }; - - window.btoa = function (str) { - try { - return btoa(str); - } catch { - // Convert Node.js DOMException to one from our global. - throw DOMException.create(window, [ - "The string to be encoded contains invalid characters.", - "InvalidCharacterError" - ]); - } - }; - - window.stop = function () { - const manager = idlUtils.implForWrapper(window._document)._requestManager; - if (manager) { - manager.close(); - } - }; - - window.close = function () { - // Recursively close child frame windows, then ourselves (depth-first). - for (let i = 0; i < window.length; ++i) { - window[i].close?.(); - } - - // Clear out all listeners. Any in-flight or upcoming events should not get delivered. - idlUtils.implForWrapper(window)._eventListeners = Object.create(null); - - if (window._document) { - if (window._document.body) { - window._document.body.innerHTML = ""; - } - - if (window._document.close) { - // It's especially important to clear out the listeners here because document.close() causes a "load" event to - // fire. - idlUtils.implForWrapper(window._document)._eventListeners = Object.create(null); - window._document.close(); - } - const doc = idlUtils.implForWrapper(window._document); - if (doc._requestManager) { - doc._requestManager.close(); - } - delete window._document; - } - - stopAllTimers(); - WebSocketImpl.cleanUpWindow(window); - }; - - window.getComputedStyle = function (elt, pseudoElt = undefined) { - elt = Element.convert(window, elt); - if (pseudoElt !== undefined && pseudoElt !== null) { - pseudoElt = webIDLConversions.DOMString(pseudoElt); - } - - if (pseudoElt !== undefined && pseudoElt !== null && pseudoElt !== "") { - // TODO: Parse pseudoElt - - if (SHADOW_DOM_PSEUDO_REGEXP.test(pseudoElt)) { - throw new TypeError("Tried to get the computed style of a Shadow DOM pseudo-element."); - } - - notImplementedMethod(window, "Window", "getComputedStyle", "with pseudo-elements"); - } - - const declaration = new CSSStyleDeclaration(); - const { forEach } = Array.prototype; - - const elementDeclaration = getDeclarationForElement(elt); - forEach.call(elementDeclaration, property => { - declaration.setProperty( - property, - elementDeclaration.getPropertyValue(property), - elementDeclaration.getPropertyPriority(property) - ); - }); - - // https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle - const declarations = Object.keys(propertiesWithResolvedValueImplemented); - forEach.call(declarations, property => { - declaration.setProperty(property, getResolvedValue(elt, property)); - }); - - return declaration; - }; - - window.getSelection = function () { - return window._document.getSelection(); - }; - - // The captureEvents() and releaseEvents() methods must do nothing - window.captureEvents = function () {}; - - window.releaseEvents = function () {}; - - // ### PUBLIC DATA PROPERTIES (TODO: should be getters) - - function wrapConsoleMethod(method) { - return (...args) => { - window._virtualConsole.emit(method, ...args); - }; - } - - window.console = { - assert: wrapConsoleMethod("assert"), - clear: wrapConsoleMethod("clear"), - count: wrapConsoleMethod("count"), - countReset: wrapConsoleMethod("countReset"), - debug: wrapConsoleMethod("debug"), - dir: wrapConsoleMethod("dir"), - dirxml: wrapConsoleMethod("dirxml"), - error: wrapConsoleMethod("error"), - group: wrapConsoleMethod("group"), - groupCollapsed: wrapConsoleMethod("groupCollapsed"), - groupEnd: wrapConsoleMethod("groupEnd"), - info: wrapConsoleMethod("info"), - log: wrapConsoleMethod("log"), - table: wrapConsoleMethod("table"), - time: wrapConsoleMethod("time"), - timeLog: wrapConsoleMethod("timeLog"), - timeEnd: wrapConsoleMethod("timeEnd"), - trace: wrapConsoleMethod("trace"), - warn: wrapConsoleMethod("warn") - }; - - function notImplementedMethodWrapper(name) { - return function () { - notImplementedMethod(window, "Window", name); - }; - } - - define(window, { - alert: notImplementedMethodWrapper("alert"), - blur: notImplementedMethodWrapper("blur"), - confirm: notImplementedMethodWrapper("confirm"), - focus: notImplementedMethodWrapper("focus"), - moveBy: notImplementedMethodWrapper("moveBy"), - moveTo: notImplementedMethodWrapper("moveTo"), - open: notImplementedMethodWrapper("open"), - print: notImplementedMethodWrapper("print"), - prompt: notImplementedMethodWrapper("prompt"), - resizeBy: notImplementedMethodWrapper("resizeBy"), - resizeTo: notImplementedMethodWrapper("resizeTo"), - scroll: notImplementedMethodWrapper("scroll"), - scrollBy: notImplementedMethodWrapper("scrollBy"), - scrollTo: notImplementedMethodWrapper("scrollTo") - }); -} - -function makeReplaceablePropertyDescriptor(property, window) { - const desc = { - set(value) { - Object.defineProperty(window, property, { - configurable: true, - enumerable: true, - writable: true, - value - }); - } - }; - - Object.defineProperty(desc.set, "name", { value: `set ${property}` }); - return desc; -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/default-stylesheet.css b/vanilla/node_modules/jsdom/lib/jsdom/browser/default-stylesheet.css deleted file mode 100644 index e412348..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/default-stylesheet.css +++ /dev/null @@ -1,415 +0,0 @@ -/* Omitting the below because of https://github.com/jsdom/cssstyle/issues/193. - And we don't implement namespace constraints anyway. - -@namespace "http://www.w3.org/1999/xhtml"; -*/ - -/* https://html.spec.whatwg.org/multipage/rendering.html#the-page */ - -html, body { display: block; } - -/* https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3 - - Omits presentational hints - - Omits quirks mode -*/ - -address, blockquote, center, dialog, div, figure, figcaption, footer, form, -header, hr, legend, listing, main, p, plaintext, pre, search, xmp { - display: block; -} - -blockquote, figure, listing, p, plaintext, pre, xmp { - margin-block: 1em; -} - -blockquote, figure { margin-inline: 40px; } - -address { font-style: italic; } -listing, plaintext, pre, xmp { - font-family: monospace; white-space: pre; -} - -dialog:not([open]) { display: none; } -dialog { - position: absolute; - inset-inline-start: 0; inset-inline-end: 0; - width: fit-content; - height: fit-content; - margin: auto; - border: solid; - padding: 1em; - background-color: Canvas; - color: CanvasText; -} -dialog:modal { - position: fixed; - overflow: auto; - inset-block: 0; - max-width: calc(100% - 6px - 2em); - max-height: calc(100% - 6px - 2em); -} -dialog::backdrop { - background: rgba(0,0,0,0.1); -} - -[popover]:not(:popover-open):not(dialog[open]) { - display:none; -} - -dialog:popover-open { - display:block; -} - -[popover] { - position: fixed; - inset: 0; - width: fit-content; - height: fit-content; - margin: auto; - border: solid; - padding: 0.25em; - overflow: auto; - color: CanvasText; - background-color: Canvas; -} - -:popover-open::backdrop { - position: fixed; - inset: 0; - pointer-events: none !important; - background-color: transparent; -} - -slot { - display: contents; -} - -/* https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3 - - Omits presentational hints -*/ - - -cite, dfn, em, i, var { font-style: italic; } -b, strong { font-weight: bolder; } -code, kbd, samp, tt { font-family: monospace; } -big { font-size: larger; } -small { font-size: smaller; } - -sub { vertical-align: sub; } -sup { vertical-align: super; } -sub, sup { line-height: normal; font-size: smaller; } - -ruby { display: ruby; } -rt { display: ruby-text; } - -:link { color: #0000EE; } -:visited { color: #551A8B; } -:link:active, :visited:active { color: #FF0000; } -:link, :visited { text-decoration: underline; cursor: pointer; } - -:focus-visible { outline: auto; } - -mark { background: yellow; color: black; } /* this color is just a suggestion and can be changed based on implementation feedback */ - -abbr[title], acronym[title] { text-decoration: dotted underline; } -ins, u { text-decoration: underline; } -del, s, strike { text-decoration: line-through; } - -q::before { content: open-quote; } -q::after { content: close-quote; } - -br { display-outside: newline; } /* this also has bidi implications */ -nobr { white-space: nowrap; } -wbr { display-outside: break-opportunity; } /* this also has bidi implications */ -nobr wbr { white-space: normal; } - -/* https://html.spec.whatwg.org/multipage/rendering.html#bidi-rendering - - Omits ISO-8859-8 -*/ - -[dir]:dir(ltr), bdi:dir(ltr), input[type=tel i]:dir(ltr) { direction: ltr; } -[dir]:dir(rtl), bdi:dir(rtl) { direction: rtl; } - -address, blockquote, center, div, figure, figcaption, footer, form, header, hr, -legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2, -h3, h4, h5, h6, hgroup, nav, section, search, table, caption, colgroup, col, -thead, tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output, -[dir=ltr i], [dir=rtl i], [dir=auto i] { - unicode-bidi: isolate; -} - -bdo, bdo[dir] { unicode-bidi: isolate-override; } - -input[dir=auto i]:is([type=search i], [type=tel i], [type=url i], -[type=email i]), textarea[dir=auto i], pre[dir=auto i] { - unicode-bidi: plaintext; -} -/* see prose for input elements whose type attribute is in the Text state */ - -/* the rules setting the 'content' property on br and wbr elements also has bidi implications */ - -/* https://html.spec.whatwg.org/multipage/rendering.html#sections-and-headings - - Special h1 styles removed per upcoming change: https://github.com/whatwg/html/pull/11102 -*/ - -article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section { - display: block; -} - -h1 { margin-block: 0.67em; font-size: 2.00em; font-weight: bold; } -h2 { margin-block: 0.83em; font-size: 1.50em; font-weight: bold; } -h3 { margin-block: 1.00em; font-size: 1.17em; font-weight: bold; } -h4 { margin-block: 1.33em; font-size: 1.00em; font-weight: bold; } -h5 { margin-block: 1.67em; font-size: 0.83em; font-weight: bold; } -h6 { margin-block: 2.33em; font-size: 0.67em; font-weight: bold; } - -/* https://html.spec.whatwg.org/multipage/rendering.html#lists - - Omit presentational hints - - Omit quirks mode -*/ - -dir, dd, dl, dt, menu, ol, ul { display: block; } -li { display: list-item; text-align: match-parent; } - -dir, dl, menu, ol, ul { margin-block: 1em; } - -:is(dir, dl, menu, ol, ul) :is(dir, dl, menu, ol, ul) { - margin-block: 0; -} - -dd { margin-inline-start: 40px; } -dir, menu, ol, ul { padding-inline-start: 40px; } - -ol, ul, menu { counter-reset: list-item; } -ol { list-style-type: decimal; } - -dir, menu, ul { - list-style-type: disc; -} -:is(dir, menu, ol, ul) :is(dir, menu, ul) { - list-style-type: circle; -} -:is(dir, menu, ol, ul) :is(dir, menu, ol, ul) :is(dir, menu, ul) { - list-style-type: square; -} - -/* https://html.spec.whatwg.org/multipage/rendering.html#tables-2 - - Omit presentational hints - - Omit quirks mode - - Omit HTML documents -*/ - -table { display: table; } -caption { display: table-caption; } -colgroup, colgroup[hidden] { display: table-column-group; } -col, col[hidden] { display: table-column; } -thead, thead[hidden] { display: table-header-group; } -tbody, tbody[hidden] { display: table-row-group; } -tfoot, tfoot[hidden] { display: table-footer-group; } -tr, tr[hidden] { display: table-row; } -td, th { display: table-cell; } - -colgroup[hidden], col[hidden], thead[hidden], tbody[hidden], -tfoot[hidden], tr[hidden] { - visibility: collapse; -} - -table { - box-sizing: border-box; - border-spacing: 2px; - border-collapse: separate; - text-indent: initial; -} -td, th { padding: 1px; } -th { font-weight: bold; } - -caption { text-align: center; } -thead, tbody, tfoot, table > tr { vertical-align: middle; } -tr, td, th { vertical-align: inherit; } - -thead, tbody, tfoot, tr { border-color: inherit; } -table[rules=none i], table[rules=groups i], table[rules=rows i], -table[rules=cols i], table[rules=all i], table[frame=void i], -table[frame=above i], table[frame=below i], table[frame=hsides i], -table[frame=lhs i], table[frame=rhs i], table[frame=vsides i], -table[frame=box i], table[frame=border i], -table[rules=none i] > tr > td, table[rules=none i] > tr > th, -table[rules=groups i] > tr > td, table[rules=groups i] > tr > th, -table[rules=rows i] > tr > td, table[rules=rows i] > tr > th, -table[rules=cols i] > tr > td, table[rules=cols i] > tr > th, -table[rules=all i] > tr > td, table[rules=all i] > tr > th, -table[rules=none i] > thead > tr > td, table[rules=none i] > thead > tr > th, -table[rules=groups i] > thead > tr > td, table[rules=groups i] > thead > tr > th, -table[rules=rows i] > thead > tr > td, table[rules=rows i] > thead > tr > th, -table[rules=cols i] > thead > tr > td, table[rules=cols i] > thead > tr > th, -table[rules=all i] > thead > tr > td, table[rules=all i] > thead > tr > th, -table[rules=none i] > tbody > tr > td, table[rules=none i] > tbody > tr > th, -table[rules=groups i] > tbody > tr > td, table[rules=groups i] > tbody > tr > th, -table[rules=rows i] > tbody > tr > td, table[rules=rows i] > tbody > tr > th, -table[rules=cols i] > tbody > tr > td, table[rules=cols i] > tbody > tr > th, -table[rules=all i] > tbody > tr > td, table[rules=all i] > tbody > tr > th, -table[rules=none i] > tfoot > tr > td, table[rules=none i] > tfoot > tr > th, -table[rules=groups i] > tfoot > tr > td, table[rules=groups i] > tfoot > tr > th, -table[rules=rows i] > tfoot > tr > td, table[rules=rows i] > tfoot > tr > th, -table[rules=cols i] > tfoot > tr > td, table[rules=cols i] > tfoot > tr > th, -table[rules=all i] > tfoot > tr > td, table[rules=all i] > tfoot > tr > th { - border-color: black; -} - -/* https://html.spec.whatwg.org/multipage/rendering.html#form-controls - - Omit quirks mode -*/ - -input, select, button, textarea { - letter-spacing: initial; - word-spacing: initial; - line-height: initial; - text-transform: initial; - text-indent: initial; - text-shadow: initial; - appearance: auto; -} - -input:not([type=image i], [type=range i], [type=checkbox i], [type=radio i]) { - overflow: clip !important; - overflow-clip-margin: 0 !important; -} - -input, select, textarea { - text-align: initial; -} - -:autofill { - field-sizing: fixed !important; -} - -input:is([type=reset i], [type=button i], [type=submit i]), button { - text-align: center; -} - -input, button { - display: inline-block; -} - -input[type=hidden i], input[type=file i], input[type=image i] { - appearance: none; -} - -input:is([type=radio i], [type=checkbox i], [type=reset i], [type=button i], -[type=submit i], [type=color i], [type=search i]), select, button { - box-sizing: border-box; -} - -textarea { white-space: pre-wrap; } - -/* https://html.spec.whatwg.org/multipage/rendering.html#the-hr-element-2 - - Omit presentational hints -*/ - -hr { - color: gray; - border-style: inset; - border-width: 1px; - margin-block: 0.5em; - margin-inline: auto; - overflow: hidden; -} - -/* https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements */ - -fieldset { - display: block; - margin-inline: 2px; - border: groove 2px ThreeDFace; - padding-block: 0.35em 0.625em; - padding-inline: 0.75em; - min-inline-size: min-content; -} - -legend { - padding-inline: 2px; -} - -legend[align=left i] { - justify-self: left; -} - -legend[align=center i] { - justify-self: center; -} - -legend[align=right i] { - justify-self: right; -} - -/* https://html.spec.whatwg.org/multipage/rendering.html#embedded-content-rendering-rules */ - -iframe { border: 2px inset; } -video { object-fit: contain; } - -/* https://html.spec.whatwg.org/multipage/rendering.html#images-3 -- Omit quirks mode -*/ - -img:is([sizes="auto" i], [sizes^="auto," i]) { - contain: size !important; - contain-intrinsic-size: 300px 150px; -} - -/* https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements -- Omit internal shadow tree styles -*/ - -details, summary { - display: block; -} -details > summary:first-of-type { - display: list-item; - counter-increment: list-item 0; - list-style: disclosure-closed inside; -} -details[open] > summary:first-of-type { - list-style-type: disclosure-open; -} - -/* https://html.spec.whatwg.org/multipage/rendering.html#the-marquee-element-2 */ - -marquee { - display: inline-block; - text-align: initial; - overflow: hidden !important; -} - -/* https://html.spec.whatwg.org/multipage/rendering.html#the-meter-element-2 */ - -meter { appearance: auto; } - -/* https://html.spec.whatwg.org/multipage/rendering.html#the-progress-element-2 */ - -progress { appearance: auto; } - -/* https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements -- Moved to the bottom because our lack of specificity support causes tag name `display: block` and the below [hidden] - `display: none` to be last-one-wins. -*/ - -area, base, basefont, datalist, head, link, meta, noembed, -noframes, param, rp, script, style, template, title { - display: none; -} - -[hidden]:not([hidden=until-found i]):not(embed) { - display: none; -} - -[hidden=until-found i]:not(embed) { - content-visibility: hidden; -} - -embed[hidden] { display: inline; height: 0; width: 0; } - -input[type=hidden i] { display: none !important; } - -@media (scripting) { - noscript { display: none !important; } -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/js-globals.json b/vanilla/node_modules/jsdom/lib/jsdom/browser/js-globals.json deleted file mode 100644 index 14ee04a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/js-globals.json +++ /dev/null @@ -1,332 +0,0 @@ -{ - "Object": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Function": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Number": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "parseFloat": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "parseInt": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Infinity": { - "writable": false, - "enumerable": false, - "configurable": false - }, - "NaN": { - "writable": false, - "enumerable": false, - "configurable": false - }, - "undefined": { - "writable": false, - "enumerable": false, - "configurable": false - }, - "Boolean": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "String": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Symbol": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Date": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Promise": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "RegExp": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Error": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "AggregateError": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "EvalError": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "RangeError": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "ReferenceError": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "SyntaxError": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "TypeError": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "URIError": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "globalThis": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "JSON": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Math": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Intl": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "ArrayBuffer": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Atomics": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Uint8Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Int8Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Uint16Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Int16Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Uint32Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Int32Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "BigUint64Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "BigInt64Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Uint8ClampedArray": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Float32Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Float64Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "DataView": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Map": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "BigInt": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Set": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Iterator": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "WeakMap": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "WeakSet": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Proxy": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Reflect": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "FinalizationRegistry": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "WeakRef": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "decodeURI": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "decodeURIComponent": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "encodeURI": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "encodeURIComponent": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "escape": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "unescape": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "eval": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "isFinite": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "isNaN": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "SuppressedError": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "DisposableStack": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "AsyncDisposableStack": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "Float16Array": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "SharedArrayBuffer": { - "writable": true, - "enumerable": false, - "configurable": true - }, - "WebAssembly": { - "writable": true, - "enumerable": false, - "configurable": true - } -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/not-implemented.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/not-implemented.js deleted file mode 100644 index 42204b8..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/not-implemented.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -exports.notImplementedMethod = (window, className, methodName, specialCircumstances) => { - exports.notImplemented( - window, - `${className}'s ${methodName}() method${specialCircumstances ? `: ${specialCircumstances}` : ""}` - ); -}; - -exports.notImplemented = (window, message) => { - if (!window) { - // Do nothing for window-less documents. - return; - } - - const error = new Error(`Not implemented: ${message}`); - error.type = "not-implemented"; - - window._virtualConsole.emit("jsdomError", error); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/parser/html.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/parser/html.js deleted file mode 100644 index f41bf02..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/parser/html.js +++ /dev/null @@ -1,208 +0,0 @@ -"use strict"; - -const parse5 = require("parse5"); - -const { createElement } = require("../../living/helpers/create-element"); -const { HTML_NS } = require("../../living/helpers/namespaces"); - -const DocumentType = require("../../living/generated/DocumentType"); -const DocumentFragment = require("../../living/generated/DocumentFragment"); -const Text = require("../../living/generated/Text"); -const Comment = require("../../living/generated/Comment"); - -const attributes = require("../../living/attributes"); -const nodeTypes = require("../../living/node-type"); - -const serializationAdapter = require("../../living/domparsing/parse5-adapter-serialization"); -const { - customElementReactionsStack, invokeCEReactions, lookupCEDefinition -} = require("../../living/helpers/custom-elements"); - - -class JSDOMParse5Adapter { - constructor(documentImpl, options = {}) { - this._documentImpl = documentImpl; - this._globalObject = documentImpl._globalObject; - this._fragment = options.fragment || false; - - // Since the createElement hook doesn't provide the parent element, we keep track of this using _currentElement: - // https://github.com/inikulin/parse5/issues/285. - this._currentElement = undefined; - } - - _ownerDocument() { - const { _currentElement } = this; - - // The _currentElement is undefined when parsing elements at the root of the document. - if (_currentElement) { - return _currentElement.localName === "template" && _currentElement.namespaceURI === HTML_NS ? - _currentElement.content._ownerDocument : - _currentElement._ownerDocument; - } - - return this._documentImpl; - } - - createDocument() { - // parse5's model assumes that parse(html) will call into here to create the new Document, then return it. However, - // jsdom's model assumes we can create a Window (and through that create an empty Document), do some other setup - // stuff, and then parse, stuffing nodes into that Document as we go. So to adapt between these two models, we just - // return the already-created Document when asked by parse5 to "create" a Document. - return this._documentImpl; - } - - createDocumentFragment() { - const ownerDocument = this._ownerDocument(); - return DocumentFragment.createImpl(this._globalObject, [], { ownerDocument }); - } - - // https://html.spec.whatwg.org/#create-an-element-for-the-token - createElement(localName, namespace, attrs) { - const ownerDocument = this._ownerDocument(); - - const isAttribute = attrs.find(attr => attr.name === "is"); - const isValue = isAttribute ? isAttribute.value : null; - - const definition = lookupCEDefinition(ownerDocument, namespace, localName); - - let willExecuteScript = false; - if (definition !== null && !this._fragment) { - willExecuteScript = true; - } - - if (willExecuteScript) { - ownerDocument._throwOnDynamicMarkupInsertionCounter++; - customElementReactionsStack.push([]); - } - - const element = createElement(ownerDocument, localName, namespace, null, isValue, willExecuteScript); - this.adoptAttributes(element, attrs); - - if (willExecuteScript) { - const queue = customElementReactionsStack.pop(); - invokeCEReactions(queue); - ownerDocument._throwOnDynamicMarkupInsertionCounter--; - } - - if ("_parserInserted" in element) { - element._parserInserted = true; - } - - return element; - } - - createCommentNode(data) { - const ownerDocument = this._ownerDocument(); - return Comment.createImpl(this._globalObject, [], { data, ownerDocument }); - } - - appendChild(parentNode, newNode) { - parentNode._append(newNode); - } - - insertBefore(parentNode, newNode, referenceNode) { - parentNode._insert(newNode, referenceNode); - } - - setTemplateContent(templateElement, contentFragment) { - // This code makes the glue between jsdom and parse5 HTMLTemplateElement parsing: - // - // * jsdom during the construction of the HTMLTemplateElement (for example when create via - // `document.createElement("template")`), creates a DocumentFragment and set it into _templateContents. - // * parse5 when parsing a <template> tag creates an HTMLTemplateElement (`createElement` adapter hook) and also - // create a DocumentFragment (`createDocumentFragment` adapter hook). - // - // At this point we now have to replace the one created in jsdom with one created by parse5. - const { _ownerDocument, _host } = templateElement._templateContents; - contentFragment._ownerDocument = _ownerDocument; - contentFragment._host = _host; - - templateElement._templateContents = contentFragment; - } - - setDocumentType(document, name, publicId, systemId) { - const ownerDocument = this._ownerDocument(); - const documentType = DocumentType.createImpl(this._globalObject, [], { name, publicId, systemId, ownerDocument }); - - document._append(documentType); - } - - setDocumentMode(document, mode) { - // TODO: the rest of jsdom ignores this - document._mode = mode; - } - - detachNode(node) { - node.remove(); - } - - insertText(parentNode, text) { - const { lastChild } = parentNode; - if (lastChild && lastChild.nodeType === nodeTypes.TEXT_NODE) { - lastChild.data += text; - } else { - const ownerDocument = this._ownerDocument(); - const textNode = Text.createImpl(this._globalObject, [], { data: text, ownerDocument }); - parentNode._append(textNode); - } - } - - insertTextBefore(parentNode, text, referenceNode) { - const { previousSibling } = referenceNode; - if (previousSibling && previousSibling.nodeType === nodeTypes.TEXT_NODE) { - previousSibling.data += text; - } else { - const ownerDocument = this._ownerDocument(); - const textNode = Text.createImpl(this._globalObject, [], { data: text, ownerDocument }); - parentNode._append(textNode, referenceNode); - } - } - - adoptAttributes(element, attrs) { - for (const attr of attrs) { - const prefix = attr.prefix === "" ? null : attr.prefix; - attributes.setAttributeValue(element, attr.name, attr.value, prefix, attr.namespace); - } - } - - onItemPush(after) { - this._currentElement = after; - after._pushedOnStackOfOpenElements?.(); - } - - onItemPop(before, newTop) { - this._currentElement = newTop; - before._poppedOffStackOfOpenElements?.(); - } -} - -// Assign shared adapters with serializer. -Object.assign(JSDOMParse5Adapter.prototype, serializationAdapter); - -function parseFragment(markup, contextElement) { - const ownerDocument = contextElement.localName === "template" && contextElement.namespaceURI === HTML_NS ? - contextElement.content._ownerDocument : - contextElement._ownerDocument; - - const config = { - ...ownerDocument._parseOptions, - sourceCodeLocationInfo: false, - treeAdapter: new JSDOMParse5Adapter(ownerDocument, { fragment: true }) - }; - - return parse5.parseFragment(contextElement, markup, config); -} - -function parseIntoDocument(markup, ownerDocument) { - const config = { - ...ownerDocument._parseOptions, - treeAdapter: new JSDOMParse5Adapter(ownerDocument) - }; - - return parse5.parse(markup, config); -} - -module.exports = { - parseFragment, - parseIntoDocument -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/parser/index.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/parser/index.js deleted file mode 100644 index e09df95..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/parser/index.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -const xmlParser = require("./xml"); -const htmlParser = require("./html"); - -// https://w3c.github.io/DOM-Parsing/#dfn-fragment-parsing-algorithm -function parseFragment(markup, contextElement) { - const { _parsingMode } = contextElement._ownerDocument; - - let parseAlgorithm; - if (_parsingMode === "html") { - parseAlgorithm = htmlParser.parseFragment; - } else if (_parsingMode === "xml") { - parseAlgorithm = xmlParser.parseFragment; - } - - // Note: HTML and XML fragment parsing algorithm already return a document fragments; no need to do steps 3 and 4 - return parseAlgorithm(markup, contextElement); -} - -function parseIntoDocument(markup, ownerDocument) { - const { _parsingMode } = ownerDocument; - - let parseAlgorithm; - if (_parsingMode === "html") { - parseAlgorithm = htmlParser.parseIntoDocument; - } else if (_parsingMode === "xml") { - parseAlgorithm = xmlParser.parseIntoDocument; - } - - return parseAlgorithm(markup, ownerDocument); -} - -module.exports = { - parseFragment, - parseIntoDocument -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/parser/xml.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/parser/xml.js deleted file mode 100644 index b842466..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/parser/xml.js +++ /dev/null @@ -1,202 +0,0 @@ -"use strict"; - -const { SaxesParser } = require("saxes"); -const DOMException = require("../../living/generated/DOMException"); - -const { createElement } = require("../../living/helpers/create-element"); - -const DocumentFragment = require("../../living/generated/DocumentFragment"); -const DocumentType = require("../../living/generated/DocumentType"); -const CDATASection = require("../../living/generated/CDATASection"); -const Comment = require("../../living/generated/Comment"); -const ProcessingInstruction = require("../../living/generated/ProcessingInstruction"); -const Text = require("../../living/generated/Text"); - -const attributes = require("../../living/attributes"); -const { HTML_NS } = require("../../living/helpers/namespaces"); - -const HTML5_DOCTYPE = /<!doctype html>/i; -const PUBLIC_DOCTYPE = /<!doctype\s+([^\s]+)\s+public\s+"([^"]+)"\s+"([^"]+)"/i; -const SYSTEM_DOCTYPE = /<!doctype\s+([^\s]+)\s+system\s+"([^"]+)"/i; -const CUSTOM_NAME_DOCTYPE = /<!doctype\s+([^\s>]+)/i; - -function parseDocType(globalObject, ownerDocument, html) { - if (HTML5_DOCTYPE.test(html)) { - return createDocumentType(globalObject, ownerDocument, "html", "", ""); - } - - const publicPieces = PUBLIC_DOCTYPE.exec(html); - if (publicPieces) { - return createDocumentType(globalObject, ownerDocument, publicPieces[1], publicPieces[2], publicPieces[3]); - } - - const systemPieces = SYSTEM_DOCTYPE.exec(html); - if (systemPieces) { - return createDocumentType(globalObject, ownerDocument, systemPieces[1], "", systemPieces[2]); - } - - const namePiece = CUSTOM_NAME_DOCTYPE.exec(html)[1] || "html"; - return createDocumentType(globalObject, ownerDocument, namePiece, "", ""); -} - -function createDocumentType(globalObject, ownerDocument, name, publicId, systemId) { - return DocumentType.createImpl(globalObject, [], { ownerDocument, name, publicId, systemId }); -} - -function isHTMLTemplateElement(element) { - return element.tagName === "template" && element.namespaceURI === HTML_NS; -} - - -function createParser(rootNode, globalObject, saxesOptions) { - const parser = new SaxesParser({ - ...saxesOptions, - // Browsers always have namespace support. - xmlns: true, - // We force the parser to treat all documents (even documents declaring themselves to be XML 1.1 documents) as XML - // 1.0 documents. See https://github.com/jsdom/jsdom/issues/2677 for a discussion of the stakes. - defaultXMLVersion: "1.0", - forceXMLVersion: true - }); - const openStack = [rootNode]; - - function getOwnerDocument() { - const currentElement = openStack[openStack.length - 1]; - - return isHTMLTemplateElement(currentElement) ? - currentElement._templateContents._ownerDocument : - currentElement._ownerDocument; - } - - function appendChild(child) { - const parentElement = openStack[openStack.length - 1]; - - if (isHTMLTemplateElement(parentElement)) { - parentElement._templateContents._insert(child, null); - } else { - parentElement._insert(child, null); - } - } - - parser.on("text", saxesOptions.fragment ? - // In a fragment, all text events produced by saxes must result in a text - // node. - data => { - const ownerDocument = getOwnerDocument(); - appendChild(Text.createImpl(globalObject, [], { data, ownerDocument })); - } : - // When parsing a whole document, we must ignore those text nodes that are - // produced outside the root element. Saxes produces events for them, - // but DOM trees do not record text outside the root element. - data => { - if (openStack.length > 1) { - const ownerDocument = getOwnerDocument(); - appendChild(Text.createImpl(globalObject, [], { data, ownerDocument })); - } - }); - - parser.on("cdata", data => { - const ownerDocument = getOwnerDocument(); - appendChild(CDATASection.createImpl(globalObject, [], { data, ownerDocument })); - }); - - parser.on("opentag", tag => { - const { local: tagLocal, attributes: tagAttributes } = tag; - - const ownerDocument = getOwnerDocument(); - const tagNamespace = tag.uri === "" ? null : tag.uri; - const tagPrefix = tag.prefix === "" ? null : tag.prefix; - const isValue = tagAttributes.is === undefined ? null : tagAttributes.is.value; - - const elem = createElement(ownerDocument, tagLocal, tagNamespace, tagPrefix, isValue, true); - - // We mark a script element as "parser-inserted", which prevents it from - // being immediately executed. - if (tagLocal === "script" && tagNamespace === HTML_NS) { - elem._parserInserted = true; - } - - for (const key of Object.keys(tagAttributes)) { - const { prefix, local, uri, value } = tagAttributes[key]; - attributes.setAttributeValue(elem, local, value, prefix === "" ? null : prefix, uri === "" ? null : uri); - } - - appendChild(elem); - openStack.push(elem); - }); - - parser.on("closetag", () => { - const elem = openStack.pop(); - // Once a script is populated, we can execute it. - if (elem.localName === "script" && elem.namespaceURI === HTML_NS) { - elem._eval(); - } - }); - - parser.on("comment", data => { - const ownerDocument = getOwnerDocument(); - appendChild(Comment.createImpl(globalObject, [], { data, ownerDocument })); - }); - - parser.on("processinginstruction", ({ target, body }) => { - const ownerDocument = getOwnerDocument(); - appendChild(ProcessingInstruction.createImpl(globalObject, [], { target, data: body, ownerDocument })); - }); - - parser.on("doctype", dt => { - const ownerDocument = getOwnerDocument(); - appendChild(parseDocType(globalObject, ownerDocument, `<!doctype ${dt}>`)); - - const entityMatcher = /<!ENTITY ([^ ]+) "([^"]+)">/g; - let result; - while ((result = entityMatcher.exec(dt))) { - const [, name, value] = result; - if (!(name in parser.ENTITIES)) { - parser.ENTITIES[name] = value; - } - } - }); - - parser.on("error", err => { - throw DOMException.create(globalObject, [err.message, "SyntaxError"]); - }); - - return parser; -} - -function parseFragment(markup, contextElement) { - const { _globalObject, _ownerDocument } = contextElement; - - const fragment = DocumentFragment.createImpl(_globalObject, [], { ownerDocument: _ownerDocument }); - - // Only parseFragment needs resolvePrefix per the saxes documentation: - // https://github.com/lddubeau/saxes#parsing-xml-fragments - const parser = createParser(fragment, _globalObject, { - fragment: true, - resolvePrefix(prefix) { - // saxes wants undefined as the return value if the prefix is not defined, not null. - return contextElement.lookupNamespaceURI(prefix) || undefined; - } - }); - - parser.write(markup).close(); - - return fragment; -} - -function parseIntoDocument(markup, ownerDocument) { - const { _globalObject } = ownerDocument; - - const parser = createParser(ownerDocument, _globalObject, { - fileName: ownerDocument.location && ownerDocument.location.href - }); - - parser.write(markup).close(); - - return ownerDocument; -} - -module.exports = { - parseFragment, - parseIntoDocument -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/async-resource-queue.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/async-resource-queue.js deleted file mode 100644 index 51c7bb7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/async-resource-queue.js +++ /dev/null @@ -1,114 +0,0 @@ -"use strict"; - -class QueueItem { - constructor(onLoad, onError, dependentItem) { - this.onLoad = onLoad; - this.onError = onError; - this.data = null; - this.error = null; - this.dependentItem = dependentItem; - } -} - -/** - * AsyncResourceQueue is the queue in charge of run the async scripts - * and notify when they finish. - */ -module.exports = class AsyncResourceQueue { - constructor() { - this.items = new Set(); - this.dependentItems = new Set(); - } - - count() { - return this.items.size + this.dependentItems.size; - } - - _notify() { - if (this._listener) { - this._listener(); - } - } - - _check(item) { - let promise; - - if (item.onError && item.error) { - promise = item.onError(item.error); - } else if (item.onLoad && item.data) { - promise = item.onLoad(item.data); - } - - promise - .then(() => { - this.items.delete(item); - this.dependentItems.delete(item); - - if (this.count() === 0) { - this._notify(); - } - }); - } - - setListener(listener) { - this._listener = listener; - } - - push(request, onLoad, onError, dependentItem) { - const q = this; - - const item = new QueueItem(onLoad, onError, dependentItem); - - q.items.add(item); - - return request - .then(data => { - item.data = data; - - if (dependentItem && !dependentItem.finished) { - q.dependentItems.add(item); - return q.items.delete(item); - } - - if (onLoad) { - return q._check(item); - } - - q.items.delete(item); - - if (q.count() === 0) { - q._notify(); - } - - return null; - }) - .catch(err => { - item.error = err; - - if (dependentItem && !dependentItem.finished) { - q.dependentItems.add(item); - return q.items.delete(item); - } - - if (onError) { - return q._check(item); - } - - q.items.delete(item); - - if (q.count() === 0) { - q._notify(); - } - - return null; - }); - } - - notifyItem(syncItem) { - for (const item of this.dependentItems) { - if (item.dependentItem === syncItem) { - this._check(item); - } - } - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/decompress-interceptor.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/decompress-interceptor.js deleted file mode 100644 index a63cb12..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/decompress-interceptor.js +++ /dev/null @@ -1,184 +0,0 @@ -"use strict"; - -// Adapted from undici's lib/interceptor/decompress.js -// https://github.com/nodejs/undici/blob/main/lib/interceptor/decompress.js -// Changes: -// - Removed zstd support (requires runtimeFeatures check) -// - Removed experimental warning -// - Use undici's exported DecoratorHandler - -const { createInflate, createGunzip, createBrotliDecompress } = require("zlib"); -const { pipeline } = require("stream"); -const { DecoratorHandler } = require("undici"); - -const supportedEncodings = { - "gzip": createGunzip, - "x-gzip": createGunzip, - "br": createBrotliDecompress, - "deflate": createInflate, - "compress": createInflate, - "x-compress": createInflate -}; - -const defaultSkipStatusCodes = [204, 304]; - -class DecompressHandler extends DecoratorHandler { - #decompressors = []; - #skipStatusCodes; - #skipErrorResponses; - - constructor(handler, { skipStatusCodes = defaultSkipStatusCodes, skipErrorResponses = true } = {}) { - super(handler); - this.#skipStatusCodes = skipStatusCodes; - this.#skipErrorResponses = skipErrorResponses; - } - - #shouldSkipDecompression(contentEncoding, statusCode) { - if (!contentEncoding || statusCode < 200) { - return true; - } - if (this.#skipStatusCodes.includes(statusCode)) { - return true; - } - if (this.#skipErrorResponses && statusCode >= 400) { - return true; - } - return false; - } - - #createDecompressionChain(encodings) { - const parts = encodings.split(","); - - const maxContentEncodings = 5; - if (parts.length > maxContentEncodings) { - throw new Error(`too many content-encodings in response: ${parts.length}, max is ${maxContentEncodings}`); - } - - const decompressors = []; - - for (let i = parts.length - 1; i >= 0; i--) { - const encoding = parts[i].trim(); - if (!encoding) { - continue; - } - - if (!supportedEncodings[encoding]) { - decompressors.length = 0; - return decompressors; - } - - decompressors.push(supportedEncodings[encoding]()); - } - - return decompressors; - } - - #setupDecompressorEvents(decompressor, controller) { - decompressor.on("readable", () => { - let chunk; - while ((chunk = decompressor.read()) !== null) { - const result = super.onResponseData(controller, chunk); - if (result === false) { - break; - } - } - }); - - decompressor.on("error", error => { - super.onResponseError(controller, error); - }); - } - - #setupSingleDecompressor(controller) { - const decompressor = this.#decompressors[0]; - this.#setupDecompressorEvents(decompressor, controller); - - decompressor.on("end", () => { - super.onResponseEnd(controller, {}); - }); - } - - #setupMultipleDecompressors(controller) { - const lastDecompressor = this.#decompressors[this.#decompressors.length - 1]; - this.#setupDecompressorEvents(lastDecompressor, controller); - - pipeline(this.#decompressors, err => { - if (err) { - super.onResponseError(controller, err); - return; - } - super.onResponseEnd(controller, {}); - }); - } - - #cleanupDecompressors() { - this.#decompressors.length = 0; - } - - onResponseStart(controller, statusCode, headers, statusMessage) { - const contentEncoding = headers["content-encoding"]; - - if (this.#shouldSkipDecompression(contentEncoding, statusCode)) { - return super.onResponseStart(controller, statusCode, headers, statusMessage); - } - - const decompressors = this.#createDecompressionChain(contentEncoding.toLowerCase()); - - if (decompressors.length === 0) { - this.#cleanupDecompressors(); - return super.onResponseStart(controller, statusCode, headers, statusMessage); - } - - this.#decompressors = decompressors; - - // Keep content-encoding and content-length headers as-is - // XHR spec requires these to reflect the wire format, not the decoded body - const newHeaders = { ...headers }; - - if (this.#decompressors.length === 1) { - this.#setupSingleDecompressor(controller); - } else { - this.#setupMultipleDecompressors(controller); - } - - return super.onResponseStart(controller, statusCode, newHeaders, statusMessage); - } - - onResponseData(controller, chunk) { - if (this.#decompressors.length > 0) { - this.#decompressors[0].write(chunk); - return; - } - super.onResponseData(controller, chunk); - } - - onResponseEnd(controller, trailers) { - if (this.#decompressors.length > 0) { - this.#decompressors[0].end(); - this.#cleanupDecompressors(); - return; - } - super.onResponseEnd(controller, trailers); - } - - onResponseError(controller, err) { - if (this.#decompressors.length > 0) { - for (const decompressor of this.#decompressors) { - decompressor.destroy(err); - } - this.#cleanupDecompressors(); - } - super.onResponseError(controller, err); - } -} - -function createDecompressInterceptor(options = {}) { - return dispatch => { - return (opts, handler) => { - const decompressHandler = new DecompressHandler(handler, options); - return dispatch(opts, decompressHandler); - }; - }; -} - -module.exports = createDecompressInterceptor; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/jsdom-dispatcher.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/jsdom-dispatcher.js deleted file mode 100644 index 5c0cf71..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/jsdom-dispatcher.js +++ /dev/null @@ -1,746 +0,0 @@ -"use strict"; -const fs = require("fs"); -const { Readable } = require("stream"); -const { fileURLToPath } = require("url"); -const { parseURL, serializeURL, serializeURLOrigin, serializePath } = require("whatwg-url"); -const dataURLFromRecord = require("data-urls").fromURLRecord; -const { Dispatcher } = require("undici"); -const WrapHandler = require("undici/lib/handler/wrap-handler.js"); -const { toBase64 } = require("@exodus/bytes/base64.js"); -const { utf8Encode } = require("../../living/helpers/encoding"); -const { sendStreamResponse } = require("./stream-handler"); - -const packageVersion = require("../../../../package.json").version; - -const DEFAULT_USER_AGENT = `Mozilla/5.0 (${process.platform || "unknown OS"}) AppleWebKit/537.36 ` + - `(KHTML, like Gecko) jsdom/${packageVersion}`; -const MAX_REDIRECTS = 20; - -/** - * JSDOMDispatcher - Full undici Dispatcher implementation for jsdom. - * - * Handles: - * - data: URLs (decode and return) - * - file: URLs (read from filesystem) - * - HTTP(S) and web sockets: follows redirects manually, capturing cookies at each hop - * - * Callers should provide the expected opaque fields when possible, to ensure that various parts of the jsdom pipeline - * have enough information. See the `dispatch()` JSDoc for details. - */ -class JSDOMDispatcher extends Dispatcher { - #baseDispatcher; - #cookieJar; - #userAgent; - #userInterceptors; - - constructor({ baseDispatcher, cookieJar, userAgent, userInterceptors = [] }) { - super(); - this.#baseDispatcher = baseDispatcher; - this.#cookieJar = cookieJar; - this.#userAgent = userAgent || DEFAULT_USER_AGENT; - this.#userInterceptors = userInterceptors; - } - - /** - * Dispatch a request through the jsdom resource loading pipeline. - * - * Vaguely corresponds to: - * - https://fetch.spec.whatwg.org/#concept-fetch: in theory, all jsdom fetches should go through here, like all web - * platform fetches go through #concept-fetch. - * - https://fetch.spec.whatwg.org/#concept-scheme-fetch: the code is more like skipping straight to scheme fetch. - * - * @param {object} opts - undici dispatch options - * @param {object} [opts.opaque] - jsdom-specific request context (may be undefined for WebSocket upgrades) - * @param {Element|null} opts.opaque.element - DOM element that triggered the request - * @param {string} opts.opaque.url - Full request URL (since we cannot reconstruct it from `opts.origin + opts.path` - * for `file:` URLs). If given, `opts.origin`, `opts.path`, and `opts.query` are ignored. - * @param {string} [opts.opaque.origin] - Request origin for CORS (used by XHR) - * @param {boolean} [opts.opaque.corsMode] - Enable CORS validation during redirects (used by XHR) - * @param {boolean} [opts.opaque.withCredentials] - Include cookies cross-origin (used by XHR) - * @param {Object} [opts.opaque.auth] - Auth credentials {user, pass} for 401 Basic auth handling - * @param {Object} [opts.opaque.preflight] - If present, do CORS preflight before main request - * @param {string[]} [opts.opaque.preflight.unsafeHeaders] - Non-simple headers that need to be allowed - * @param {object} handler - undici handler - */ - dispatch(opts, handler) { - // Wrap handler to normalize OLD API (onConnect/onHeaders/onData/onComplete/onError) to NEW API - // (onRequestStart/onResponseStart/onResponseData/onResponseEnd/onResponseError). This is necessary because undici's - // internals call the old API a lot, despite it being undocumented: - // * https://github.com/nodejs/undici/issues/4771 - // * https://github.com/nodejs/undici/issues/4780 - const wrappedHandler = WrapHandler.wrap(handler); - - // Get URL from opaque if present (required for file: URLs since they have origin "null"), - // otherwise reconstruct from opts.origin + opts.path (works for http/https/ws/wss) - const urlString = opts.opaque?.url || (opts.origin + opts.path); - const urlRecord = parseURL(urlString); - - if (urlRecord === null) { - wrappedHandler.onResponseError?.(null, new TypeError(`Invalid URL: ${urlString}`)); - return false; - } - - if (urlRecord.scheme === "data") { - return this.#dispatchDataURL(urlRecord, wrappedHandler); - } - - if (urlRecord.scheme === "file") { - return this.#dispatchFileURL(urlRecord, wrappedHandler); - } - - // HTTP(S) - handles redirects, CORS, preflight, and WebSocket upgrades - this.#dispatchHTTP(urlRecord, wrappedHandler, opts); - return true; - } - - /** - * Handle `data:` URLs by decoding them and returning the body. - * - * Corresponds fairly directly to https://fetch.spec.whatwg.org/#concept-scheme-fetch's "data" scheme case. - */ - #dispatchDataURL(urlRecord, handler) { - const dataURL = dataURLFromRecord(urlRecord); - if (dataURL === null) { - const error = new TypeError("Invalid data: URL"); - handler.onResponseError?.(null, error); - return false; - } - - const stream = Readable.from([dataURL.body]); - - sendStreamResponse(handler, stream, { - status: 200, - statusText: "OK", - headers: { "content-type": dataURL.mimeType.toString() }, - context: { finalURL: urlRecord } - }); - - return true; - } - - /** - * Handle `file:` URLs by reading from the filesystem. - * - * Corresponds fairly directly to https://fetch.spec.whatwg.org/#concept-scheme-fetch's "file" scheme case. - */ - #dispatchFileURL(urlRecord, handler) { - const filePath = fileURLToPath(serializeURL(urlRecord)); - const stream = fs.createReadStream(filePath); - - sendStreamResponse(handler, stream, { - status: 200, - statusText: "OK", - context: { finalURL: urlRecord } - }); - - return true; - } - - /** - * High-level HTTP(S) fetch with redirect handling, CORS validation, and preflight. - * - * Corresponds roughly to https://fetch.spec.whatwg.org/#concept-http-fetch, although some parts of - * https://fetch.spec.whatwg.org/#concept-fetch also live here. - */ - async #dispatchHTTP(urlRecord, handler, opts) { - const { corsMode, origin, withCredentials, auth, preflight } = opts.opaque || {}; - const requestFragment = urlRecord.fragment; - let currentURL = urlRecord; - let currentMethod = opts.method || "GET"; - let currentBody = opts.body ?? null; - const currentHeaders = { ...this.#normalizeHeadersToObject(opts.headers) }; - let effectiveOrigin = origin; // CORS tracking - may become "null" after cross-origin redirects - let receivedAuthChallenge = false; - const ctx = { finalURL: null }; - - // Create a proxy controller that forwards to the current underlying controller. - // This provides a stable reference across redirect hops. - let currentController; - let onRequestStartCalled = false; - const proxyController = { - abort(reason) { - currentController.abort(reason); - }, - pause() { - currentController.pause(); - }, - resume() { - currentController.resume(); - }, - get paused() { - return currentController.paused; - }, - get aborted() { - return currentController.aborted; - }, - get reason() { - return currentController.reason; - } - }; - - // Callback for #doSingleRequest to invoke when a controller becomes available - function onControllerReady(controller) { - currentController = controller; - if (!onRequestStartCalled) { - onRequestStartCalled = true; - handler.onRequestStart?.(proxyController, ctx); - } - } - - // Handle CORS preflight if needed - if (preflight) { - const preflightHeaders = { - Origin: origin - }; - preflightHeaders["Access-Control-Request-Method"] = currentMethod; - if (preflight.unsafeHeaders?.length > 0) { - preflightHeaders["Access-Control-Request-Headers"] = preflight.unsafeHeaders.join(", "); - } - - const preflightResult = await this.#doSingleRequest( - currentURL, - "OPTIONS", - preflightHeaders, - null, - { ...opts.opaque, origin, withCredentials }, - undefined, // no upgrade for preflight - opts, - onControllerReady - ); - - if (preflightResult.error) { - handler.onResponseError?.(null, preflightResult.error); - return; - } - - // Validate preflight response status - if (preflightResult.status < 200 || preflightResult.status > 299) { - handler.onResponseError?.(null, new Error( - "Response for preflight has invalid HTTP status code " + preflightResult.status - )); - return; - } - - // CORS validation on preflight response - const acao = preflightResult.headers["access-control-allow-origin"]; - if (acao !== "*" && acao !== origin) { - handler.onResponseError?.(null, new Error("Cross origin " + origin + " forbidden")); - return; - } - if (withCredentials) { - const acac = preflightResult.headers["access-control-allow-credentials"]; - if (acac !== "true") { - handler.onResponseError?.(null, new Error("Credentials forbidden")); - return; - } - } - - // Validate allowed headers - const acahStr = preflightResult.headers["access-control-allow-headers"]; - const acah = new Set(acahStr ? acahStr.toLowerCase().split(/,\s*/) : []); - if (!acah.has("*")) { - for (const unsafeHeader of preflight.unsafeHeaders || []) { - if (!acah.has(unsafeHeader.toLowerCase())) { - handler.onResponseError?.(null, new Error("Header " + unsafeHeader + " forbidden")); - return; - } - } - } - } - - // Redirect loop - for (let redirectCount = 0; redirectCount <= MAX_REDIRECTS; redirectCount++) { - ctx.finalURL = currentURL; - const currentOrigin = serializeURLOrigin(currentURL); - - // Clone headers for this request - const requestHeaders = { ...currentHeaders }; - - // Add auth header if needed - if (receivedAuthChallenge && auth) { - const authString = `${auth.user || ""}:${auth.pass || ""}`; - requestHeaders.Authorization = "Basic " + toBase64(utf8Encode(authString)); - } - - const result = await this.#doSingleRequest( - currentURL, - currentMethod, - requestHeaders, - currentBody, - { ...opts.opaque, origin, withCredentials }, - opts.upgrade, - opts, - onControllerReady - ); - - // WebSocket upgrade - if (result.upgraded) { - handler.onRequestUpgrade?.(proxyController, result.statusCode, result.headers, result.socket); - return; - } - - if (result.error) { - handler.onResponseError?.(null, result.error); - return; - } - - // Handle 401 auth challenge - if (result.status === 401 && auth && !receivedAuthChallenge) { - const wwwAuth = result.headers["www-authenticate"] || ""; - if (/^Basic /i.test(wwwAuth)) { - receivedAuthChallenge = true; - continue; - } - } - - // Handle redirect - const { location } = result.headers; - if (result.status >= 300 && result.status < 400 && location) { - const targetURL = parseURL(location, { baseURL: currentURL }); - if (!targetURL) { - handler.onResponseError?.(null, new TypeError("Invalid redirect URL")); - return; - } - - // Per fetch spec: if location's fragment is null, inherit from request - if (targetURL.fragment === null) { - targetURL.fragment = requestFragment; - } - - // Per fetch spec: if locationURL's scheme is not HTTP(S), return a network error - if (targetURL.scheme !== "http" && targetURL.scheme !== "https") { - handler.onResponseError?.(null, new Error("Cannot redirect to non-HTTP(S) URL")); - return; - } - - // Method change per fetch spec "HTTP-redirect fetch" - // 301/302 + POST → GET, 303 + non-GET/HEAD → GET - if (((result.status === 301 || result.status === 302) && currentMethod === "POST") || - (result.status === 303 && !["GET", "HEAD"].includes(currentMethod))) { - currentMethod = "GET"; - currentBody = null; - this.#deleteRequestHeader(currentHeaders, "content-encoding"); - this.#deleteRequestHeader(currentHeaders, "content-language"); - this.#deleteRequestHeader(currentHeaders, "content-location"); - this.#deleteRequestHeader(currentHeaders, "content-type"); - } - - const targetOrigin = serializeURLOrigin(targetURL); - - // Authorization header removal on cross-origin redirect - if (currentOrigin !== targetOrigin) { - this.#deleteRequestHeader(currentHeaders, "authorization"); - } - - // CORS handling for cross-origin redirects (only if origin is set, indicating XHR/fetch) - const targetIsCrossOrigin = origin !== undefined && origin !== targetOrigin; - if (corsMode || targetIsCrossOrigin) { - // CORS validation on redirect response (if source was cross-origin) - if (origin !== currentOrigin) { - const acao = result.headers["access-control-allow-origin"]; - if (acao !== "*" && acao !== origin) { - handler.onResponseError?.(null, new Error("Cross origin " + origin + " forbidden")); - return; - } - if (withCredentials) { - const acac = result.headers["access-control-allow-credentials"]; - if (acac !== "true") { - handler.onResponseError?.(null, new Error("Credentials forbidden")); - return; - } - } - // Userinfo check - forbid redirects to URLs with username/password - if (targetURL.username || targetURL.password) { - handler.onResponseError?.(null, new Error("Userinfo forbidden in cors redirect")); - return; - } - // Update effective origin - becomes "null" after cross-origin→cross-origin redirect - if (currentOrigin !== targetOrigin) { - effectiveOrigin = "null"; - } - } - - // Add Origin header for cross-origin target or if effective origin became "null" - if (targetIsCrossOrigin || effectiveOrigin === "null") { - currentHeaders.Origin = effectiveOrigin; - } - } - - currentURL = targetURL; - continue; - } - - // Final response - CORS validation (if destination is cross-origin or effective origin is "null") - if (origin !== undefined && (origin !== currentOrigin || effectiveOrigin === "null")) { - const acao = result.headers["access-control-allow-origin"]; - if (acao !== "*" && acao !== effectiveOrigin) { - handler.onResponseError?.(null, new Error("Cross origin " + effectiveOrigin + " forbidden")); - return; - } - if (withCredentials) { - const acac = result.headers["access-control-allow-credentials"]; - if (acac !== "true") { - handler.onResponseError?.(null, new Error("Credentials forbidden")); - return; - } - } - } - - // Stream response to handler - handler.onResponseStart?.(proxyController, result.status, result.headers, result.statusText); - - // Forward body chunks to handler - result.forwardBodyTo(handler); - return; - } - - handler.onResponseError?.(null, new Error(`Too many redirects (max ${MAX_REDIRECTS})`)); - } - - /** - * Perform a single HTTP request (no redirects). - * Handles cookies based on cross-origin/credentials settings. - * Returns response metadata immediately, with a forwardBodyTo() method to stream the body later. - * - * For WebSocket upgrades, returns { upgraded: true, controller, statusCode, headers, socket }. - * - * Mostly corresponds to https://fetch.spec.whatwg.org/#concept-http-network-fetch. - * - * @param {object} url - URL record to request - * @param {string} method - HTTP method - * @param {object} headers - Request headers - * @param {*} body - Request body - * @param {object} opaque - jsdom opaque options - * @param {string} upgrade - Upgrade protocol (e.g., "websocket") - * @param {object} originalOpts - Original dispatch options to preserve extra undici options - * @param {function} onControllerReady - Callback invoked when controller is available - */ - async #doSingleRequest(url, method, headers, body, opaque, upgrade, originalOpts, onControllerReady) { - const { origin: requestOrigin, withCredentials } = opaque || {}; - - // Build headers with defaults - const requestHeaders = { ...headers }; - this.#setDefaultHeaders(requestHeaders); - - if (body === null && (method === "POST" || method === "PUT")) { - requestHeaders["Content-Length"] = "0"; - } else if (body !== null && body.byteLength !== undefined) { - // The `body.byteLength !== undefined` check is equivalent to the spec case where httpRequest's body's length is - // null, because body is a stream. - requestHeaders["Content-Length"] = String(body.byteLength); - } - - // Determine if this is cross-origin (for cookie handling) - const urlOrigin = serializeURLOrigin(url); - const crossOrigin = requestOrigin !== undefined && requestOrigin !== urlOrigin; - - // Only handle cookies for same-origin requests, or cross-origin with credentials - // Don't send cookies for preflight requests - const isPreflight = method === "OPTIONS" && - this.#hasRequestHeader(headers, "Access-Control-Request-Method"); - const shouldHandleCookies = (!crossOrigin || withCredentials) && !isPreflight; - - const urlSerialized = serializeURL(url); - - if (shouldHandleCookies) { - const cookieString = this.#cookieJar.getCookieStringSync(urlSerialized); - if (cookieString) { - requestHeaders.Cookie = cookieString; - } - } - - // Spread original opts to preserve extra undici options (e.g., idempotent, bodyTimeout), - // then override with our specific values. - // If opaque.url was provided, derive origin/path from it and null out query. - // Otherwise, pass through origin/path/query unchanged. - const hasOpaqueURL = opaque?.url !== undefined; - const dispatchOpts = { - ...originalOpts, - origin: hasOpaqueURL ? urlOrigin : originalOpts.origin, - path: hasOpaqueURL ? serializePathForUndici(url) : originalOpts.path, - query: hasOpaqueURL ? null : originalOpts.query, - method, - headers: requestHeaders, - body, - upgrade, - opaque: { ...opaque, url: urlSerialized } - }; - - const innerDispatch = this.#buildDispatchChain(); - - return new Promise(resolve => { - let responseHeaders, streamError; - let bodyHandler = null; - let pendingChunks = []; - let ended = false; - let responseStarted = false; - - innerDispatch(dispatchOpts, { - onRequestStart: controller => { - onControllerReady(controller); - }, - onRequestUpgrade: (controller, statusCode, headersObj, socket) => { - if (controller.aborted) { - resolve({ error: controller.reason }); - return; - } - if (shouldHandleCookies) { - this.#storeCookiesFromHeaders(headersObj, urlSerialized); - } - resolve({ upgraded: true, controller, statusCode, headers: headersObj, socket }); - }, - onResponseStart: (controller, statusCode, headersObj, statusText) => { - if (controller.aborted) { - resolve({ error: controller.reason }); - return; - } - - responseHeaders = headersObj; - responseStarted = true; - - // Create a mechanism to forward body to handler later - function forwardBodyTo(fwdHandler) { - bodyHandler = fwdHandler; - // Forward any chunks that arrived before forwardBodyTo was called - for (const chunk of pendingChunks) { - fwdHandler.onResponseData?.(controller, chunk); - } - pendingChunks = null; - if (streamError) { - fwdHandler.onResponseError?.(controller, streamError); - } else if (ended) { - fwdHandler.onResponseEnd?.(controller, {}); - } - } - - resolve({ - status: statusCode, - statusText: statusText || "", - headers: responseHeaders, - url, - forwardBodyTo - }); - }, - onResponseData: (controller, chunk) => { - if (controller.aborted) { - return; - } - if (bodyHandler) { - bodyHandler.onResponseData?.(controller, chunk); - } else { - pendingChunks.push(chunk); - } - }, - onResponseEnd: (controller, trailers) => { - if (controller.aborted) { - if (bodyHandler) { - bodyHandler.onResponseError?.(controller, controller.reason); - } else { - streamError = controller.reason; - } - return; - } - if (shouldHandleCookies) { - this.#storeCookiesFromHeaders(responseHeaders, urlSerialized); - } - if (bodyHandler) { - bodyHandler.onResponseEnd?.(controller, trailers); - } else { - ended = true; - } - }, - onResponseError: (controller, err) => { - if (responseStarted) { - // Error occurred mid-stream - forward to body handler - if (bodyHandler) { - bodyHandler.onResponseError?.(controller, err); - } else { - streamError = err; - } - } else { - resolve({ error: err }); - } - } - }); - }); - } - - /** - * Build the dispatch chain with user interceptors applied. - */ - #buildDispatchChain() { - let innerDispatch = (opts, h) => { - return this.#baseDispatcher.dispatch(opts, h); - }; - - // Apply user interceptors from innermost to outermost - for (let i = this.#userInterceptors.length - 1; i >= 0; i--) { - const interceptor = this.#userInterceptors[i]; - const nextDispatch = innerDispatch; - innerDispatch = (opts, h) => interceptor(nextDispatch)(opts, h); - } - - return innerDispatch; - } - - /** - * Normalize headers to an object format. - * Callers pass either HeaderList (iterable) or plain objects. - */ - #normalizeHeadersToObject(headers) { - if (!headers) { - return {}; - } - - // HeaderList has Symbol.iterator; plain objects don't - if (typeof headers[Symbol.iterator] === "function") { - const obj = {}; - for (const [name, value] of headers) { - obj[name] = value; - } - return obj; - } - - return { ...headers }; - } - - /** - * Check if a request header exists (case-insensitive). - * Request headers may have user-controlled casing. - */ - #hasRequestHeader(requestHeaders, name) { - const lowerName = name.toLowerCase(); - return Object.keys(requestHeaders).some(key => key.toLowerCase() === lowerName); - } - - /** - * Delete a request header (case-insensitive). - * Request headers may have user-controlled casing. Mutates the object in place. - */ - #deleteRequestHeader(requestHeaders, name) { - const lowerName = name.toLowerCase(); - for (const key of Object.keys(requestHeaders)) { - if (key.toLowerCase() === lowerName) { - delete requestHeaders[key]; - } - } - } - - /** - * Set default request headers if not already present. - * Mutates the headers object in place. - */ - #setDefaultHeaders(requestHeaders) { - if (!this.#hasRequestHeader(requestHeaders, "User-Agent")) { - requestHeaders["User-Agent"] = this.#userAgent; - } - if (!this.#hasRequestHeader(requestHeaders, "Accept-Language")) { - requestHeaders["Accept-Language"] = "en"; - } - if (!this.#hasRequestHeader(requestHeaders, "Accept")) { - requestHeaders.Accept = "*/*"; - } - if (!this.#hasRequestHeader(requestHeaders, "Accept-Encoding")) { - requestHeaders["Accept-Encoding"] = "gzip, deflate"; - } - } - - /** - * Extract and store cookies from response headers. - */ - #storeCookiesFromHeaders(headers, url) { - if (!headers["set-cookie"]) { - return; - } - const cookies = Array.isArray(headers["set-cookie"]) ? - headers["set-cookie"] : - [headers["set-cookie"]]; - for (const cookie of cookies) { - this.#cookieJar.setCookieSync(cookie, url, { ignoreError: true }); - } - } - - // Dispatcher API methods - forward close/destroy to base dispatcher - - close(...args) { - return this.#baseDispatcher.close(...args); - } - - destroy(...args) { - return this.#baseDispatcher.destroy(...args); - } - - /** - * Create a new JSDOMDispatcher with additional interceptors. - * The new interceptors are added as the outermost (first to see requests, last to see responses). - */ - compose(...additionalInterceptors) { - return new JSDOMDispatcher({ - baseDispatcher: this.#baseDispatcher, - cookieJar: this.#cookieJar, - userAgent: this.#userAgent, - userInterceptors: [...additionalInterceptors, ...this.#userInterceptors] - }); - } - - get closed() { - return this.#baseDispatcher.closed; - } - - get destroyed() { - return this.#baseDispatcher.destroyed; - } -} - -/** - * High-level GET fetch that collects the full response body. Used for subresources and `JSDOM.fromURL()`. - * - * @param {Dispatcher} dispatcher - The undici dispatcher to use - * @param {object} opts - Request options - * @param {string} opts.url - The URL to fetch - * @param {object} [opts.headers] - Request headers (include Referer if needed) - * @param {AbortSignal} [opts.signal] - Abort signal - * @param {Element} [opts.element] - The element initiating the request (default: null) - * @returns {Promise<{status: number, headers: object, body: Uint8Array, url: string, ok: boolean}>} - */ -async function fetchCollected(dispatcher, { url, headers, signal, element = null }) { - const urlRecord = parseURL(url); - if (!urlRecord) { - throw new TypeError(`Invalid URL: ${url}`); - } - - const response = await dispatcher.request({ - origin: serializeURLOrigin(urlRecord), - path: serializePathForUndici(urlRecord), - method: "GET", - headers, - signal, - opaque: { element, url } - }); - - const body = await response.body.bytes(); - - // Get final URL from context (set by dispatcher after handling redirects) - const finalURL = serializeURL(response.context.finalURL); - - return { - status: response.statusCode, - headers: response.headers, - body, - url: finalURL, - ok: response.statusCode >= 200 && response.statusCode < 300 - }; -} - -/** - * Serialize a URL record's path and query for undici's `path` option. - */ -function serializePathForUndici(urlRecord) { - return serializePath(urlRecord) + (urlRecord.query ? "?" + urlRecord.query : ""); -} - -module.exports = { - JSDOMDispatcher, - DEFAULT_USER_AGENT, - fetchCollected -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/per-document-resource-loader.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/per-document-resource-loader.js deleted file mode 100644 index 2500755..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/per-document-resource-loader.js +++ /dev/null @@ -1,116 +0,0 @@ -"use strict"; -const idlUtils = require("../../living/generated/utils"); -const { fireAnEvent } = require("../../living/helpers/events"); -const { fetchCollected } = require("./jsdom-dispatcher"); - -module.exports = class PerDocumentResourceLoader { - constructor(document) { - this._document = document; - this._defaultEncoding = document._encoding; - const defaultView = document._defaultView; - this._dispatcher = defaultView ? defaultView._dispatcher : null; - this._loadSubresources = defaultView ? defaultView._loadSubresources : false; - this._requestManager = document._requestManager; - this._queue = document._queue; - this._deferQueue = document._deferQueue; - this._asyncQueue = document._asyncQueue; - } - - fetch(url, { element, onLoad, onError }) { - if (!this._loadSubresources) { - return null; - } - - const abortController = new AbortController(); - - // Add it to the request manager. The request manager is very old code, but it works with the contract of "has an - // `abort()` method". One day this whole subsystem will be refactored to use `AbortController`s natively, but for - // now this just happens to work. - // - // Note that we add the controller now, before calling `fetchCollected()`, so that if any interceptors or other code - // calls `window.close()`, the abort controller is already registered and will see the abort. - this._requestManager.add(abortController); - - const fetchPromise = fetchCollected(this._dispatcher, { - url, - headers: { Referer: this._document.URL }, - signal: abortController.signal, - element: idlUtils.wrapperForImpl(element) - }); - - const onErrorWrapped = cause => { - this._requestManager.remove(abortController); - - // If the request was aborted, don't fire error events - if (cause && cause.name === "AbortError") { - return Promise.resolve(); - } - - if (onError) { - onError(cause); - } - - fireAnEvent("error", element); - - const jsomError = new Error(`Could not load ${element.localName}: "${url}"`, { cause }); - jsomError.type = "resource-loading"; - jsomError.url = url; - - this._document._defaultView._virtualConsole.emit("jsdomError", jsomError); - - return Promise.resolve(); - }; - - const onLoadWrapped = response => { - this._requestManager.remove(abortController); - - // Extract data and create a response-like object for compatibility - const { body: data, status, headers, url: responseURL } = response; - const responseObj = { - ok: status >= 200 && status < 300, - status, - headers: { - get(name) { - return headers[name.toLowerCase()] ?? null; - } - }, - url: responseURL - }; - - try { - const result = onLoad ? onLoad(data, responseObj) : undefined; - - return Promise.resolve(result) - .then(() => { - fireAnEvent("load", element); - - return Promise.resolve(); - }) - .catch(err => { - return onErrorWrapped(err); - }); - } catch (err) { - return onErrorWrapped(err); - } - }; - - // Create a wrapper object that can be used by the queue system - const request = { - then: (onFulfilled, onRejected) => fetchPromise.then(onFulfilled, onRejected), - catch: onRejected => fetchPromise.catch(onRejected) - }; - - if (element.localName === "script" && element.hasAttributeNS(null, "async")) { - this._asyncQueue.push(request, onLoadWrapped, onErrorWrapped, this._queue.getLastScript()); - } else if ( - element.localName === "script" && - element.hasAttributeNS(null, "defer") && - this._document.readyState !== "interactive") { - this._deferQueue.push(request, onLoadWrapped, onErrorWrapped, false, element); - } else { - this._queue.push(request, onLoadWrapped, onErrorWrapped, false, element); - } - - return request; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/request-interceptor.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/request-interceptor.js deleted file mode 100644 index ccc5394..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/request-interceptor.js +++ /dev/null @@ -1,171 +0,0 @@ -"use strict"; -const { Readable } = require("stream"); -const { sendStreamResponse } = require("./stream-handler"); - -/** - * Creates a user-friendly `undici` interceptor for jsdom. - * - * This helper allows users to intercept requests using a callback that receives a `Request` object and can return a - * promise for a `Response` to provide a synthetic response, or a promise for `undefined` to pass through. - * - * @param {function} fn - Async callback function that receives (request, context) and can return a Response - * @returns {function} An undici interceptor - * - * @example - * const dom = new JSDOM(html, { - * interceptors: [ - * requestInterceptor(async (request, { element }) => { - * console.log(`${element?.localName || 'XHR'} requested ${request.url}`); - * if (request.url.endsWith('/test.js')) { - * return new Response('window.mocked = true;', { - * headers: { 'Content-Type': 'application/javascript' } - * }); - * } - * // Return undefined to let the request pass through - * }) - * ] - * }); - * - * ## Why this doesn't use undici's DecoratorHandler pattern - * - * The standard undici interceptor pattern (see e.g. undici/lib/interceptor/dump.js) uses DecoratorHandler - * to wrap handler callbacks. That pattern calls `dispatch()` synchronously, then observes/modifies the - * request and response as they flow through the handler callbacks. - * - * This interceptor needs to support async user functions that can BLOCK the request and potentially - * REPLACE it with a synthetic response. This requires: - * - * 1. Waiting for the async user function BEFORE deciding whether to dispatch - * 2. For synthetic responses, NEVER calling dispatch() at all - * - * Since synthetic responses bypass the normal undici dispatch flow entirely, there's no underlying - * dispatcher (Agent/Pool) to create a real controller for us. We provide our own controller object - * that delegates to a Node.js Readable stream for pause/resume/abort support, following the pattern - * from undici/lib/interceptor/cache.js. - */ -module.exports = function requestInterceptor(fn) { - return dispatch => (options, handler) => { - const { element = null, url } = options.opaque || {}; - const abortController = new AbortController(); - - // Create undici controller and wrapped handler using the signal handler helper. - // The undici controller reflects abortController.signal's state and forwards to inner undici controller. - const { undiciController, wrappedHandler } = createSignalHandler(handler, abortController); - - // Call onRequestStart immediately to wire into the abort chain. - handler.onRequestStart?.(undiciController, {}); - - // Build Request object with our signal - const requestInit = { - method: options.method || "GET", - headers: options.headers, - signal: abortController.signal - }; - if (options.body !== undefined && options.body !== null) { - requestInit.body = options.body; - requestInit.duplex = "half"; - } - if (options.referrer) { - requestInit.referrer = options.referrer; - } - const request = new Request(url, requestInit); - - new Promise(resolve => { - resolve(fn(request, { element })); - }) - .then(response => { - if (response instanceof Response) { - // Send synthetic response without ever starting real request - // response.body can be null for responses with no body - const stream = response.body ? Readable.fromWeb(response.body) : Readable.from([]); - sendStreamResponse(wrappedHandler, stream, { - status: response.status, - statusText: response.statusText, - headers: headersToUndici(response.headers) - }); - } else if (response !== undefined) { - throw new TypeError("requestInterceptor callback must return undefined or a Response"); - } else if (!abortController.signal.aborted) { - // Pass through to real request - dispatch(options, wrappedHandler); - } - }) - .catch(error => { - handler.onResponseError?.(undiciController, error); - }); - - // Return true to indicate request is being handled - return true; - }; -}; - -/** - * Creates an undici controller and wrapped handler that bridge an AbortController to undici's dispatch protocol. - * - * The undici controller reflects the AbortController's signal state and captures an inner undici controller - * (from pass-through dispatch or synthetic stream) for forwarding pause/resume/abort. - */ -function createSignalHandler(handler, abortController) { - let innerUndiciController = null; - - const undiciController = { - abort(reason) { - abortController.abort(reason); - innerUndiciController?.abort(reason); - }, - pause() { - innerUndiciController?.pause(); - }, - resume() { - innerUndiciController?.resume(); - }, - get paused() { - return innerUndiciController?.paused ?? false; - }, - get aborted() { - return abortController.signal.aborted; - }, - get reason() { - return abortController.signal.reason; - } - }; - - const wrappedHandler = { - onRequestStart(controller) { - innerUndiciController = controller; - }, - onRequestUpgrade(...args) { - handler.onRequestUpgrade?.(...args); - }, - onResponseStart(...args) { - handler.onResponseStart?.(...args); - }, - onResponseData(...args) { - handler.onResponseData?.(...args); - }, - onResponseEnd(...args) { - handler.onResponseEnd?.(...args); - }, - onResponseError(...args) { - handler.onResponseError?.(...args); - } - }; - - return { undiciController, wrappedHandler }; -} - -/** - * Converts a Headers object to the format undici expects. - * Handles multiple Set-Cookie headers via getSetCookie(). - */ -function headersToUndici(headers) { - const result = {}; - for (const [key, value] of headers) { - result[key] = value; - } - const cookies = headers.getSetCookie(); - if (cookies.length > 0) { - result["set-cookie"] = cookies; - } - return result; -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js deleted file mode 100644 index dbf6ccb..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -/** - * Manage all the request and it is able to abort - * all pending request. - */ -module.exports = class RequestManager { - constructor() { - this.openedRequests = []; - } - - add(req) { - this.openedRequests.push(req); - } - - remove(req) { - const idx = this.openedRequests.indexOf(req); - if (idx !== -1) { - this.openedRequests.splice(idx, 1); - } - } - - close() { - for (const openedRequest of this.openedRequests) { - openedRequest.abort(); - } - this.openedRequests = []; - } - - size() { - return this.openedRequests.length; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/resource-queue.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/resource-queue.js deleted file mode 100644 index c7d8f0f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/resource-queue.js +++ /dev/null @@ -1,142 +0,0 @@ -"use strict"; - -/** - * Queue for all the resources to be download except async scripts. - * Async scripts have their own queue AsyncResourceQueue. - */ -module.exports = class ResourceQueue { - constructor({ paused, asyncQueue } = {}) { - this.paused = Boolean(paused); - this._asyncQueue = asyncQueue; - } - - getLastScript() { - let head = this.tail; - - while (head) { - if (head.isScript) { - return head; - } - head = head.prev; - } - - return null; - } - - _moreScripts() { - let found = false; - - let head = this.tail; - while (head && !found) { - found = head.isScript; - head = head.prev; - } - - return found; - } - - _notify() { - if (this._listener) { - this._listener(); - } - } - - setListener(listener) { - this._listener = listener; - } - - push(request, onLoad, onError, keepLast, element) { - const isScript = element ? element.localName === "script" : false; - - if (!request) { - if (isScript && !this._moreScripts()) { - return onLoad(); - } - - request = Promise.resolve(); - } - const q = this; - const item = { - isScript, - err: null, - element, - fired: false, - data: null, - keepLast, - prev: q.tail, - check() { - if (!q.paused && !this.prev && this.fired) { - let promise; - - if (this.err && onError) { - promise = onError(this.err); - } - - if (!this.err && onLoad) { - promise = onLoad(this.data); - } - - Promise.resolve(promise) - .then(() => { - if (this.next) { - this.next.prev = null; - this.next.check(); - } else { // q.tail===this - q.tail = null; - q._notify(); - } - - this.finished = true; - - if (q._asyncQueue) { - q._asyncQueue.notifyItem(this); - } - }); - } - } - }; - if (q.tail) { - if (q.tail.keepLast) { - // if the tail is the load event in document and we receive a new element to load - // we should add this new request before the load event. - if (q.tail.prev) { - q.tail.prev.next = item; - } - item.prev = q.tail.prev; - q.tail.prev = item; - item.next = q.tail; - } else { - q.tail.next = item; - q.tail = item; - } - } else { - q.tail = item; - } - return request - .then(data => { - item.fired = 1; - item.data = data; - item.check(); - }) - .catch(err => { - item.fired = true; - item.err = err; - item.check(); - }); - } - - resume() { - if (!this.paused) { - return; - } - this.paused = false; - - let head = this.tail; - while (head && head.prev) { - head = head.prev; - } - if (head) { - head.check(); - } - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/stream-handler.js b/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/stream-handler.js deleted file mode 100644 index 2af73cf..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/browser/resources/stream-handler.js +++ /dev/null @@ -1,89 +0,0 @@ -"use strict"; - -/** - * Sends a response to an undici handler by streaming data from a Node.js Readable stream. - * - * ## Why this exists - * - * undici's new handler API (onRequestStart, onResponseStart, onResponseData, onResponseEnd, onResponseError) - * requires a "controller" object with pause/resume/abort methods. When responses flow through undici's - * normal network stack, undici provides this controller. But when we generate responses ourselves - * (e.g., for file: URLs, data: URLs, or synthetic responses from interceptors), we need to provide - * our own controller. - * - * This helper creates a controller backed by a Node.js Readable stream, giving callers proper - * pause/resume and abort support. It follows the pattern from undici/lib/interceptor/cache.js. - * - * ## Usage - * - * ```javascript - * const stream = fs.createReadStream(filePath); - * // or: const stream = Readable.from(buffer); - * // or: const stream = Readable.fromWeb(response.body); - * - * sendStreamResponse(handler, stream, { - * status: 200, - * statusText: "OK", - * headers: { "content-type": "text/plain" }, - * context: { history: ["file:///path/to/file"] } - * }); - * ``` - * - * The function handles all stream events and translates them to handler callbacks. - * If the stream is destroyed (e.g., via controller.abort()), pending operations are cancelled. - * - * @param {object} handler - undici handler with new API methods (onRequestStart, onResponseStart, etc.) - * @param {Readable} stream - Node.js Readable stream containing the response body - * @param {object} options - Response metadata - * @param {number} options.status - HTTP status code - * @param {string} [options.statusText] - HTTP status text (default: "") - * @param {object} [options.headers] - Response headers as {name: value} object (default: {}) - * @param {object} [options.context] - Context object passed to onRequestStart (default: {}) - */ -function sendStreamResponse(handler, stream, { status, statusText = "", headers = {}, context = {} }) { - const controller = { - resume() { - stream.resume(); - }, - pause() { - stream.pause(); - }, - get paused() { - return stream.isPaused(); - }, - get aborted() { - return stream.errored !== null; - }, - get reason() { - return stream.errored; - }, - abort(reason) { - stream.destroy(reason); - } - }; - - stream - .on("error", err => { - if (!stream.readableEnded) { - handler.onResponseError?.(controller, err); - } - }) - .on("close", () => { - if (!stream.errored) { - handler.onResponseEnd?.(controller, {}); - } - }) - .on("data", chunk => { - handler.onResponseData?.(controller, chunk); - }); - - handler.onRequestStart?.(controller, context); - - if (stream.destroyed) { - return; - } - - handler.onResponseStart?.(controller, status, headers, statusText); -} - -module.exports = { sendStreamResponse }; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/level2/style.js b/vanilla/node_modules/jsdom/lib/jsdom/level2/style.js deleted file mode 100644 index fbee1a0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/level2/style.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -const cssstyle = require("cssstyle"); - -exports.addToCore = core => { - // What works now: - // - Accessing the rules defined in individual stylesheets - // - Modifications to style content attribute are reflected in style property - // - Modifications to style property are reflected in style content attribute - // TODO - // - Modifications to style element's textContent are reflected in sheet property. - // - Modifications to style element's sheet property are reflected in textContent. - // - Modifications to link.href property are reflected in sheet property. - // - Less-used features of link: disabled - // - Less-used features of style: disabled, scoped, title - // - CSSOM-View - // - getComputedStyle(): requires default stylesheet, cascading, inheritance, - // filtering by @media (screen? print?), layout for widths/heights - // - Load events are not in the specs, but apparently some browsers - // implement something. Should onload only fire after all @imports have been - // loaded, or only the primary sheet? - const cssom = require("@acemir/cssom").setup({ globalObject: core._globalObject }); - - core.StyleSheet = cssom.StyleSheet; - core.MediaList = cssom.MediaList; - core.CSSStyleSheet = cssom.CSSStyleSheet; - core.CSSRule = cssom.CSSRule; - core.CSSGroupingRule = cssom.CSSGroupingRule; - core.CSSNestedDeclarations = cssom.CSSNestedDeclarations; - core.CSSStyleRule = cssom.CSSStyleRule; - core.CSSMediaRule = cssom.CSSMediaRule; - core.CSSImportRule = cssom.CSSImportRule; - core.CSSConditionRule = cssom.CSSConditionRule; - core.CSSContainerRule = cssom.CSSContainerRule; - core.CSSScopeRule = cssom.CSSScopeRule; - core.CSSSupportsRule = cssom.CSSSupportsRule; - core.CSSLayerBlockRule = cssom.CSSLayerBlockRule; - core.CSSLayerStatementRule = cssom.CSSLayerStatementRule; - core.CSSStyleDeclaration = cssstyle.CSSStyleDeclaration; - - // Relevant specs - // http://www.w3.org/TR/DOM-Level-2-Style (2000) - // http://www.w3.org/TR/cssom-view/ (2008) - // http://dev.w3.org/csswg/cssom/ (2010) Meant to replace DOM Level 2 Style - // http://www.whatwg.org/specs/web-apps/current-work/multipage/ HTML5, of course - // http://dev.w3.org/csswg/css-style-attr/ not sure what's new here - - // Objects that aren't in cssom library but should be: - // CSSRuleList (cssom just uses array) - // CSSFontFaceRule - // CSSPageRule - - // These rules don't really make sense to implement, so CSSOM draft makes them - // obsolete. - // CSSCharsetRule - // CSSUnknownRule - - // These objects are considered obsolete by CSSOM draft, although modern - // browsers implement them. - // CSSValue - // CSSPrimitiveValue - // CSSValueList - // RGBColor - // Rect - // Counter -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/level3/xpath.js b/vanilla/node_modules/jsdom/lib/jsdom/level3/xpath.js deleted file mode 100644 index 71da751..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/level3/xpath.js +++ /dev/null @@ -1,1875 +0,0 @@ -/** Here is yet another implementation of XPath 1.0 in Javascript. - * - * My goal was to make it relatively compact, but as I fixed all the axis bugs - * the axes became more and more complicated. :-(. - * - * I have not implemented namespaces or case-sensitive axes for XML yet. - * - * How to test it in Chrome: You can make a Chrome extension that replaces - * the WebKit XPath parser with this one. But it takes a bit of effort to - * get around isolated world and same-origin restrictions: - * manifest.json: - { - "name": "XPathTest", - "version": "0.1", - "content_scripts": [{ - "matches": ["http://localhost/*"], // or wildcard host - "js": ["xpath.js", "injection.js"], - "all_frames": true, "run_at": "document_start" - }] - } - * injection.js: - // goal: give my xpath object to the website's JS context. - var script = document.createElement('script'); - script.textContent = - "document.addEventListener('xpathextend', function(e) {\n" + - " console.log('extending document with xpath...');\n" + - " e.detail(window);" + - "});"; - document.documentElement.appendChild(script); - document.documentElement.removeChild(script); - var evt = document.createEvent('CustomEvent'); - evt.initCustomEvent('xpathextend', true, true, this.xpath.extend); - document.dispatchEvent(evt); - */ -module.exports = core => { - var xpath = {}; - - // Helper function to deal with the migration of Attr to no longer have a nodeName property despite this codebase - // assuming it does. - function getNodeName(nodeOrAttr) { - return nodeOrAttr.constructor.name === 'Attr' ? nodeOrAttr.name : nodeOrAttr.nodeName; - } - - /*************************************************************************** - * Tokenization * - ***************************************************************************/ - /** - * The XPath lexer is basically a single regular expression, along with - * some helper functions to pop different types. - */ - var Stream = xpath.Stream = function Stream(str) { - this.original = this.str = str; - this.peeked = null; - // TODO: not really needed, but supposedly tokenizer also disambiguates - // a * b vs. node test * - this.prev = null; // for debugging - this.prevprev = null; - } - Stream.prototype = { - peek: function() { - if (this.peeked) return this.peeked; - var m = this.re.exec(this.str); - if (!m) return null; - this.str = this.str.substr(m[0].length); - return this.peeked = m[1]; - }, - /** Peek 2 tokens ahead. */ - peek2: function() { - this.peek(); // make sure this.peeked is set - var m = this.re.exec(this.str); - if (!m) return null; - return m[1]; - }, - pop: function() { - var r = this.peek(); - this.peeked = null; - this.prevprev = this.prev; - this.prev = r; - return r; - }, - trypop: function(tokens) { - var tok = this.peek(); - if (tok === tokens) return this.pop(); - if (Array.isArray(tokens)) { - for (var i = 0; i < tokens.length; ++i) { - var t = tokens[i]; - if (t == tok) return this.pop();; - } - } - }, - trypopfuncname: function() { - var tok = this.peek(); - if (!this.isQnameRe.test(tok)) - return null; - switch (tok) { - case 'comment': case 'text': case 'processing-instruction': case 'node': - return null; - } - if ('(' != this.peek2()) return null; - return this.pop(); - }, - trypopaxisname: function() { - var tok = this.peek(); - switch (tok) { - case 'ancestor': case 'ancestor-or-self': case 'attribute': - case 'child': case 'descendant': case 'descendant-or-self': - case 'following': case 'following-sibling': case 'namespace': - case 'parent': case 'preceding': case 'preceding-sibling': case 'self': - if ('::' == this.peek2()) return this.pop(); - } - return null; - }, - trypopnametest: function() { - var tok = this.peek(); - if ('*' === tok || this.startsWithNcNameRe.test(tok)) return this.pop(); - return null; - }, - trypopliteral: function() { - var tok = this.peek(); - if (null == tok) return null; - var first = tok.charAt(0); - var last = tok.charAt(tok.length - 1); - if ('"' === first && '"' === last || - "'" === first && "'" === last) { - this.pop(); - return tok.substr(1, tok.length - 2) ?? null; - } - return null; - }, - trypopnumber: function() { - var tok = this.peek(); - if (this.isNumberRe.test(tok)) return parseFloat(this.pop()) ?? null; - else return null; - }, - trypopvarref: function() { - var tok = this.peek(); - if (null == tok) return null; - if ('$' === tok.charAt(0)) return this.pop().substr(1) ?? null; - else return null; - }, - position: function() { - return this.original.length - this.str.length; - } - }; - (function() { - // http://www.w3.org/TR/REC-xml-names/#NT-NCName - var nameStartCharsExceptColon = - 'A-Z_a-z\xc0-\xd6\xd8-\xf6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF' + - '\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF' + - '\uFDF0-\uFFFD'; // JS doesn't support [#x10000-#xEFFFF] - var nameCharExceptColon = nameStartCharsExceptColon + - '\\-\\.0-9\xb7\u0300-\u036F\u203F-\u2040'; - var ncNameChars = '[' + nameStartCharsExceptColon + - '][' + nameCharExceptColon + ']*' - // http://www.w3.org/TR/REC-xml-names/#NT-QName - var qNameChars = ncNameChars + '(?::' + ncNameChars + ')?'; - var otherChars = '\\.\\.|[\\(\\)\\[\\].@,]|::'; // .. must come before [.] - var operatorChars = - 'and|or|mod|div|' + - '//|!=|<=|>=|[*/|+\\-=<>]'; // //, !=, <=, >= before individual ones. - var literal = '"[^"]*"|' + "'[^']*'"; - var numberChars = '[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+'; - var variableReference = '\\$' + qNameChars; - var nameTestChars = '\\*|' + ncNameChars + ':\\*|' + qNameChars; - var optionalSpace = '[ \t\r\n]*'; // stricter than regexp \s. - var nodeType = 'comment|text|processing-instruction|node'; - var re = new RegExp( - // numberChars before otherChars so that leading-decimal doesn't become . - '^' + optionalSpace + '(' + numberChars + '|' + otherChars + '|' + - nameTestChars + '|' + operatorChars + '|' + literal + '|' + - variableReference + ')' - // operatorName | nodeType | functionName | axisName are lumped into - // qName for now; we'll check them on pop. - ); - Stream.prototype.re = re; - Stream.prototype.startsWithNcNameRe = new RegExp('^' + ncNameChars); - Stream.prototype.isQnameRe = new RegExp('^' + qNameChars + '$'); - Stream.prototype.isNumberRe = new RegExp('^' + numberChars + '$'); - })(); - - /*************************************************************************** - * Parsing * - ***************************************************************************/ - var parse = xpath.parse = function parse(stream, a) { - var r = orExpr(stream,a); - var x, unparsed = []; - while (x = stream.pop()) { - unparsed.push(x); - } - if (unparsed.length) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Unparsed tokens: ' + unparsed.join(' ')); - return r; - } - - /** - * binaryL ::= subExpr - * | binaryL op subExpr - * so a op b op c becomes ((a op b) op c) - */ - function binaryL(subExpr, stream, a, ops) { - var lhs = subExpr(stream, a); - if (lhs == null) return null; - var op; - while (op = stream.trypop(ops)) { - var rhs = subExpr(stream, a); - if (rhs == null) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected something after ' + op); - lhs = a.node(op, lhs, rhs); - } - return lhs; - } - /** - * Too bad this is never used. If they made a ** operator (raise to power), - ( we would use it. - * binaryR ::= subExpr - * | subExpr op binaryR - * so a op b op c becomes (a op (b op c)) - */ - function binaryR(subExpr, stream, a, ops) { - var lhs = subExpr(stream, a); - if (lhs == null) return null; - var op = stream.trypop(ops); - if (op) { - var rhs = binaryR(stream, a); - if (rhs == null) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected something after ' + op); - return a.node(op, lhs, rhs); - } else { - return lhs;// TODO - } - } - /** [1] LocationPath::= RelativeLocationPath | AbsoluteLocationPath - * e.g. a, a/b, //a/b - */ - function locationPath(stream, a) { - return absoluteLocationPath(stream, a) || - relativeLocationPath(null, stream, a); - } - /** [2] AbsoluteLocationPath::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath - * [10] AbbreviatedAbsoluteLocationPath::= '//' RelativeLocationPath - */ - function absoluteLocationPath(stream, a) { - var op = stream.peek(); - if ('/' === op || '//' === op) { - var lhs = a.node('Root'); - return relativeLocationPath(lhs, stream, a, true); - } else { - return null; - } - } - /** [3] RelativeLocationPath::= Step | RelativeLocationPath '/' Step | - * | AbbreviatedRelativeLocationPath - * [11] AbbreviatedRelativeLocationPath::= RelativeLocationPath '//' Step - * e.g. p/a, etc. - */ - function relativeLocationPath(lhs, stream, a, isOnlyRootOk) { - if (null == lhs) { - lhs = step(stream, a); - if (null == lhs) return lhs; - } - var op; - while (op = stream.trypop(['/', '//'])) { - if ('//' === op) { - lhs = a.node('/', lhs, - a.node('Axis', 'descendant-or-self', 'node', undefined)); - } - var rhs = step(stream, a); - if (null == rhs && '/' === op && isOnlyRootOk) return lhs; - else isOnlyRootOk = false; - if (null == rhs) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected step after ' + op); - lhs = a.node('/', lhs, rhs); - } - return lhs; - } - /** [4] Step::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep - * [12] AbbreviatedStep::= '.' | '..' - * e.g. @href, self::p, p, a[@href], ., .. - */ - function step(stream, a) { - var abbrStep = stream.trypop(['.', '..']); - if ('.' === abbrStep) // A location step of . is short for self::node(). - return a.node('Axis', 'self', 'node'); - if ('..' === abbrStep) // A location step of .. is short for parent::node() - return a.node('Axis', 'parent', 'node'); - - var axis = axisSpecifier(stream, a); - var nodeType = nodeTypeTest(stream, a); - var nodeName; - if (null == nodeType) nodeName = nodeNameTest(stream, a); - if (null == axis && null == nodeType && null == nodeName) return null; - if (null == nodeType && null == nodeName) - throw new XPathException( - XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected nodeTest after axisSpecifier ' + axis); - if (null == axis) axis = 'child'; - if (null == nodeType) { - // When there's only a node name, then the node type is forced to be the - // principal node type of the axis. - // see http://www.w3.org/TR/xpath/#dt-principal-node-type - if ('attribute' === axis) nodeType = 'attribute'; - else if ('namespace' === axis) nodeType = 'namespace'; - else nodeType = 'element'; - } - var lhs = a.node('Axis', axis, nodeType, nodeName); - var pred; - while (null != (pred = predicate(lhs, stream, a))) { - lhs = pred; - } - return lhs; - } - /** [5] AxisSpecifier::= AxisName '::' | AbbreviatedAxisSpecifier - * [6] AxisName::= 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' - * | 'descendant' | 'descendant-or-self' | 'following' - * | 'following-sibling' | 'namespace' | 'parent' | - * | 'preceding' | 'preceding-sibling' | 'self' - * [13] AbbreviatedAxisSpecifier::= '@'? - */ - function axisSpecifier(stream, a) { - var attr = stream.trypop('@'); - if (null != attr) return 'attribute'; - var axisName = stream.trypopaxisname(); - if (null != axisName) { - var coloncolon = stream.trypop('::'); - if (null == coloncolon) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Should not happen. Should be ::.'); - return axisName; - } - } - /** [7] NodeTest::= NameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' - * [38] NodeType::= 'comment' | 'text' | 'processing-instruction' | 'node' - * I've split nodeTypeTest from nodeNameTest for convenience. - */ - function nodeTypeTest(stream, a) { - if ('(' !== stream.peek2()) { - return null; - } - var type = stream.trypop(['comment', 'text', 'processing-instruction', 'node']); - if (null != type) { - if (null == stream.trypop('(')) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Should not happen.'); - var param = undefined; - if (type == 'processing-instruction') { - param = stream.trypopliteral(); - } - if (null == stream.trypop(')')) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected close parens.'); - return type - } - } - function nodeNameTest(stream, a) { - var name = stream.trypopnametest(); - if (name != null) return name; - else return null; - } - /** [8] Predicate::= '[' PredicateExpr ']' - * [9] PredicateExpr::= Expr - */ - function predicate(lhs, stream, a) { - if (null == stream.trypop('[')) return null; - var expr = orExpr(stream, a); - if (null == expr) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected expression after ['); - if (null == stream.trypop(']')) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected ] after expression.'); - return a.node('Predicate', lhs, expr); - } - /** [14] Expr::= OrExpr - */ - /** [15] PrimaryExpr::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall - * e.g. $x, (3+4), "hi", 32, f(x) - */ - function primaryExpr(stream, a) { - var x = stream.trypopliteral(); - if (null == x) - x = stream.trypopnumber(); - if (null != x) { - return x; - } - var varRef = stream.trypopvarref(); - if (null != varRef) return a.node('VariableReference', varRef); - var funCall = functionCall(stream, a); - if (null != funCall) { - return funCall; - } - if (stream.trypop('(')) { - var e = orExpr(stream, a); - if (null == e) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected expression after (.'); - if (null == stream.trypop(')')) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected ) after expression.'); - return e; - } - return null; - } - /** [16] FunctionCall::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' - * [17] Argument::= Expr - */ - function functionCall(stream, a) { - var name = stream.trypopfuncname(stream, a); - if (null == name) return null; - if (null == stream.trypop('(')) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected ( ) after function name.'); - var params = []; - var first = true; - while (null == stream.trypop(')')) { - if (!first && null == stream.trypop(',')) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected , between arguments of the function.'); - first = false; - var param = orExpr(stream, a); - if (param == null) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected expression as argument of function.'); - params.push(param); - } - return a.node('FunctionCall', name, params); - } - - /** [18] UnionExpr::= PathExpr | UnionExpr '|' PathExpr - */ - function unionExpr(stream, a) { return binaryL(pathExpr, stream, a, '|'); } - /** [19] PathExpr ::= LocationPath - * | FilterExpr - * | FilterExpr '/' RelativeLocationPath - * | FilterExpr '//' RelativeLocationPath - * Unlike most other nodes, this one always generates a node because - * at this point all reverse nodesets must turn into a forward nodeset - */ - function pathExpr(stream, a) { - // We have to do FilterExpr before LocationPath because otherwise - // LocationPath will eat up the name from a function call. - var filter = filterExpr(stream, a); - if (null == filter) { - var loc = locationPath(stream, a); - if (null == loc) { - throw new Error - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': The expression shouldn\'t be empty...'); - } - return a.node('PathExpr', loc); - } - var rel = relativeLocationPath(filter, stream, a, false); - if (filter === rel) return rel; - else return a.node('PathExpr', rel); - } - /** [20] FilterExpr::= PrimaryExpr | FilterExpr Predicate - * aka. FilterExpr ::= PrimaryExpr Predicate* - */ - function filterExpr(stream, a) { - var primary = primaryExpr(stream, a); - if (primary == null) return null; - var pred, lhs = primary; - while (null != (pred = predicate(lhs, stream, a))) { - lhs = pred; - } - return lhs; - } - - /** [21] OrExpr::= AndExpr | OrExpr 'or' AndExpr - */ - function orExpr(stream, a) { - var orig = (stream.peeked || '') + stream.str - var r = binaryL(andExpr, stream, a, 'or'); - var now = (stream.peeked || '') + stream.str; - return r; - } - /** [22] AndExpr::= EqualityExpr | AndExpr 'and' EqualityExpr - */ - function andExpr(stream, a) { return binaryL(equalityExpr, stream, a, 'and'); } - /** [23] EqualityExpr::= RelationalExpr | EqualityExpr '=' RelationalExpr - * | EqualityExpr '!=' RelationalExpr - */ - function equalityExpr(stream, a) { return binaryL(relationalExpr, stream, a, ['=','!=']); } - /** [24] RelationalExpr::= AdditiveExpr | RelationalExpr '<' AdditiveExpr - * | RelationalExpr '>' AdditiveExpr - * | RelationalExpr '<=' AdditiveExpr - * | RelationalExpr '>=' AdditiveExpr - */ - function relationalExpr(stream, a) { return binaryL(additiveExpr, stream, a, ['<','>','<=','>=']); } - /** [25] AdditiveExpr::= MultiplicativeExpr - * | AdditiveExpr '+' MultiplicativeExpr - * | AdditiveExpr '-' MultiplicativeExpr - */ - function additiveExpr(stream, a) { return binaryL(multiplicativeExpr, stream, a, ['+','-']); } - /** [26] MultiplicativeExpr::= UnaryExpr - * | MultiplicativeExpr MultiplyOperator UnaryExpr - * | MultiplicativeExpr 'div' UnaryExpr - * | MultiplicativeExpr 'mod' UnaryExpr - */ - function multiplicativeExpr(stream, a) { return binaryL(unaryExpr, stream, a, ['*','div','mod']); } - /** [27] UnaryExpr::= UnionExpr | '-' UnaryExpr - */ - function unaryExpr(stream, a) { - if (stream.trypop('-')) { - var e = unaryExpr(stream, a); - if (null == e) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Expected unary expression after -'); - return a.node('UnaryMinus', e); - } - else return unionExpr(stream, a); - } - var astFactory = { - node: function() {return Array.prototype.slice.call(arguments);} - }; - - - /*************************************************************************** - * Optimizations (TODO) * - ***************************************************************************/ - /** - * Some things I've been considering: - * 1) a//b becomes a/descendant::b if there's no predicate that uses - * position() or last() - * 2) axis[pred]: when pred doesn't use position, evaluate it just once per - * node in the node-set rather than once per (node, position, last). - * For more optimizations, look up Gecko's optimizer: - * http://mxr.mozilla.org/mozilla-central/source/content/xslt/src/xpath/txXPathOptimizer.cpp - */ - // TODO - function optimize(ast) { - } - - /*************************************************************************** - * Evaluation: axes * - ***************************************************************************/ - - /** - * Data types: For string, number, boolean, we just use Javascript types. - * Node-sets have the form - * {nodes: [node, ...]} - * or {nodes: [node, ...], pos: [[1], [2], ...], lasts: [[1], [2], ...]} - * - * Most of the time, only the node is used and the position information is - * discarded. But if you use a predicate, we need to try every value of - * position and last in case the predicate calls position() or last(). - */ - - /** - * The NodeMultiSet is a helper class to help generate - * {nodes:[], pos:[], lasts:[]} structures. It is useful for the - * descendant, descendant-or-self, following-sibling, and - * preceding-sibling axes for which we can use a stack to organize things. - */ - function NodeMultiSet(isReverseAxis) { - this.nodes = []; - this.pos = []; - this.lasts = []; - this.nextPos = []; - this.seriesIndexes = []; // index within nodes that each series begins. - this.isReverseAxis = isReverseAxis; - this._pushToNodes = isReverseAxis ? Array.prototype.unshift : Array.prototype.push; - } - NodeMultiSet.prototype = { - pushSeries: function pushSeries() { - this.nextPos.push(1); - this.seriesIndexes.push(this.nodes.length); - }, - popSeries: function popSeries() { - console.assert(0 < this.nextPos.length, this.nextPos); - var last = this.nextPos.pop() - 1, - indexInPos = this.nextPos.length, - seriesBeginIndex = this.seriesIndexes.pop(), - seriesEndIndex = this.nodes.length; - for (var i = seriesBeginIndex; i < seriesEndIndex; ++i) { - console.assert(indexInPos < this.lasts[i].length); - console.assert(undefined === this.lasts[i][indexInPos]); - this.lasts[i][indexInPos] = last; - } - }, - finalize: function() { - if (null == this.nextPos) return this; - console.assert(0 === this.nextPos.length); - var lastsJSON = JSON.stringify(this.lasts); - for (var i = 0; i < this.lasts.length; ++i) { - for (var j = 0; j < this.lasts[i].length; ++j) { - console.assert(null != this.lasts[i][j], i + ',' + j + ':' + lastsJSON); - } - } - this.pushSeries = this.popSeries = this.addNode = function() { - throw new Error('Already finalized.'); - }; - return this; - }, - addNode: function addNode(node) { - console.assert(node); - this._pushToNodes.call(this.nodes, node) - this._pushToNodes.call(this.pos, this.nextPos.slice()); - this._pushToNodes.call(this.lasts, new Array(this.nextPos.length)); - for (var i = 0; i < this.nextPos.length; ++i) this.nextPos[i]++; - }, - simplify: function() { - this.finalize(); - return {nodes:this.nodes, pos:this.pos, lasts:this.lasts}; - } - }; - function eachContext(nodeMultiSet) { - var r = []; - for (var i = 0; i < nodeMultiSet.nodes.length; i++) { - var node = nodeMultiSet.nodes[i]; - if (!nodeMultiSet.pos) { - r.push({nodes:[node], pos: [[i + 1]], lasts: [[nodeMultiSet.nodes.length]]}); - } else { - for (var j = 0; j < nodeMultiSet.pos[i].length; ++j) { - r.push({nodes:[node], pos: [[nodeMultiSet.pos[i][j]]], lasts: [[nodeMultiSet.lasts[i][j]]]}); - } - } - } - return r; - } - /** Matcher used in the axes. - */ - function NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase) { - this.nodeTypeNum = nodeTypeNum; - this.nodeName = nodeName; - this.shouldLowerCase = shouldLowerCase; - this.nodeNameTest = - null == nodeName ? this._alwaysTrue : - shouldLowerCase ? this._nodeNameLowerCaseEquals : - this._nodeNameEquals; - } - NodeMatcher.prototype = { - matches: function matches(node) { - if (0 === this.nodeTypeNum || this._nodeTypeMatches(node)) { - return this.nodeNameTest(getNodeName(node)); - } - - return false; - }, - _nodeTypeMatches(nodeOrAttr) { - if (nodeOrAttr.constructor.name === 'Attr' && this.nodeTypeNum === 2) { - return true; - } - return nodeOrAttr.nodeType === this.nodeTypeNum; - }, - _alwaysTrue: function(name) {return true;}, - _nodeNameEquals: function _nodeNameEquals(name) { - return this.nodeName === name; - }, - _nodeNameLowerCaseEquals: function _nodeNameLowerCaseEquals(name) { - return this.nodeName === name.toLowerCase(); - } - }; - - function followingSiblingHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, shift, peek, followingNode, andSelf, isReverseAxis) { - var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); - var nodeMultiSet = new NodeMultiSet(isReverseAxis); - while (0 < nodeList.length) { // can be if for following, preceding - var node = shift.call(nodeList); - console.assert(node != null); - node = followingNode(node); - nodeMultiSet.pushSeries(); - var numPushed = 1; - while (null != node) { - if (! andSelf && matcher.matches(node)) - nodeMultiSet.addNode(node); - if (node === peek.call(nodeList)) { - shift.call(nodeList); - nodeMultiSet.pushSeries(); - numPushed++; - } - if (andSelf && matcher.matches(node)) - nodeMultiSet.addNode(node); - node = followingNode(node); - } - while (0 < numPushed--) - nodeMultiSet.popSeries(); - } - return nodeMultiSet; - } - - /** Returns the next non-descendant node in document order. - * This is the first node in following::node(), if node is the context. - */ - function followingNonDescendantNode(node) { - if (node.ownerElement) { - if (node.ownerElement.firstChild) - return node.ownerElement.firstChild; - node = node.ownerElement; - } - do { - if (node.nextSibling) return node.nextSibling; - } while (node = node.parentNode); - return null; - } - - /** Returns the next node in a document-order depth-first search. - * See the definition of document order[1]: - * 1) element - * 2) namespace nodes - * 3) attributes - * 4) children - * [1]: http://www.w3.org/TR/xpath/#dt-document-order - */ - function followingNode(node) { - if (node.ownerElement) // attributes: following node of element. - node = node.ownerElement; - if (null != node.firstChild) - return node.firstChild; - do { - if (null != node.nextSibling) { - return node.nextSibling; - } - node = node.parentNode; - } while (node); - return null; - } - /** Returns the previous node in document order (excluding attributes - * and namespace nodes). - */ - function precedingNode(node) { - if (node.ownerElement) - return node.ownerElement; - if (null != node.previousSibling) { - node = node.previousSibling; - while (null != node.lastChild) { - node = node.lastChild; - } - return node; - } - if (null != node.parentNode) { - return node.parentNode; - } - return null; - } - /** This axis is inefficient if there are many nodes in the nodeList. - * But I think it's a pretty useless axis so it's ok. */ - function followingHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); - var nodeMultiSet = new NodeMultiSet(false); - var cursor = nodeList[0]; - var unorderedFollowingStarts = []; - for (var i = 0; i < nodeList.length; i++) { - var node = nodeList[i]; - var start = followingNonDescendantNode(node); - if (start) - unorderedFollowingStarts.push(start); - } - if (0 === unorderedFollowingStarts.length) - return {nodes:[]}; - var pos = [], nextPos = []; - var started = 0; - while (cursor = followingNode(cursor)) { - for (var i = unorderedFollowingStarts.length - 1; i >= 0; i--){ - if (cursor === unorderedFollowingStarts[i]) { - nodeMultiSet.pushSeries(); - unorderedFollowingStarts.splice(i,i+1); - started++; - } - } - if (started && matcher.matches(cursor)) { - nodeMultiSet.addNode(cursor); - } - } - console.assert(0 === unorderedFollowingStarts.length); - for (var i = 0; i < started; i++) - nodeMultiSet.popSeries(); - return nodeMultiSet.finalize(); - } - function precedingHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); - var cursor = nodeList.pop(); - if (null == cursor) return {nodes:{}}; - var r = {nodes:[], pos:[], lasts:[]}; - var nextParents = [cursor.parentNode || cursor.ownerElement], nextPos = [1]; - while (cursor = precedingNode(cursor)) { - if (cursor === nodeList[nodeList.length - 1]) { - nextParents.push(nodeList.pop()); - nextPos.push(1); - } - var matches = matcher.matches(cursor); - var pos, someoneUsed = false; - if (matches) - pos = nextPos.slice(); - - for (var i = 0; i < nextParents.length; ++i) { - if (cursor === nextParents[i]) { - nextParents[i] = cursor.parentNode || cursor.ownerElement; - if (matches) { - pos[i] = null; - } - } else { - if (matches) { - pos[i] = nextPos[i]++; - someoneUsed = true; - } - } - } - if (someoneUsed) { - r.nodes.unshift(cursor); - r.pos.unshift(pos); - } - } - for (var i = 0; i < r.pos.length; ++i) { - var lasts = []; - r.lasts.push(lasts); - for (var j = r.pos[i].length - 1; j >= 0; j--) { - if (null == r.pos[i][j]) { - r.pos[i].splice(j, j+1); - } else { - lasts.unshift(nextPos[j] - 1); - } - } - } - return r; - } - - /** node-set, axis -> node-set */ - function descendantDfs(nodeMultiSet, node, remaining, matcher, andSelf, attrIndices, attrNodes) { - while (0 < remaining.length && null != remaining[0].ownerElement) { - var attr = remaining.shift(); - if (andSelf && matcher.matches(attr)) { - attrNodes.push(attr); - attrIndices.push(nodeMultiSet.nodes.length); - } - } - if (null != node && !andSelf) { - if (matcher.matches(node)) - nodeMultiSet.addNode(node); - } - var pushed = false; - if (null == node) { - if (0 === remaining.length) return; - node = remaining.shift(); - nodeMultiSet.pushSeries(); - pushed = true; - } else if (0 < remaining.length && node === remaining[0]) { - nodeMultiSet.pushSeries(); - pushed = true; - remaining.shift(); - } - if (andSelf) { - if (matcher.matches(node)) - nodeMultiSet.addNode(node); - } - // TODO: use optimization. Also try element.getElementsByTagName - // var nodeList = 1 === nodeTypeNum && null != node.children ? node.children : node.childNodes; - var nodeList = node.childNodes; - for (var j = 0; j < nodeList.length; ++j) { - var child = nodeList[j]; - descendantDfs(nodeMultiSet, child, remaining, matcher, andSelf, attrIndices, attrNodes); - } - if (pushed) { - nodeMultiSet.popSeries(); - } - } - function descenantHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, andSelf) { - var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); - var nodeMultiSet = new NodeMultiSet(false); - var attrIndices = [], attrNodes = []; - while (0 < nodeList.length) { - // var node = nodeList.shift(); - descendantDfs(nodeMultiSet, null, nodeList, matcher, andSelf, attrIndices, attrNodes); - } - nodeMultiSet.finalize(); - for (var i = attrNodes.length-1; i >= 0; --i) { - nodeMultiSet.nodes.splice(attrIndices[i], attrIndices[i], attrNodes[i]); - nodeMultiSet.pos.splice(attrIndices[i], attrIndices[i], [1]); - nodeMultiSet.lasts.splice(attrIndices[i], attrIndices[i], [1]); - } - return nodeMultiSet; - } - /** - */ - function ancestorHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, andSelf) { - var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); - var ancestors = []; // array of non-empty arrays of matching ancestors - for (var i = 0; i < nodeList.length; ++i) { - var node = nodeList[i]; - var isFirst = true; - var a = []; - while (null != node) { - if (!isFirst || andSelf) { - if (matcher.matches(node)) - a.push(node); - } - isFirst = false; - node = node.parentNode || node.ownerElement; - } - if (0 < a.length) - ancestors.push(a); - } - var lasts = []; - for (var i = 0; i < ancestors.length; ++i) lasts.push(ancestors[i].length); - var nodeMultiSet = new NodeMultiSet(true); - var newCtx = {nodes:[], pos:[], lasts:[]}; - while (0 < ancestors.length) { - var pos = [ancestors[0].length]; - var last = [lasts[0]]; - var node = ancestors[0].pop(); - for (var i = ancestors.length - 1; i > 0; --i) { - if (node === ancestors[i][ancestors[i].length - 1]) { - pos.push(ancestors[i].length); - last.push(lasts[i]); - ancestors[i].pop(); - if (0 === ancestors[i].length) { - ancestors.splice(i, i+1); - lasts.splice(i, i+1); - } - } - } - if (0 === ancestors[0].length) { - ancestors.shift(); - lasts.shift(); - } - newCtx.nodes.push(node); - newCtx.pos.push(pos); - newCtx.lasts.push(last); - } - return newCtx; - } - /** Helper function for sortDocumentOrder. Returns a list of indices, from the - * node to the root, of positions within parent. - * For convenience, the node is the first element of the array. - */ - function addressVector(node) { - var r = [node]; - if (null != node.ownerElement) { - node = node.ownerElement; - r.push(-1); - } - while (null != node) { - var i = 0; - while (null != node.previousSibling) { - node = node.previousSibling; - i++; - } - r.push(i); - node = node.parentNode - } - return r; - } - function addressComparator(a, b) { - var minlen = Math.min(a.length - 1, b.length - 1), // not including [0]=node - alen = a.length, - blen = b.length; - if (a[0] === b[0]) return 0; - var c; - for (var i = 0; i < minlen; ++i) { - c = a[alen - i - 1] - b[blen - i - 1]; - if (0 !== c) - break; - } - if (null == c || 0 === c) { - // All equal until one of the nodes. The longer one is the descendant. - c = alen - blen; - } - if (0 === c) - c = getNodeName(a) - getNodeName(b); - if (0 === c) - c = 1; - return c; - } - var sortUniqDocumentOrder = xpath.sortUniqDocumentOrder = function(nodes) { - var a = []; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - var v = addressVector(node); - a.push(v); - } - a.sort(addressComparator); - var b = []; - for (var i = 0; i < a.length; i++) { - if (0 < i && a[i][0] === a[i - 1][0]) - continue; - b.push(a[i][0]); - } - return b; - } - /** Sort node multiset. Does not do any de-duping. */ - function sortNodeMultiSet(nodeMultiSet) { - var a = []; - for (var i = 0; i < nodeMultiSet.nodes.length; i++) { - var v = addressVector(nodeMultiSet.nodes[i]); - a.push({v:v, n:nodeMultiSet.nodes[i], - p:nodeMultiSet.pos[i], l:nodeMultiSet.lasts[i]}); - } - a.sort(compare); - var r = {nodes:[], pos:[], lasts:[]}; - for (var i = 0; i < a.length; ++i) { - r.nodes.push(a[i].n); - r.pos.push(a[i].p); - r.lasts.push(a[i].l); - } - function compare(x, y) { - return addressComparator(x.v, y.v); - } - return r; - } - /** Returns an array containing all the ancestors down to a node. - * The array starts with document. - */ - function nodeAndAncestors(node) { - var ancestors = [node]; - var p = node; - while (p = p.parentNode || p.ownerElement) { - ancestors.unshift(p); - } - return ancestors; - } - function compareSiblings(a, b) { - if (a === b) return 0; - var c = a; - while (c = c.previousSibling) { - if (c === b) - return 1; // b < a - } - c = b; - while (c = c.previousSibling) { - if (c === a) - return -1; // a < b - } - throw new Error('a and b are not siblings: ' + xpath.stringifyObject(a) + ' vs ' + xpath.stringifyObject(b)); - } - /** The merge in merge-sort.*/ - function mergeNodeLists(x, y) { - var a, b, aanc, banc, r = []; - if ('object' !== typeof x) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Invalid LHS for | operator ' + - '(expected node-set): ' + x); - if ('object' !== typeof y) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Invalid LHS for | operator ' + - '(expected node-set): ' + y); - while (true) { - if (null == a) { - a = x.shift(); - if (null != a) - aanc = addressVector(a); - } - if (null == b) { - b = y.shift(); - if (null != b) - banc = addressVector(b); - } - if (null == a || null == b) break; - var c = addressComparator(aanc, banc); - if (c < 0) { - r.push(a); - a = null; - aanc = null; - } else if (c > 0) { - r.push(b); - b = null; - banc = null; - } else if (getNodeName(a) < getNodeName(b)) { // attributes - r.push(a); - a = null; - aanc = null; - } else if (getNodeName(a) > getNodeName(b)) { // attributes - r.push(b); - b = null; - banc = null; - } else if (a !== b) { - // choose b arbitrarily - r.push(b); - b = null; - banc = null; - } else { - console.assert(a === b, c); - // just skip b without pushing it. - b = null; - banc = null; - } - } - while (a) { - r.push(a); - a = x.shift(); - } - while (b) { - r.push(b); - b = y.shift(); - } - return r; - } - function comparisonHelper(test, x, y, isNumericComparison) { - var coersion; - if (isNumericComparison) - coersion = fn.number; - else coersion = - 'boolean' === typeof x || 'boolean' === typeof y ? fn['boolean'] : - 'number' === typeof x || 'number' === typeof y ? fn.number : - fn.string; - if ('object' === typeof x && 'object' === typeof y) { - var aMap = {}; - for (var i = 0; i < x.nodes.length; ++i) { - var xi = coersion({nodes:[x.nodes[i]]}); - for (var j = 0; j < y.nodes.length; ++j) { - var yj = coersion({nodes:[y.nodes[j]]}); - if (test(xi, yj)) return true; - } - } - return false; - } else if ('object' === typeof x && x.nodes && x.nodes.length) { - for (var i = 0; i < x.nodes.length; ++i) { - var xi = coersion({nodes:[x.nodes[i]]}), yc = coersion(y); - if (test(xi, yc)) - return true; - } - return false; - } else if ('object' === typeof y && x.nodes && x.nodes.length) { - for (var i = 0; i < x.nodes.length; ++i) { - var yi = coersion({nodes:[y.nodes[i]]}), xc = coersion(x); - if (test(xc, yi)) - return true; - } - return false; - } else { - var xc = coersion(x), yc = coersion(y); - return test(xc, yc); - } - } - var axes = xpath.axes = { - 'ancestor': - function ancestor(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - return ancestorHelper( - nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, false); - }, - 'ancestor-or-self': - function ancestorOrSelf(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - return ancestorHelper( - nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, true); - }, - 'attribute': - function attribute(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - // TODO: figure out whether positions should be undefined here. - var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); - var nodeMultiSet = new NodeMultiSet(false); - if (null != nodeName) { - // TODO: with namespace - for (var i = 0; i < nodeList.length; ++i) { - var node = nodeList[i]; - if (null == node.getAttributeNode) - continue; // only Element has .getAttributeNode - var attr = node.getAttributeNode(nodeName); - if (null != attr && matcher.matches(attr)) { - nodeMultiSet.pushSeries(); - nodeMultiSet.addNode(attr); - nodeMultiSet.popSeries(); - } - } - } else { - for (var i = 0; i < nodeList.length; ++i) { - var node = nodeList[i]; - if (null != node.attributes) { - nodeMultiSet.pushSeries(); - for (var j = 0; j < node.attributes.length; j++) { // all nodes have .attributes - var attr = node.attributes[j]; - if (matcher.matches(attr)) // TODO: I think this check is unnecessary - nodeMultiSet.addNode(attr); - } - nodeMultiSet.popSeries(); - } - } - } - return nodeMultiSet.finalize(); - }, - 'child': - function child(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); - var nodeMultiSet = new NodeMultiSet(false); - for (var i = 0; i < nodeList.length; ++i) { - var n = nodeList[i]; - if (n.ownerElement) // skip attribute nodes' text child. - continue; - if (n.childNodes) { - nodeMultiSet.pushSeries(); - var childList = 1 === nodeTypeNum && null != n.children ? - n.children : n.childNodes; - for (var j = 0; j < childList.length; ++j) { - var child = childList[j]; - if (matcher.matches(child)) { - nodeMultiSet.addNode(child); - } - // don't have to do de-duping because children have parent, - // which are current context. - } - nodeMultiSet.popSeries(); - } - } - nodeMultiSet.finalize(); - return sortNodeMultiSet(nodeMultiSet); - }, - 'descendant': - function descenant(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - return descenantHelper( - nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, false); - }, - 'descendant-or-self': - function descenantOrSelf(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - return descenantHelper( - nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, true); - }, - 'following': - function following(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - return followingHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase); - }, - 'following-sibling': - function followingSibling(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - return followingSiblingHelper( - nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, - Array.prototype.shift, function() {return this[0];}, - function(node) {return node.nextSibling;}); - }, - 'namespace': - function namespace(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - // TODO - }, - 'parent': - function parent(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); - var nodes = [], pos = []; - for (var i = 0; i < nodeList.length; ++i) { - var parent = nodeList[i].parentNode || nodeList[i].ownerElement; - if (null == parent) - continue; - if (!matcher.matches(parent)) - continue; - if (nodes.length > 0 && parent === nodes[nodes.length-1]) - continue; - nodes.push(parent); - pos.push([1]); - } - return {nodes:nodes, pos:pos, lasts:pos}; - }, - 'preceding': - function preceding(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - return precedingHelper( - nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase); - }, - 'preceding-sibling': - function precedingSibling(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - return followingSiblingHelper( - nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, - Array.prototype.pop, function() {return this[this.length-1];}, - function(node) {return node.previousSibling}, - false, true); - }, - 'self': - function self(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { - var nodes = [], pos = []; - var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); - for (var i = 0; i < nodeList.length; ++i) { - if (matcher.matches(nodeList[i])) { - nodes.push(nodeList[i]); - pos.push([1]); - } - } - return {nodes: nodes, pos: pos, lasts: pos} - } - }; - - /*************************************************************************** - * Evaluation: functions * - ***************************************************************************/ - var fn = { - 'number': function number(optObject) { - if ('number' === typeof optObject) - return optObject; - if ('string' === typeof optObject) - return parseFloat(optObject); // note: parseFloat(' ') -> NaN, unlike +' ' -> 0. - if ('boolean' === typeof optObject) - return +optObject; - return fn.number(fn.string.call(this, optObject)); // for node-sets - }, - 'string': function string(optObject) { - if (null == optObject) - return fn.string(this); - if ('string' === typeof optObject || 'boolean' === typeof optObject || - 'number' === typeof optObject) - return '' + optObject; - if (0 == optObject.nodes.length) return ''; - if (null != optObject.nodes[0].textContent) - return optObject.nodes[0].textContent; - return optObject.nodes[0].nodeValue; - }, - 'boolean': function booleanVal(x) { - return 'object' === typeof x ? x.nodes.length > 0 : !!x; - }, - 'last': function last() { - console.assert(Array.isArray(this.pos)); - console.assert(Array.isArray(this.lasts)); - console.assert(1 === this.pos.length); - console.assert(1 === this.lasts.length); - console.assert(1 === this.lasts[0].length); - return this.lasts[0][0]; - }, - 'position': function position() { - console.assert(Array.isArray(this.pos)); - console.assert(Array.isArray(this.lasts)); - console.assert(1 === this.pos.length); - console.assert(1 === this.lasts.length); - console.assert(1 === this.pos[0].length); - return this.pos[0][0]; - }, - 'count': function count(nodeSet) { - if ('object' !== typeof nodeSet) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Position ' + stream.position() + - ': Function count(node-set) ' + - 'got wrong argument type: ' + nodeSet); - return nodeSet.nodes.length; - }, - 'id': function id(object) { - var r = {nodes: []}; - var doc = this.nodes[0].ownerDocument || this.nodes[0]; - console.assert(doc); - var ids; - if ('object' === typeof object) { - // for node-sets, map id over each node value. - ids = []; - for (var i = 0; i < object.nodes.length; ++i) { - var idNode = object.nodes[i]; - var idsString = fn.string({nodes:[idNode]}); - var a = idsString.split(/[ \t\r\n]+/g); - Array.prototype.push.apply(ids, a); - } - } else { - var idsString = fn.string(object); - var a = idsString.split(/[ \t\r\n]+/g); - ids = a; - } - for (var i = 0; i < ids.length; ++i) { - var id = ids[i]; - if (0 === id.length) - continue; - var node = doc.getElementById(id); - if (null != node) - r.nodes.push(node); - } - r.nodes = sortUniqDocumentOrder(r.nodes); - return r; - }, - 'local-name': function(nodeSet) { - if (null == nodeSet) - return fn.name(this); - if (null == nodeSet.nodes) { - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'argument to name() must be a node-set. got ' + nodeSet); - } - // TODO: namespaced version - return nodeSet.nodes[0].localName; - }, - 'namespace-uri': function(nodeSet) { - // TODO - throw new Error('not implemented yet'); - }, - 'name': function(nodeSet) { - if (null == nodeSet) - return fn.name(this); - if (null == nodeSet.nodes) { - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'argument to name() must be a node-set. got ' + nodeSet); - } - return nodeSet.nodes[0].name; - }, - 'concat': function concat(x) { - var l = []; - for (var i = 0; i < arguments.length; ++i) { - l.push(fn.string(arguments[i])); - } - return l.join(''); - }, - 'starts-with': function startsWith(a, b) { - var as = fn.string(a), bs = fn.string(b); - return as.substr(0, bs.length) === bs; - }, - 'contains': function contains(a, b) { - var as = fn.string(a), bs = fn.string(b); - var i = as.indexOf(bs); - if (-1 === i) return false; - return true; - }, - 'substring-before': function substringBefore(a, b) { - var as = fn.string(a), bs = fn.string(b); - var i = as.indexOf(bs); - if (-1 === i) return ''; - return as.substr(0, i); - }, - 'substring-after': function substringBefore(a, b) { - var as = fn.string(a), bs = fn.string(b); - var i = as.indexOf(bs); - if (-1 === i) return ''; - return as.substr(i + bs.length); - }, - 'substring': function substring(string, start, optEnd) { - if (null == string || null == start) { - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Must be at least 2 arguments to string()'); - } - var sString = fn.string(string), - iStart = fn.round(start), - iEnd = optEnd == null ? null : fn.round(optEnd); - // Note that xpath string positions user 1-based index - if (iEnd == null) - return sString.substr(iStart - 1); - else - return sString.substr(iStart - 1, iEnd); - }, - 'string-length': function stringLength(optString) { - return fn.string.call(this, optString).length; - }, - 'normalize-space': function normalizeSpace(optString) { - var s = fn.string.call(this, optString); - return s.replace(/[ \t\r\n]+/g, ' ').replace(/^ | $/g, ''); - }, - 'translate': function translate(string, from, to) { - var sString = fn.string.call(this, string), - sFrom = fn.string(from), - sTo = fn.string(to); - var eachCharRe = []; - var map = {}; - for (var i = 0; i < sFrom.length; ++i) { - var c = sFrom.charAt(i); - map[c] = sTo.charAt(i); // returns '' if beyond length of sTo. - // copied from goog.string.regExpEscape in the Closure library. - eachCharRe.push( - c.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1'). - replace(/\x08/g, '\\x08')); - } - var re = new RegExp(eachCharRe.join('|'), 'g'); - return sString.replace(re, function(c) {return map[c];}); - }, - /// Boolean functions - 'not': function not(x) { - var bx = fn['boolean'](x); - return !bx; - }, - 'true': function trueVal() { return true; }, - 'false': function falseVal() { return false; }, - // TODO - 'lang': function lang(string) { throw new Error('Not implemented');}, - 'sum': function sum(optNodeSet) { - if (null == optNodeSet) return fn.sum(this); - // for node-sets, map id over each node value. - var sum = 0; - for (var i = 0; i < optNodeSet.nodes.length; ++i) { - var node = optNodeSet.nodes[i]; - var x = fn.number({nodes:[node]}); - sum += x; - } - return sum; - }, - 'floor': function floor(number) { - return Math.floor(fn.number(number)); - }, - 'ceiling': function ceiling(number) { - return Math.ceil(fn.number(number)); - }, - 'round': function round(number) { - return Math.round(fn.number(number)); - } - }; - /*************************************************************************** - * Evaluation: operators * - ***************************************************************************/ - var more = { - UnaryMinus: function(x) { return -fn.number(x); }, - '+': function(x, y) { return fn.number(x) + fn.number(y); }, - '-': function(x, y) { return fn.number(x) - fn.number(y); }, - '*': function(x, y) { return fn.number(x) * fn.number(y); }, - 'div': function(x, y) { return fn.number(x) / fn.number(y); }, - 'mod': function(x, y) { return fn.number(x) % fn.number(y); }, - '<': function(x, y) { - return comparisonHelper(function(x, y) { return fn.number(x) < fn.number(y);}, x, y, true); - }, - '<=': function(x, y) { - return comparisonHelper(function(x, y) { return fn.number(x) <= fn.number(y);}, x, y, true); - }, - '>': function(x, y) { - return comparisonHelper(function(x, y) { return fn.number(x) > fn.number(y);}, x, y, true); - }, - '>=': function(x, y) { - return comparisonHelper(function(x, y) { return fn.number(x) >= fn.number(y);}, x, y, true); - }, - 'and': function(x, y) { return fn['boolean'](x) && fn['boolean'](y); }, - 'or': function(x, y) { return fn['boolean'](x) || fn['boolean'](y); }, - '|': function(x, y) { return {nodes: mergeNodeLists(x.nodes, y.nodes)}; }, - '=': function(x, y) { - // optimization for two node-sets case: avoid n^2 comparisons. - if ('object' === typeof x && 'object' === typeof y) { - var aMap = {}; - for (var i = 0; i < x.nodes.length; ++i) { - var s = fn.string({nodes:[x.nodes[i]]}); - aMap[s] = true; - } - for (var i = 0; i < y.nodes.length; ++i) { - var s = fn.string({nodes:[y.nodes[i]]}); - if (aMap[s]) return true; - } - return false; - } else { - return comparisonHelper(function(x, y) {return x === y;}, x, y); - } - }, - '!=': function(x, y) { - // optimization for two node-sets case: avoid n^2 comparisons. - if ('object' === typeof x && 'object' === typeof y) { - if (0 === x.nodes.length || 0 === y.nodes.length) return false; - var aMap = {}; - for (var i = 0; i < x.nodes.length; ++i) { - var s = fn.string({nodes:[x.nodes[i]]}); - aMap[s] = true; - } - for (var i = 0; i < y.nodes.length; ++i) { - var s = fn.string({nodes:[y.nodes[i]]}); - if (!aMap[s]) return true; - } - return false; - } else { - return comparisonHelper(function(x, y) {return x !== y;}, x, y); - } - } - }; - var nodeTypes = xpath.nodeTypes = { - 'node': 0, - 'attribute': 2, - 'comment': 8, // this.doc.COMMENT_NODE, - 'text': 3, // this.doc.TEXT_NODE, - 'processing-instruction': 7, // this.doc.PROCESSING_INSTRUCTION_NODE, - 'element': 1 //this.doc.ELEMENT_NODE - }; - /** For debugging and unit tests: returnjs a stringified version of the - * argument. */ - var stringifyObject = xpath.stringifyObject = function stringifyObject(ctx) { - var seenKey = 'seen' + Math.floor(Math.random()*1000000000); - return JSON.stringify(helper(ctx)); - - function helper(ctx) { - if (Array.isArray(ctx)) { - return ctx.map(function(x) {return helper(x);}); - } - if ('object' !== typeof ctx) return ctx; - if (null == ctx) return ctx; - // if (ctx.toString) return ctx.toString(); - if (null != ctx.outerHTML) return ctx.outerHTML; - if (null != ctx.nodeValue) return ctx.nodeName + '=' + ctx.nodeValue; - if (ctx[seenKey]) return '[circular]'; - ctx[seenKey] = true; - var nicer = {}; - for (var key in ctx) { - if (seenKey === key) - continue; - try { - nicer[key] = helper(ctx[key]); - } catch (e) { - nicer[key] = '[exception: ' + e.message + ']'; - } - } - delete ctx[seenKey]; - return nicer; - } - } - var Evaluator = xpath.Evaluator = function Evaluator(doc) { - this.doc = doc; - } - Evaluator.prototype = { - val: function val(ast, ctx) { - console.assert(ctx.nodes); - - if ('number' === typeof ast || 'string' === typeof ast) return ast; - if (more[ast[0]]) { - var evaluatedParams = []; - for (var i = 1; i < ast.length; ++i) { - evaluatedParams.push(this.val(ast[i], ctx)); - } - var r = more[ast[0]].apply(ctx, evaluatedParams); - return r; - } - switch (ast[0]) { - case 'Root': return {nodes: [this.doc]}; - case 'FunctionCall': - var functionName = ast[1], functionParams = ast[2]; - if (null == fn[functionName]) - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, - 'Unknown function: ' + functionName); - var evaluatedParams = []; - for (var i = 0; i < functionParams.length; ++i) { - evaluatedParams.push(this.val(functionParams[i], ctx)); - } - var r = fn[functionName].apply(ctx, evaluatedParams); - return r; - case 'Predicate': - var lhs = this.val(ast[1], ctx); - var ret = {nodes: []}; - var contexts = eachContext(lhs); - for (var i = 0; i < contexts.length; ++i) { - var singleNodeSet = contexts[i]; - var rhs = this.val(ast[2], singleNodeSet); - var success; - if ('number' === typeof rhs) { - success = rhs === singleNodeSet.pos[0][0]; - } else { - success = fn['boolean'](rhs); - } - if (success) { - var node = singleNodeSet.nodes[0]; - ret.nodes.push(node); - // skip over all the rest of the same node. - while (i+1 < contexts.length && node === contexts[i+1].nodes[0]) { - i++; - } - } - } - return ret; - case 'PathExpr': - // turn the path into an expressoin; i.e., remove the position - // information of the last axis. - var x = this.val(ast[1], ctx); - // Make the nodeset a forward-direction-only one. - if (x.finalize) { // it is a NodeMultiSet - return {nodes: x.nodes}; - } else { - return x; - } - case '/': - // TODO: don't generate '/' nodes, just Axis nodes. - var lhs = this.val(ast[1], ctx); - console.assert(null != lhs); - var r = this.val(ast[2], lhs); - console.assert(null != r); - return r; - case 'Axis': - // All the axis tests from Step. We only get AxisSpecifier NodeTest, - // not the predicate (which is applied later) - var axis = ast[1], - nodeType = ast[2], - nodeTypeNum = nodeTypes[nodeType], - shouldLowerCase = true, // TODO: give option - nodeName = ast[3] && shouldLowerCase ? ast[3].toLowerCase() : ast[3]; - nodeName = nodeName === '*' ? null : nodeName; - if ('object' !== typeof ctx) return {nodes:[], pos:[]}; - var nodeList = ctx.nodes.slice(); // TODO: is copy needed? - var r = axes[axis](nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase); - return r; - } - } - }; - var evaluate = xpath.evaluate = function evaluate(expr, doc, context) { - //var astFactory = new AstEvaluatorFactory(doc, context); - var stream = new Stream(expr); - var ast = parse(stream, astFactory); - var val = new Evaluator(doc).val(ast, {nodes: [context]}); - return val; - } - - /*************************************************************************** - * DOM interface * - ***************************************************************************/ - var XPathException = xpath.XPathException = function XPathException(code, message) { - var e = new Error(message); - e.name = 'XPathException'; - e.code = code; - return e; - } - XPathException.INVALID_EXPRESSION_ERR = 51; - XPathException.TYPE_ERR = 52; - - - var XPathEvaluator = xpath.XPathEvaluator = function XPathEvaluator() {} - XPathEvaluator.prototype = { - createExpression: function(expression, resolver) { - return new XPathExpression(expression, resolver); - }, - createNSResolver: function(nodeResolver) { - // TODO - }, - evaluate: function evaluate(expression, contextNode, resolver, type, result) { - var expr = new XPathExpression(expression, resolver); - return expr.evaluate(contextNode, type, result); - } - }; - - - var XPathExpression = xpath.XPathExpression = function XPathExpression(expression, resolver, optDoc) { - var stream = new Stream(expression); - this._ast = parse(stream, astFactory); - this._doc = optDoc; - } - XPathExpression.prototype = { - evaluate: function evaluate(contextNode, type, result) { - if (null == contextNode.nodeType) - throw new Error('bad argument (expected context node): ' + contextNode); - var doc = contextNode.ownerDocument || contextNode; - if (null != this._doc && this._doc !== doc) { - throw new core.DOMException( - core.DOMException.WRONG_DOCUMENT_ERR, - 'The document must be the same as the context node\'s document.'); - } - var evaluator = new Evaluator(doc); - var value = evaluator.val(this._ast, {nodes: [contextNode]}); - if (XPathResult.NUMBER_TYPE === type) - value = fn.number(value); - else if (XPathResult.STRING_TYPE === type) - value = fn.string(value); - else if (XPathResult.BOOLEAN_TYPE === type) - value = fn['boolean'](value); - else if (XPathResult.ANY_TYPE !== type && - XPathResult.UNORDERED_NODE_ITERATOR_TYPE !== type && - XPathResult.ORDERED_NODE_ITERATOR_TYPE !== type && - XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE !== type && - XPathResult.ORDERED_NODE_SNAPSHOT_TYPE !== type && - XPathResult.ANY_UNORDERED_NODE_TYPE !== type && - XPathResult.FIRST_ORDERED_NODE_TYPE !== type) - throw new core.DOMException( - core.DOMException.NOT_SUPPORTED_ERR, - 'You must provide an XPath result type (0=any).'); - else if (XPathResult.ANY_TYPE !== type && - 'object' !== typeof value) - throw new XPathException( - XPathException.TYPE_ERR, - 'Value should be a node-set: ' + value); - return new XPathResult(doc, value, type); - } - } - - var XPathResult = xpath.XPathResult = function XPathResult(doc, value, resultType) { - this._value = value; - this._resultType = resultType; - this._i = 0; - - // TODO: we removed mutation events but didn't take care of this. No tests fail, so that's nice, but eventually we - // should fix this, preferably by entirely replacing our XPath implementation. - // this._invalidated = false; - // if (this.resultType === XPathResult.UNORDERED_NODE_ITERATOR_TYPE || - // this.resultType === XPathResult.ORDERED_NODE_ITERATOR_TYPE) { - // doc.addEventListener('DOMSubtreeModified', invalidate, true); - // var self = this; - // function invalidate() { - // self._invalidated = true; - // doc.removeEventListener('DOMSubtreeModified', invalidate, true); - // } - // } - } - XPathResult.ANY_TYPE = 0; - XPathResult.NUMBER_TYPE = 1; - XPathResult.STRING_TYPE = 2; - XPathResult.BOOLEAN_TYPE = 3; - XPathResult.UNORDERED_NODE_ITERATOR_TYPE = 4; - XPathResult.ORDERED_NODE_ITERATOR_TYPE = 5; - XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE = 6; - XPathResult.ORDERED_NODE_SNAPSHOT_TYPE = 7; - XPathResult.ANY_UNORDERED_NODE_TYPE = 8; - XPathResult.FIRST_ORDERED_NODE_TYPE = 9; - var proto = { - // XPathResultType - get resultType() { - if (this._resultType) return this._resultType; - switch (typeof this._value) { - case 'number': return XPathResult.NUMBER_TYPE; - case 'string': return XPathResult.STRING_TYPE; - case 'boolean': return XPathResult.BOOLEAN_TYPE; - default: return XPathResult.UNORDERED_NODE_ITERATOR_TYPE; - } - }, - get numberValue() { - if (XPathResult.NUMBER_TYPE !== this.resultType) - throw new XPathException(XPathException.TYPE_ERR, - 'You should have asked for a NUMBER_TYPE.'); - return this._value; - }, - get stringValue() { - if (XPathResult.STRING_TYPE !== this.resultType) - throw new XPathException(XPathException.TYPE_ERR, - 'You should have asked for a STRING_TYPE.'); - return this._value; - }, - get booleanValue() { - if (XPathResult.BOOLEAN_TYPE !== this.resultType) - throw new XPathException(XPathException.TYPE_ERR, - 'You should have asked for a BOOLEAN_TYPE.'); - return this._value; - }, - get singleNodeValue() { - if (XPathResult.ANY_UNORDERED_NODE_TYPE !== this.resultType && - XPathResult.FIRST_ORDERED_NODE_TYPE !== this.resultType) - throw new XPathException( - XPathException.TYPE_ERR, - 'You should have asked for a FIRST_ORDERED_NODE_TYPE.'); - return this._value.nodes[0] || null; - }, - get invalidIteratorState() { - if (XPathResult.UNORDERED_NODE_ITERATOR_TYPE !== this.resultType && - XPathResult.ORDERED_NODE_ITERATOR_TYPE !== this.resultType) - return false; - return !!this._invalidated; - }, - get snapshotLength() { - if (XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE !== this.resultType && - XPathResult.ORDERED_NODE_SNAPSHOT_TYPE !== this.resultType) - throw new XPathException( - XPathException.TYPE_ERR, - 'You should have asked for a ORDERED_NODE_SNAPSHOT_TYPE.'); - return this._value.nodes.length; - }, - iterateNext: function iterateNext() { - if (XPathResult.UNORDERED_NODE_ITERATOR_TYPE !== this.resultType && - XPathResult.ORDERED_NODE_ITERATOR_TYPE !== this.resultType) - throw new XPathException( - XPathException.TYPE_ERR, - 'You should have asked for a ORDERED_NODE_ITERATOR_TYPE.'); - if (this.invalidIteratorState) - throw new core.DOMException( - core.DOMException.INVALID_STATE_ERR, - 'The document has been mutated since the result was returned'); - return this._value.nodes[this._i++] || null; - }, - snapshotItem: function snapshotItem(index) { - if (XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE !== this.resultType && - XPathResult.ORDERED_NODE_SNAPSHOT_TYPE !== this.resultType) - throw new XPathException( - XPathException.TYPE_ERR, - 'You should have asked for a ORDERED_NODE_SNAPSHOT_TYPE.'); - return this._value.nodes[index] || null; - } - }; - // so you can access ANY_TYPE etc. from the instances: - XPathResult.prototype = Object.create(XPathResult, - Object.keys(proto).reduce(function (descriptors, name) { - descriptors[name] = Object.getOwnPropertyDescriptor(proto, name); - return descriptors; - }, { - constructor: { - value: XPathResult, - writable: true, - configurable: true - } - })); - - core.XPathException = XPathException; - core.XPathExpression = XPathExpression; - core.XPathResult = XPathResult; - core.XPathEvaluator = XPathEvaluator; - - core.Document.prototype.createExpression = - XPathEvaluator.prototype.createExpression; - - core.Document.prototype.createNSResolver = - XPathEvaluator.prototype.createNSResolver; - - core.Document.prototype.evaluate = XPathEvaluator.prototype.evaluate; - - return xpath; // for tests -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/aborting/AbortController-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/aborting/AbortController-impl.js deleted file mode 100644 index 491f76f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/aborting/AbortController-impl.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -const AbortSignal = require("../generated/AbortSignal"); - -class AbortControllerImpl { - constructor(globalObject) { - this.signal = AbortSignal.createImpl(globalObject, []); - } - - abort(reason) { - this.signal._signalAbort(reason); - } -} - -module.exports = { - implementation: AbortControllerImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/aborting/AbortSignal-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/aborting/AbortSignal-impl.js deleted file mode 100644 index 9bc0aed..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/aborting/AbortSignal-impl.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; - -const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor"); -const { fireAnEvent } = require("../helpers/events"); -const EventTargetImpl = require("../events/EventTarget-impl").implementation; -const AbortSignal = require("../generated/AbortSignal"); -const DOMException = require("../generated/DOMException"); - -class AbortSignalImpl extends EventTargetImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - // make event firing possible - this._ownerDocument = globalObject.document; - - this.reason = undefined; - this.abortAlgorithms = new Set(); - this._dependent = false; - this._sourceSignals = new Set(); - this._dependentSignals = new Set(); - } - - get aborted() { - return this.reason !== undefined; - } - - throwIfAborted() { - if (this.aborted) { - throw this.reason; - } - } - - static abort(globalObject, reason) { - const abortSignal = AbortSignal.createImpl(globalObject, []); - if (reason !== undefined) { - abortSignal.reason = reason; - } else { - abortSignal.reason = DOMException.create(globalObject, ["The operation was aborted.", "AbortError"]); - } - return abortSignal; - } - - // https://dom.spec.whatwg.org/#abortsignal-dependent - static any(globalObject, signals) { - const resultSignal = AbortSignal.createImpl(globalObject, []); - for (const signal of signals) { - if (signal.aborted) { - resultSignal.reason = signal.reason; - return resultSignal; - } - } - - resultSignal.dependent = true; - for (const signal of signals) { - if (!signal.dependent) { - resultSignal._sourceSignals.add(signal); - signal._dependentSignals.add(resultSignal); - } else { - for (const sourceSignal of signal._sourceSignals) { - if (!sourceSignal.aborted && !sourceSignal.dependent) { - resultSignal._sourceSignals.add(sourceSignal); - sourceSignal._dependentSignals.add(resultSignal); - } - } - } - } - return resultSignal; - } - - static timeout(globalObject, milliseconds) { - const signal = AbortSignal.createImpl(globalObject, []); - globalObject.setTimeout(() => { - signal._signalAbort(DOMException.create(globalObject, ["The operation timed out.", "TimeoutError"])); - }, milliseconds); - - return signal; - } - - // https://dom.spec.whatwg.org/#abortsignal-signal-abort - _signalAbort(reason) { - if (this.aborted) { - return; - } - - if (reason !== undefined) { - this.reason = reason; - } else { - this.reason = DOMException.create(this._globalObject, ["The operation was aborted.", "AbortError"]); - } - - const dependentSignalsToAbort = []; - for (const dependentSignal of this._dependentSignals) { - if (!dependentSignal.aborted) { - dependentSignal.reason = this.reason; - dependentSignalsToAbort.push(dependentSignal); - } - } - - this._runAbortStep(); - - for (const dependentSignal of dependentSignalsToAbort) { - dependentSignal._runAbortStep(); - } - } - - _runAbortStep() { - for (const algorithm of this.abortAlgorithms) { - algorithm(); - } - this.abortAlgorithms.clear(); - - fireAnEvent("abort", this); - } - - _addAlgorithm(algorithm) { - if (this.aborted) { - return; - } - this.abortAlgorithms.add(algorithm); - } - - _removeAlgorithm(algorithm) { - this.abortAlgorithms.delete(algorithm); - } -} - -setupForSimpleEventAccessors(AbortSignalImpl.prototype, ["abort"]); - -module.exports = { - implementation: AbortSignalImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/attributes.js b/vanilla/node_modules/jsdom/lib/jsdom/living/attributes.js deleted file mode 100644 index add4e7a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/attributes.js +++ /dev/null @@ -1,312 +0,0 @@ -"use strict"; -const DOMException = require("./generated/DOMException"); - -const { HTML_NS } = require("./helpers/namespaces"); -const { asciiLowercase } = require("./helpers/strings"); -const { queueAttributeMutationRecord } = require("./helpers/mutation-observers"); -const { enqueueCECallbackReaction } = require("./helpers/custom-elements"); - -// The following three are for https://dom.spec.whatwg.org/#concept-element-attribute-has. We don't just have a -// predicate tester since removing that kind of flexibility gives us the potential for better future optimizations. - -/* eslint-disable no-restricted-properties */ - -exports.hasAttribute = function (element, A) { - return element._attributeList.includes(A); -}; - -exports.hasAttributeByName = function (element, name) { - return element._attributesByNameMap.has(name); -}; - -exports.hasAttributeByNameNS = function (element, namespace, localName) { - return element._attributeList.some(attribute => { - return attribute._localName === localName && attribute._namespace === namespace; - }); -}; - -// https://dom.spec.whatwg.org/#concept-element-attributes-change -exports.changeAttribute = (element, attribute, value) => { - const { _localName, _namespace, _value } = attribute; - - queueAttributeMutationRecord(element, _localName, _namespace, _value); - - if (element._ceState === "custom") { - enqueueCECallbackReaction(element, "attributeChangedCallback", [ - _localName, - _value, - value, - _namespace - ]); - } - - attribute._value = value; - - // Run jsdom hooks; roughly correspond to spec's "An attribute is set and an attribute is changed." - element._attrModified(attribute._qualifiedName, value, _value); -}; - -// https://dom.spec.whatwg.org/#concept-element-attributes-append -exports.appendAttribute = function (element, attribute) { - const { _localName, _namespace, _value } = attribute; - queueAttributeMutationRecord(element, _localName, _namespace, null); - - if (element._ceState === "custom") { - enqueueCECallbackReaction(element, "attributeChangedCallback", [ - _localName, - null, - _value, - _namespace - ]); - } - - const attributeList = element._attributeList; - - attributeList.push(attribute); - attribute._element = element; - - // Sync name cache - const name = attribute._qualifiedName; - const cache = element._attributesByNameMap; - let entry = cache.get(name); - if (!entry) { - entry = []; - cache.set(name, entry); - } - entry.push(attribute); - - // Run jsdom hooks; roughly correspond to spec's "An attribute is set and an attribute is added." - element._attrModified(name, _value, null); -}; - -exports.removeAttribute = function (element, attribute) { - // https://dom.spec.whatwg.org/#concept-element-attributes-remove - - const { _localName, _namespace, _value } = attribute; - - queueAttributeMutationRecord(element, _localName, _namespace, _value); - - if (element._ceState === "custom") { - enqueueCECallbackReaction(element, "attributeChangedCallback", [ - _localName, - _value, - null, - _namespace - ]); - } - - const attributeList = element._attributeList; - - for (let i = 0; i < attributeList.length; ++i) { - if (attributeList[i] === attribute) { - attributeList.splice(i, 1); - attribute._element = null; - - // Sync name cache - const name = attribute._qualifiedName; - const cache = element._attributesByNameMap; - const entry = cache.get(name); - entry.splice(entry.indexOf(attribute), 1); - if (entry.length === 0) { - cache.delete(name); - } - - // Run jsdom hooks; roughly correspond to spec's "An attribute is removed." - element._attrModified(name, null, attribute._value); - - return; - } - } -}; - -exports.replaceAttribute = function (element, oldAttr, newAttr) { - // https://dom.spec.whatwg.org/#concept-element-attributes-replace - - const { _localName, _namespace, _value } = oldAttr; - - queueAttributeMutationRecord(element, _localName, _namespace, _value); - - if (element._ceState === "custom") { - enqueueCECallbackReaction(element, "attributeChangedCallback", [ - _localName, - _value, - newAttr._value, - _namespace - ]); - } - - const attributeList = element._attributeList; - - for (let i = 0; i < attributeList.length; ++i) { - if (attributeList[i] === oldAttr) { - attributeList.splice(i, 1, newAttr); - oldAttr._element = null; - newAttr._element = element; - - // Sync name cache - const name = newAttr._qualifiedName; - const cache = element._attributesByNameMap; - let entry = cache.get(name); - if (!entry) { - entry = []; - cache.set(name, entry); - } - entry.splice(entry.indexOf(oldAttr), 1, newAttr); - - // Run jsdom hooks; roughly correspond to spec's "An attribute is set and an attribute is changed." - element._attrModified(name, newAttr._value, oldAttr._value); - - return; - } - } -}; - -exports.getAttributeByName = function (element, name) { - // https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name - - if (element._namespaceURI === HTML_NS && - element._ownerDocument._parsingMode === "html") { - name = asciiLowercase(name); - } - - const cache = element._attributesByNameMap; - const entry = cache.get(name); - if (!entry) { - return null; - } - - return entry[0]; -}; - -exports.getAttributeByNameNS = function (element, namespace, localName) { - // https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace - - if (namespace === "") { - namespace = null; - } - - const attributeList = element._attributeList; - for (let i = 0; i < attributeList.length; ++i) { - const attr = attributeList[i]; - if (attr._namespace === namespace && attr._localName === localName) { - return attr; - } - } - - return null; -}; - -// Both of the following functions implement https://dom.spec.whatwg.org/#concept-element-attributes-get-value. -// Separated them into two to keep symmetry with other functions. -exports.getAttributeValue = function (element, localName) { - const attr = exports.getAttributeByNameNS(element, null, localName); - - if (!attr) { - return ""; - } - - return attr._value; -}; - -exports.getAttributeValueNS = function (element, namespace, localName) { - const attr = exports.getAttributeByNameNS(element, namespace, localName); - - if (!attr) { - return ""; - } - - return attr._value; -}; - -exports.setAttribute = function (element, attr) { - // https://dom.spec.whatwg.org/#concept-element-attributes-set - - if (attr._element !== null && attr._element !== element) { - throw DOMException.create(element._globalObject, ["The attribute is in use.", "InUseAttributeError"]); - } - - const oldAttr = exports.getAttributeByNameNS(element, attr._namespace, attr._localName); - if (oldAttr === attr) { - return attr; - } - - if (oldAttr !== null) { - exports.replaceAttribute(element, oldAttr, attr); - } else { - exports.appendAttribute(element, attr); - } - - return oldAttr; -}; - -exports.setAttributeValue = function (element, localName, value, prefix, namespace) { - // https://dom.spec.whatwg.org/#concept-element-attributes-set-value - - if (prefix === undefined) { - prefix = null; - } - if (namespace === undefined) { - namespace = null; - } - - const attribute = exports.getAttributeByNameNS(element, namespace, localName); - if (attribute === null) { - const newAttribute = element._ownerDocument._createAttribute({ - namespace, - namespacePrefix: prefix, - localName, - value - }); - exports.appendAttribute(element, newAttribute); - - return; - } - - exports.changeAttribute(element, attribute, value); -}; - -// https://dom.spec.whatwg.org/#set-an-existing-attribute-value -exports.setAnExistingAttributeValue = (attribute, value) => { - const element = attribute._element; - if (element === null) { - attribute._value = value; - } else { - exports.changeAttribute(element, attribute, value); - } -}; - -exports.removeAttributeByName = function (element, name) { - // https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name - - const attr = exports.getAttributeByName(element, name); - - if (attr !== null) { - exports.removeAttribute(element, attr); - } - - return attr; -}; - -exports.removeAttributeByNameNS = function (element, namespace, localName) { - // https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-namespace - - const attr = exports.getAttributeByNameNS(element, namespace, localName); - - if (attr !== null) { - exports.removeAttribute(element, attr); - } - - return attr; -}; - -exports.attributeNames = function (element) { - // Needed by https://dom.spec.whatwg.org/#dom-element-getattributenames - - return element._attributeList.map(a => a._qualifiedName); -}; - -exports.hasAttributes = function (element) { - // Needed by https://dom.spec.whatwg.org/#dom-element-hasattributes - - return element._attributeList.length > 0; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/attributes/Attr-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/attributes/Attr-impl.js deleted file mode 100644 index e5d4daa..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/attributes/Attr-impl.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -const { setAnExistingAttributeValue } = require("../attributes.js"); -const NodeImpl = require("../nodes/Node-impl.js").implementation; -const { ATTRIBUTE_NODE } = require("../node-type.js"); - -exports.implementation = class AttrImpl extends NodeImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._namespace = privateData.namespace !== undefined ? privateData.namespace : null; - this._namespacePrefix = privateData.namespacePrefix !== undefined ? privateData.namespacePrefix : null; - this._localName = privateData.localName; - this._value = privateData.value !== undefined ? privateData.value : ""; - this._element = privateData.element !== undefined ? privateData.element : null; - - this.nodeType = ATTRIBUTE_NODE; - this.specified = true; - } - - get namespaceURI() { - return this._namespace; - } - - get prefix() { - return this._namespacePrefix; - } - - get localName() { - return this._localName; - } - - get name() { - return this._qualifiedName; - } - - get nodeName() { - return this._qualifiedName; - } - - get value() { - return this._value; - } - set value(value) { - setAnExistingAttributeValue(this, value); - } - - get ownerElement() { - return this._element; - } - - get _qualifiedName() { - // https://dom.spec.whatwg.org/#concept-attribute-qualified-name - if (this._namespacePrefix === null) { - return this._localName; - } - - return this._namespacePrefix + ":" + this._localName; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/attributes/NamedNodeMap-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/attributes/NamedNodeMap-impl.js deleted file mode 100644 index a06d5f1..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/attributes/NamedNodeMap-impl.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); -const idlUtils = require("../generated/utils.js"); -const attributes = require("../attributes.js"); -const { HTML_NS } = require("../helpers/namespaces"); - -exports.implementation = class NamedNodeMapImpl { - constructor(globalObject, args, privateData) { - this._element = privateData.element; - - this._globalObject = globalObject; - } - get _attributeList() { - return this._element._attributeList; - } - - get [idlUtils.supportedPropertyIndices]() { - return this._attributeList.keys(); - } - get length() { - return this._attributeList.length; - } - item(index) { - if (index >= this._attributeList.length) { - return null; - } - return this._attributeList[index]; - } - - get [idlUtils.supportedPropertyNames]() { - const names = new Set(this._attributeList.map(a => a._qualifiedName)); - const el = this._element; - if (el._namespaceURI === HTML_NS && el._ownerDocument._parsingMode === "html") { - for (const name of names) { - const lowercaseName = name.toLowerCase(); - if (lowercaseName !== name) { - names.delete(name); - } - } - } - return names; - } - getNamedItem(qualifiedName) { - return attributes.getAttributeByName(this._element, qualifiedName); - } - getNamedItemNS(namespace, localName) { - return attributes.getAttributeByNameNS(this._element, namespace, localName); - } - setNamedItem(attr) { - // eslint-disable-next-line no-restricted-properties - return attributes.setAttribute(this._element, attr); - } - setNamedItemNS(attr) { - // eslint-disable-next-line no-restricted-properties - return attributes.setAttribute(this._element, attr); - } - removeNamedItem(qualifiedName) { - const attr = attributes.removeAttributeByName(this._element, qualifiedName); - if (attr === null) { - throw DOMException.create(this._globalObject, [ - "Tried to remove an attribute that was not present", - "NotFoundError" - ]); - } - return attr; - } - removeNamedItemNS(namespace, localName) { - const attr = attributes.removeAttributeByNameNS(this._element, namespace, localName); - if (attr === null) { - throw DOMException.create(this._globalObject, [ - "Tried to remove an attribute that was not present", - "NotFoundError" - ]); - } - return attr; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/constraint-validation/DefaultConstraintValidation-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/constraint-validation/DefaultConstraintValidation-impl.js deleted file mode 100644 index 189533a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/constraint-validation/DefaultConstraintValidation-impl.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; - -const ValidityState = require("../generated/ValidityState"); -const { isDisabled } = require("../helpers/form-controls"); -const { closest } = require("../helpers/traversal"); -const { fireAnEvent } = require("../helpers/events"); - -exports.implementation = class DefaultConstraintValidationImpl { - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-willvalidate - get willValidate() { - return this._isCandidateForConstraintValidation(); - } - - get validity() { - if (!this._validity) { - this._validity = ValidityState.createImpl(this._globalObject, [], { - element: this - }); - } - return this._validity; - } - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-checkvalidity - checkValidity() { - if (!this._isCandidateForConstraintValidation()) { - return true; - } - if (this._satisfiesConstraints()) { - return true; - } - fireAnEvent("invalid", this, undefined, { cancelable: true }); - return false; - } - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-setcustomvalidity - setCustomValidity(message) { - this._customValidityErrorMessage = message; - } - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-reportvalidity - // Since jsdom has no user interaction, it's the same as #checkValidity - reportValidity() { - return this.checkValidity(); - } - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-validationmessage - get validationMessage() { - const { validity } = this; - if (!this._isCandidateForConstraintValidation() || this._satisfiesConstraints()) { - return ""; - } - const isSufferingFromCustomError = validity.customError; - if (isSufferingFromCustomError) { - return this._customValidityErrorMessage; - } - return "Constraints not satisfied"; - } - - _isCandidateForConstraintValidation() { - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-disabled - return !isDisabled(this) && - // If an element has a datalist element ancestor, - // it is barred from constraint validation. - closest(this, "datalist") === null && - !this._barredFromConstraintValidationSpecialization(); - } - - _isBarredFromConstraintValidation() { - return !this._isCandidateForConstraintValidation(); - } - - _satisfiesConstraints() { - return this.validity.valid; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/constraint-validation/ValidityState-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/constraint-validation/ValidityState-impl.js deleted file mode 100644 index c5bd355..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/constraint-validation/ValidityState-impl.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; - -exports.implementation = class ValidityStateImpl { - constructor(globalObject, args, privateData) { - const { element, state = {} } = privateData; - - this._element = element; - this._state = state; - } - - get badInput() { - return this._failsConstraint("badInput"); - } - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-a-custom-error - get customError() { - return this._element._customValidityErrorMessage !== ""; - } - - get patternMismatch() { - return this._failsConstraint("patternMismatch"); - } - - get rangeOverflow() { - return this._failsConstraint("rangeOverflow"); - } - - get rangeUnderflow() { - return this._failsConstraint("rangeUnderflow"); - } - - get stepMismatch() { - return this._failsConstraint("stepMismatch"); - } - - get tooLong() { - return this._failsConstraint("tooLong"); - } - - get tooShort() { - return this._failsConstraint("tooShort"); - } - - get typeMismatch() { - return this._failsConstraint("typeMismatch"); - } - - get valueMissing() { - return this._failsConstraint("valueMissing"); - } - - _failsConstraint(method) { - const validationMethod = this._state[method]; - if (validationMethod) { - return validationMethod(); - } - - return false; - } - - get valid() { - return !(this.badInput || this.valueMissing || this.customError || - this.patternMismatch || this.rangeOverflow || this.rangeUnderflow || - this.stepMismatch || this.tooLong || this.tooShort || this.typeMismatch); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/crypto/Crypto-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/crypto/Crypto-impl.js deleted file mode 100644 index 611f9f6..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/crypto/Crypto-impl.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; - -const nodeCrypto = require("crypto"); -const DOMException = require("../generated/DOMException"); - -// https://w3c.github.io/webcrypto/#crypto-interface -class CryptoImpl { - constructor(globalObject) { - this._globalObject = globalObject; - } - - // https://w3c.github.io/webcrypto/#Crypto-method-getRandomValues - getRandomValues(array) { - const typeName = getTypedArrayTypeName(array); - if (!(typeName === "Int8Array" || - typeName === "Uint8Array" || - typeName === "Uint8ClampedArray" || - typeName === "Int16Array" || - typeName === "Uint16Array" || - typeName === "Int32Array" || - typeName === "Uint32Array" || - typeName === "BigInt64Array" || - typeName === "BigUint64Array")) { - throw DOMException.create(this._globalObject, [ - `getRandomValues() only accepts integer typed arrays`, - "TypeMismatchError" - ]); - } - - if (array.byteLength > 65536) { - throw DOMException.create(this._globalObject, [ - `getRandomValues() cannot generate more than 65536 bytes of random values; ` + - `${array.byteLength} bytes were requested`, - "QuotaExceededError" - ]); - } - nodeCrypto.randomFillSync(array); - return array; - } - - // https://w3c.github.io/webcrypto/#Crypto-method-randomUUID - randomUUID() { - return nodeCrypto.randomUUID(); - } -} - -exports.implementation = CryptoImpl; - -// See #3395. Subclasses of TypedArrays should properly work, but we can't rely -// on instanceof because Uint8Array may be different across different windows - -// which can happen in JSDOM when running { runScripts: "dangerously" }. As a -// solution, we imitate the behavior of instanceof by walking the proottype -// chain. -function getTypedArrayTypeName(array) { - const target = array.constructor; - const chain = [target.name]; - let proto = Object.getPrototypeOf(target); - while (proto) { - chain.push(proto.name); - proto = Object.getPrototypeOf(proto); - } - - while (chain.length > 0 && chain[chain.length - 1] !== "TypedArray") { - chain.pop(); - } - chain.reverse(); - return chain[1]; -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/cssom/StyleSheetList-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/cssom/StyleSheetList-impl.js deleted file mode 100644 index c786c91..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/cssom/StyleSheetList-impl.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils.js"); - -exports.implementation = class StyleSheetList { - constructor() { - this._list = []; - } - - get length() { - return this._list.length; - } - - item(index) { - const result = this._list[index]; - return result !== undefined ? result : null; - } - - get [idlUtils.supportedPropertyIndices]() { - return this._list.keys(); - } - - _add(sheet) { - const { _list } = this; - if (!_list.includes(sheet)) { - _list.push(sheet); - } - } - - _remove(sheet) { - const { _list } = this; - - const index = _list.indexOf(sheet); - if (index >= 0) { - _list.splice(index, 1); - } - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/custom-elements/CustomElementRegistry-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/custom-elements/CustomElementRegistry-impl.js deleted file mode 100644 index fe7555c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/custom-elements/CustomElementRegistry-impl.js +++ /dev/null @@ -1,279 +0,0 @@ -"use strict"; - -const webIDLConversions = require("webidl-conversions"); -const DOMException = require("../generated/DOMException"); - -const NODE_TYPE = require("../node-type"); - -const { HTML_NS } = require("../helpers/namespaces"); -const { getHTMLElementInterface } = require("../helpers/create-element"); -const { shadowIncludingInclusiveDescendantsIterator } = require("../helpers/shadow-dom"); -const { isValidCustomElementName, tryUpgradeElement, enqueueCEUpgradeReaction } = require("../helpers/custom-elements"); - -const idlUtils = require("../generated/utils"); -const IDLFunction = require("../generated/Function.js"); -const HTMLUnknownElement = require("../generated/HTMLUnknownElement"); - -const LIFECYCLE_CALLBACKS = [ - "connectedCallback", - "disconnectedCallback", - "adoptedCallback", - "attributeChangedCallback" -]; - -function convertToSequenceDOMString(obj) { - if (!obj || !obj[Symbol.iterator]) { - throw new TypeError("Invalid Sequence"); - } - - return Array.from(obj, webIDLConversions.DOMString); -} - -// Returns true is the passed value is a valid constructor. -// Borrowed from: https://stackoverflow.com/a/39336206/3832710 -function isConstructor(value) { - if (typeof value !== "function") { - return false; - } - - try { - const P = new Proxy(value, { - construct() { - return {}; - } - }); - - // eslint-disable-next-line no-new - new P(); - - return true; - } catch { - return false; - } -} - -// https://html.spec.whatwg.org/#customelementregistry -class CustomElementRegistryImpl { - constructor(globalObject) { - this._customElementDefinitions = []; - this._elementDefinitionIsRunning = false; - this._whenDefinedPromiseMap = Object.create(null); - - this._globalObject = globalObject; - } - - // https://html.spec.whatwg.org/#dom-customelementregistry-define - define(name, constructor, options) { - const { _globalObject } = this; - const ctor = constructor.objectReference; - - if (!isConstructor(ctor)) { - throw new TypeError("Constructor argument is not a constructor."); - } - - if (!isValidCustomElementName(name)) { - throw DOMException.create(_globalObject, ["Name argument is not a valid custom element name.", "SyntaxError"]); - } - - const nameAlreadyRegistered = this._customElementDefinitions.some(entry => entry.name === name); - if (nameAlreadyRegistered) { - throw DOMException.create(_globalObject, [ - "This name has already been registered in the registry.", - "NotSupportedError" - ]); - } - - const ctorAlreadyRegistered = this._customElementDefinitions.some(entry => entry.objectReference === ctor); - if (ctorAlreadyRegistered) { - throw DOMException.create(_globalObject, [ - "This constructor has already been registered in the registry.", - "NotSupportedError" - ]); - } - - let localName = name; - - let extendsOption = null; - if (options !== undefined && options.extends) { - extendsOption = options.extends; - } - - if (extendsOption !== null) { - if (isValidCustomElementName(extendsOption)) { - throw DOMException.create(_globalObject, [ - "Option extends value can't be a valid custom element name.", - "NotSupportedError" - ]); - } - - const extendsInterface = getHTMLElementInterface(extendsOption); - if (extendsInterface === HTMLUnknownElement) { - throw DOMException.create(_globalObject, [ - `${extendsOption} is an HTMLUnknownElement.`, - "NotSupportedError" - ]); - } - - localName = extendsOption; - } - - if (this._elementDefinitionIsRunning) { - throw DOMException.create(_globalObject, [ - "Invalid nested custom element definition.", - "NotSupportedError" - ]); - } - - this._elementDefinitionIsRunning = true; - - let disableInternals = false; - let disableShadow = false; - let observedAttributes = []; - let formAssociated = false; - const lifecycleCallbacks = { - connectedCallback: null, - disconnectedCallback: null, - adoptedCallback: null, - attributeChangedCallback: null - }; - - let caughtError; - try { - const { prototype } = ctor; - - if (typeof prototype !== "object") { - throw new TypeError("Invalid constructor prototype."); - } - - for (const callbackName of LIFECYCLE_CALLBACKS) { - const callbackValue = prototype[callbackName]; - - if (callbackValue !== undefined) { - lifecycleCallbacks[callbackName] = IDLFunction.convert(_globalObject, callbackValue, { - context: `The lifecycle callback "${callbackName}"` - }); - } - } - - if (lifecycleCallbacks.attributeChangedCallback !== null) { - const observedAttributesIterable = ctor.observedAttributes; - - if (observedAttributesIterable !== undefined) { - observedAttributes = convertToSequenceDOMString(observedAttributesIterable); - } - } - - let disabledFeatures = []; - const disabledFeaturesIterable = ctor.disabledFeatures; - if (disabledFeaturesIterable) { - disabledFeatures = convertToSequenceDOMString(disabledFeaturesIterable); - } - - const formAssociatedValue = ctor.formAssociated; - - disableInternals = disabledFeatures.includes("internals"); - disableShadow = disabledFeatures.includes("shadow"); - formAssociated = webIDLConversions.boolean(formAssociatedValue); - } catch (err) { - caughtError = err; - } finally { - this._elementDefinitionIsRunning = false; - } - - if (caughtError !== undefined) { - throw caughtError; - } - - const definition = { - name, - localName, - constructor, - objectReference: ctor, - formAssociated, - observedAttributes, - lifecycleCallbacks, - disableShadow, - disableInternals, - constructionStack: [] - }; - - this._customElementDefinitions.push(definition); - - const document = idlUtils.implForWrapper(this._globalObject._document); - - const upgradeCandidates = []; - for (const candidate of shadowIncludingInclusiveDescendantsIterator(document)) { - if ( - (candidate._namespaceURI === HTML_NS && candidate._localName === localName) && - (extendsOption === null || candidate._isValue === name) - ) { - upgradeCandidates.push(candidate); - } - } - - for (const upgradeCandidate of upgradeCandidates) { - enqueueCEUpgradeReaction(upgradeCandidate, definition); - } - - if (this._whenDefinedPromiseMap[name] !== undefined) { - this._whenDefinedPromiseMap[name].resolve(ctor); - delete this._whenDefinedPromiseMap[name]; - } - } - - // https://html.spec.whatwg.org/#dom-customelementregistry-get - get(name) { - const definition = this._customElementDefinitions.find(entry => entry.name === name); - return definition && definition.objectReference; - } - - // https://html.spec.whatwg.org/#dom-customelementregistry-getname - getName(constructor) { - const found = this._customElementDefinitions.find(entry => entry.objectReference === constructor.objectReference); - return found ? found.name : null; - } - - // https://html.spec.whatwg.org/#dom-customelementregistry-whendefined - whenDefined(name) { - if (!isValidCustomElementName(name)) { - return Promise.reject(DOMException.create( - this._globalObject, - ["Name argument is not a valid custom element name.", "SyntaxError"] - )); - } - - const alreadyRegistered = this._customElementDefinitions.find(entry => entry.name === name); - if (alreadyRegistered) { - return Promise.resolve(alreadyRegistered.objectReference); - } - - if (this._whenDefinedPromiseMap[name] === undefined) { - let resolve; - const promise = new Promise(r => { - resolve = r; - }); - - // Store the pending Promise along with the extracted resolve callback to actually resolve the returned Promise, - // once the custom element is registered. - this._whenDefinedPromiseMap[name] = { - promise, - resolve - }; - } - - return this._whenDefinedPromiseMap[name].promise; - } - - // https://html.spec.whatwg.org/#dom-customelementregistry-upgrade - upgrade(root) { - for (const candidate of shadowIncludingInclusiveDescendantsIterator(root)) { - if (candidate.nodeType === NODE_TYPE.ELEMENT_NODE) { - tryUpgradeElement(candidate); - } - } - } -} - -module.exports = { - implementation: CustomElementRegistryImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/custom-elements/ElementInternals-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/custom-elements/ElementInternals-impl.js deleted file mode 100644 index fcc4292..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/custom-elements/ElementInternals-impl.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); -const { getLabelsForLabelable } = require("../helpers/form-controls"); - -class ElementInternalsImpl { - constructor(globalObject, args, { targetElement }) { - this._targetElement = targetElement; - } - - get shadowRoot() { - const shadow = this._targetElement._shadowRoot; - - if (!shadow || !shadow._availableToElementInternals) { - return null; - } - - return shadow; - } - - get labels() { - if (!this._targetElement._ceDefinition.formAssociated) { - throw DOMException.create(this._targetElement._globalObject, [ - "Accesing an ElementInternal's labels property is only supported for form-associated custom elements", - "NotSupportedError" - ]); - } - - return getLabelsForLabelable(this._targetElement); - } - - // https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes - _reflectGetTheElement() { - return this._targetElement; - } - - _reflectGetTheContentAttribute(reflectedContentAttributeName) { - return this._targetElement._internalContentAttributeMap?.get(reflectedContentAttributeName) ?? null; - } - - _reflectSetTheContentAttribute(reflectedContentAttributeName, value) { - if (!this._targetElement._internalContentAttributeMap) { - this._targetElement._internalContentAttributeMap = new Map(); - } - - this._targetElement._internalContentAttributeMap.set(reflectedContentAttributeName, value); - } - - _reflectDeleteTheContentAttribute(reflectedContentAttributeName) { - this._targetElement._internalContentAttributeMap?.delete(reflectedContentAttributeName); - } -} - -module.exports = { - implementation: ElementInternalsImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventAcceleration-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventAcceleration-impl.js deleted file mode 100644 index 045644a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventAcceleration-impl.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -class DeviceMotionEventAccelerationImpl {} - -module.exports = { - implementation: DeviceMotionEventAccelerationImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventRotationRate-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventRotationRate-impl.js deleted file mode 100644 index 1c21822..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventRotationRate-impl.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -class DeviceMotionEventRotationRateImpl {} - -module.exports = { - implementation: DeviceMotionEventRotationRateImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/documents.js b/vanilla/node_modules/jsdom/lib/jsdom/living/documents.js deleted file mode 100644 index a9ad0ce..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/documents.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -const XMLDocument = require("../living/generated/XMLDocument.js"); -const Document = require("../living/generated/Document.js"); -const { wrapperForImpl } = require("./generated/utils.js"); - -exports.createImpl = (globalObject, options, { alwaysUseDocumentClass = false } = {}) => { - if (options.parsingMode === "xml" && !alwaysUseDocumentClass) { - return XMLDocument.createImpl(globalObject, [], { options }); - } - return Document.createImpl(globalObject, [], { options }); -}; - -exports.createWrapper = (...args) => { - return wrapperForImpl(exports.createImpl(...args)); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/DOMParser-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/DOMParser-impl.js deleted file mode 100644 index 5cacd40..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/DOMParser-impl.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; - -const { parseIntoDocument } = require("../../browser/parser"); - -const idlUtils = require("../generated/utils"); -const Document = require("../generated/Document"); - -exports.implementation = class DOMParserImpl { - constructor(globalObject) { - this._globalObject = globalObject; - } - - parseFromString(string, contentType) { - switch (String(contentType)) { - case "text/html": { - return this.createScriptingDisabledDocument("html", contentType, string); - } - - case "text/xml": - case "application/xml": - case "application/xhtml+xml": - case "image/svg+xml": { - try { - return this.createScriptingDisabledDocument("xml", contentType, string); - } catch (error) { - const document = this.createScriptingDisabledDocument("xml", contentType); - const element = document.createElementNS("http://www.mozilla.org/newlayout/xml/parsererror.xml", "parsererror"); - - element.textContent = error.message; - - document.appendChild(element); - return document; - } - } - - default: - throw new TypeError("Invalid contentType"); - } - } - - createScriptingDisabledDocument(parsingMode, contentType, string) { - const document = Document.createImpl(this._globalObject, [], { - options: { - parsingMode, - encoding: "UTF-8", - contentType, - readyState: "complete", - scriptingDisabled: true, - url: idlUtils.implForWrapper(this._globalObject._document).URL - } - }); - - if (string !== undefined) { - parseIntoDocument(string, document); - } - - return document; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/InnerHTML-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/InnerHTML-impl.js deleted file mode 100644 index bdbd7b3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/InnerHTML-impl.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -const { parseFragment } = require("../../browser/parser"); -const { HTML_NS } = require("../helpers/namespaces.js"); -const { isShadowRoot } = require("../helpers/shadow-dom.js"); -const NODE_TYPE = require("../node-type.js"); -const { fragmentSerialization } = require("./serialization.js"); - -// https://w3c.github.io/DOM-Parsing/#the-innerhtml-mixin -exports.implementation = class InnerHTMLImpl { - // https://w3c.github.io/DOM-Parsing/#dom-innerhtml-innerhtml - get innerHTML() { - return fragmentSerialization(this, { - outer: false, - requireWellFormed: true, - globalObject: this._globalObject - }); - } - set innerHTML(markup) { - const contextElement = isShadowRoot(this) ? this.host : this; - const fragment = parseFragment(markup, contextElement); - - let contextObject = this; - if (this.nodeType === NODE_TYPE.ELEMENT_NODE && this.localName === "template" && this.namespaceURI === HTML_NS) { - contextObject = this._templateContents; - } - - contextObject._replaceAll(fragment); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/XMLSerializer-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/XMLSerializer-impl.js deleted file mode 100644 index 5287fad..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/XMLSerializer-impl.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -const serialize = require("w3c-xmlserializer"); -const DOMException = require("../generated/DOMException"); -const utils = require("../generated/utils"); - -exports.implementation = class XMLSerializerImpl { - constructor(globalObject) { - this._globalObject = globalObject; - } - - serializeToString(root) { - try { - return serialize(utils.wrapperForImpl(root), { requireWellFormed: false }); - } catch (e) { - throw DOMException.create(this._globalObject, [e.message, "InvalidStateError"]); - } - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/parse5-adapter-serialization.js b/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/parse5-adapter-serialization.js deleted file mode 100644 index 4d8eff0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/parse5-adapter-serialization.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -const nodeTypes = require("../node-type"); -const { domSymbolTree } = require("../helpers/internal-constants"); -// Serialization only requires a subset of the tree adapter interface. - -// Tree traversing -exports.getFirstChild = node => node.firstChild; - -exports.getChildNodes = node => domSymbolTree.childrenToArray(node); - -exports.getParentNode = node => node.parentNode; - -exports.getAttrList = element => { - const attributeList = [...element._attributeList]; - - if (element._isValue && attributeList.every(attr => attr.name !== "is")) { - attributeList.unshift({ - name: "is", - namespace: null, - prefix: null, - value: element._isValue - }); - } - - return attributeList; -}; - -// Node data -exports.getTagName = element => element._qualifiedName; // https://github.com/inikulin/parse5/issues/231 - -exports.getNamespaceURI = element => element.namespaceURI; - -exports.getTextNodeContent = exports.getCommentNodeContent = node => node.data; - -exports.getDocumentTypeNodeName = node => node.name; - -exports.getDocumentTypeNodePublicId = node => node.publicId; - -exports.getDocumentTypeNodeSystemId = node => node.systemId; - -exports.getTemplateContent = templateElement => templateElement._templateContents; - -exports.getDocumentMode = document => document._mode; - -// Node types -exports.isTextNode = node => node.nodeType === nodeTypes.TEXT_NODE; - -exports.isCommentNode = node => node.nodeType === nodeTypes.COMMENT_NODE; - -exports.isDocumentTypeNode = node => node.nodeType === nodeTypes.DOCUMENT_TYPE_NODE; - -exports.isElementNode = node => node.nodeType === nodeTypes.ELEMENT_NODE; - -// Source code location -exports.setNodeSourceCodeLocation = (node, location) => { - node.sourceCodeLocation = location; -}; - -exports.getNodeSourceCodeLocation = node => node.sourceCodeLocation; - -exports.updateNodeSourceCodeLocation = (node, endLocation) => { - Object.assign(node.sourceCodeLocation, endLocation); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/serialization.js b/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/serialization.js deleted file mode 100644 index 45c1224..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/domparsing/serialization.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -const produceXMLSerialization = require("w3c-xmlserializer"); -const parse5 = require("parse5"); -const DOMException = require("../generated/DOMException"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const utils = require("../generated/utils"); -const treeAdapter = require("./parse5-adapter-serialization"); -const NODE_TYPE = require("../node-type"); - -module.exports.fragmentSerialization = (node, { outer, requireWellFormed, globalObject }) => { - const contextDocument = - node.nodeType === NODE_TYPE.DOCUMENT_NODE ? node : node._ownerDocument; - if (contextDocument._parsingMode === "html") { - const config = { - ...contextDocument._parseOptions, - treeAdapter - }; - return outer ? parse5.serializeOuter(node, config) : parse5.serialize(node, config); - } - - const childNodes = outer ? [node] : domSymbolTree.childrenToArray(node); - - try { - let serialized = ""; - for (let i = 0; i < childNodes.length; ++i) { - serialized += produceXMLSerialization( - utils.wrapperForImpl(childNodes[i]), - { requireWellFormed } - ); - } - return serialized; - } catch (e) { - throw DOMException.create(globalObject, [e.message, "InvalidStateError"]); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/encoding/TextDecoder-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/encoding/TextDecoder-impl.js deleted file mode 100644 index 20f3af7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/encoding/TextDecoder-impl.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -const { TextDecoder } = require("@exodus/bytes/encoding.js"); - -// A thin wrapper is needed since there are constructor arguments, which mismatches webidl2js's assumed pattern. -exports.implementation = class TextDecoderImpl { - constructor(globalObject, [label, options]) { - this._innerImpl = new TextDecoder(label, options); - } - - decode(input, options) { - return this._innerImpl.decode(input, options); - } - - get encoding() { - return this._innerImpl.encoding; - } - - get fatal() { - return this._innerImpl.fatal; - } - - get ignoreBOM() { - return this._innerImpl.ignoreBOM; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/encoding/TextEncoder-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/encoding/TextEncoder-impl.js deleted file mode 100644 index 9a9e7b5..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/encoding/TextEncoder-impl.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -const { TextEncoder } = require("@exodus/bytes/encoding.js"); - -// No wrapper needed since there are no constructor arguments. -exports.implementation = TextEncoder; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/BeforeUnloadEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/BeforeUnloadEvent-impl.js deleted file mode 100644 index bca3ea8..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/BeforeUnloadEvent-impl.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const EventInit = require("../generated/EventInit"); - -class BeforeUnloadEventImpl extends EventImpl {} -BeforeUnloadEventImpl.defaultInit = EventInit.convert(undefined, undefined); - -module.exports = { - implementation: BeforeUnloadEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/BlobEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/BlobEvent-impl.js deleted file mode 100644 index ed91b49..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/BlobEvent-impl.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -const EventImpl = require("./Event-impl").implementation; - -class BlobEventImpl extends EventImpl {} - -// Cannot use the usual pattern since `data` is required. -BlobEventImpl.defaultInit = { - __proto__: null, - timecode: 0 -}; - -module.exports = { - implementation: BlobEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/CloseEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/CloseEvent-impl.js deleted file mode 100644 index c52b009..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/CloseEvent-impl.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const CloseEventInit = require("../generated/CloseEventInit"); - -class CloseEventImpl extends EventImpl {} -CloseEventImpl.defaultInit = CloseEventInit.convert(undefined, undefined); - -exports.implementation = CloseEventImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/CompositionEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/CompositionEvent-impl.js deleted file mode 100644 index b087e81..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/CompositionEvent-impl.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -const UIEventImpl = require("./UIEvent-impl").implementation; -const CompositionEventInit = require("../generated/CompositionEventInit"); - -class CompositionEventImpl extends UIEventImpl { - initCompositionEvent(type, bubbles, cancelable, view, data) { - if (this._dispatchFlag) { - return; - } - - this.initUIEvent(type, bubbles, cancelable, view, 0); - this.data = data; - } -} -CompositionEventImpl.defaultInit = CompositionEventInit.convert(undefined, undefined); - -module.exports = { - implementation: CompositionEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/CustomEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/CustomEvent-impl.js deleted file mode 100644 index 626b117..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/CustomEvent-impl.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const CustomEventInit = require("../generated/CustomEventInit"); - -class CustomEventImpl extends EventImpl { - initCustomEvent(type, bubbles, cancelable, detail) { - if (this._dispatchFlag) { - return; - } - - this.initEvent(type, bubbles, cancelable); - this.detail = detail; - } -} -CustomEventImpl.defaultInit = CustomEventInit.convert(undefined, undefined); - -module.exports = { - implementation: CustomEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/DeviceMotionEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/DeviceMotionEvent-impl.js deleted file mode 100644 index 37ce211..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/DeviceMotionEvent-impl.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; -const { implementation: DeviceMotionEventAccelerationImpl } = - require("../deviceorientation/DeviceMotionEventAcceleration-impl"); -const { implementation: DeviceMotionEventRotationRateImpl } = - require("../deviceorientation/DeviceMotionEventRotationRate-impl"); - -class DeviceMotionEventImpl extends EventImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - const eventInitDict = args[1]; - - this.acceleration = null; - if (eventInitDict?.acceleration) { - const accelImpl = new DeviceMotionEventAccelerationImpl(globalObject, [], {}); - accelImpl.x = eventInitDict.acceleration.x; - accelImpl.y = eventInitDict.acceleration.y; - accelImpl.z = eventInitDict.acceleration.z; - this.acceleration = accelImpl; - } - - this.accelerationIncludingGravity = null; - if (eventInitDict?.accelerationIncludingGravity) { - const accelGImpl = new DeviceMotionEventAccelerationImpl(globalObject, [], {}); - accelGImpl.x = eventInitDict.accelerationIncludingGravity.x; - accelGImpl.y = eventInitDict.accelerationIncludingGravity.y; - accelGImpl.z = eventInitDict.accelerationIncludingGravity.z; - this.accelerationIncludingGravity = accelGImpl; - } - - this.rotationRate = null; - if (eventInitDict?.rotationRate) { - const rotImpl = new DeviceMotionEventRotationRateImpl(globalObject, [], {}); - rotImpl.alpha = eventInitDict.rotationRate.alpha; - rotImpl.beta = eventInitDict.rotationRate.beta; - rotImpl.gamma = eventInitDict.rotationRate.gamma; - this.rotationRate = rotImpl; - } - - this.interval = eventInitDict?.interval ?? 0; - } -} -DeviceMotionEventImpl.defaultInit = Object.create(null); - -module.exports = { - implementation: DeviceMotionEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/DeviceOrientationEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/DeviceOrientationEvent-impl.js deleted file mode 100644 index 6f0ba79..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/DeviceOrientationEvent-impl.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -const EventImpl = require("./Event-impl").implementation; -const DeviceOrientationEventInit = require("../generated/DeviceOrientationEventInit"); - -class DeviceOrientationEventImpl extends EventImpl {} -DeviceOrientationEventImpl.defaultInit = DeviceOrientationEventInit.convert(undefined, undefined); - -module.exports = { - implementation: DeviceOrientationEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/ErrorEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/ErrorEvent-impl.js deleted file mode 100644 index 5bd2656..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/ErrorEvent-impl.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const ErrorEventInit = require("../generated/ErrorEventInit"); - -class ErrorEventImpl extends EventImpl { - -} -ErrorEventImpl.defaultInit = ErrorEventInit.convert(undefined, undefined); - -module.exports = { - implementation: ErrorEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/Event-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/Event-impl.js deleted file mode 100644 index 9840255..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/Event-impl.js +++ /dev/null @@ -1,195 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils"); -const EventInit = require("../generated/EventInit"); - -class EventImpl { - constructor(globalObject, args, privateData) { - const [type, eventInitDict = this.constructor.defaultInit] = args; - - this.type = type; - - this.bubbles = false; - this.cancelable = false; - for (const key in eventInitDict) { - this[key] = eventInitDict[key]; - } - for (const key in this.constructor.defaultInit) { - if (!(key in eventInitDict)) { - this[key] = this.constructor.defaultInit[key]; - } - } - - this.target = null; - this.currentTarget = null; - this.eventPhase = 0; - - this._globalObject = globalObject; - this._initializedFlag = true; - this._stopPropagationFlag = false; - this._stopImmediatePropagationFlag = false; - this._canceledFlag = false; - this._inPassiveListenerFlag = false; - this._dispatchFlag = false; - this._path = []; - - this.isTrusted = privateData.isTrusted || false; - this.timeStamp = Date.now(); - } - - // https://dom.spec.whatwg.org/#set-the-canceled-flag - _setTheCanceledFlag() { - if (this.cancelable && !this._inPassiveListenerFlag) { - this._canceledFlag = true; - } - } - - get srcElement() { - return this.target; - } - - get returnValue() { - return !this._canceledFlag; - } - - set returnValue(v) { - if (v === false) { - this._setTheCanceledFlag(); - } - } - - get defaultPrevented() { - return this._canceledFlag; - } - - stopPropagation() { - this._stopPropagationFlag = true; - } - - get cancelBubble() { - return this._stopPropagationFlag; - } - - set cancelBubble(v) { - if (v) { - this._stopPropagationFlag = true; - } - } - - stopImmediatePropagation() { - this._stopPropagationFlag = true; - this._stopImmediatePropagationFlag = true; - } - - preventDefault() { - this._setTheCanceledFlag(); - } - - // https://dom.spec.whatwg.org/#dom-event-composedpath - // Current implementation is based of https://whatpr.org/dom/699.html#dom-event-composedpath - // due to a bug in composed path implementation https://github.com/whatwg/dom/issues/684 - composedPath() { - const composedPath = []; - - const { currentTarget, _path: path } = this; - - if (path.length === 0) { - return composedPath; - } - - composedPath.push(currentTarget); - - let currentTargetIndex = 0; - let currentTargetHiddenSubtreeLevel = 0; - - for (let index = path.length - 1; index >= 0; index--) { - const { item, rootOfClosedTree, slotInClosedTree } = path[index]; - - if (rootOfClosedTree) { - currentTargetHiddenSubtreeLevel++; - } - - if (item === idlUtils.implForWrapper(currentTarget)) { - currentTargetIndex = index; - break; - } - - if (slotInClosedTree) { - currentTargetHiddenSubtreeLevel--; - } - } - - let currentHiddenLevel = currentTargetHiddenSubtreeLevel; - let maxHiddenLevel = currentTargetHiddenSubtreeLevel; - - for (let i = currentTargetIndex - 1; i >= 0; i--) { - const { item, rootOfClosedTree, slotInClosedTree } = path[i]; - - if (rootOfClosedTree) { - currentHiddenLevel++; - } - - if (currentHiddenLevel <= maxHiddenLevel) { - composedPath.unshift(idlUtils.wrapperForImpl(item)); - } - - if (slotInClosedTree) { - currentHiddenLevel--; - if (currentHiddenLevel < maxHiddenLevel) { - maxHiddenLevel = currentHiddenLevel; - } - } - } - - currentHiddenLevel = currentTargetHiddenSubtreeLevel; - maxHiddenLevel = currentTargetHiddenSubtreeLevel; - - for (let index = currentTargetIndex + 1; index < path.length; index++) { - const { item, rootOfClosedTree, slotInClosedTree } = path[index]; - - if (slotInClosedTree) { - currentHiddenLevel++; - } - - if (currentHiddenLevel <= maxHiddenLevel) { - composedPath.push(idlUtils.wrapperForImpl(item)); - } - - if (rootOfClosedTree) { - currentHiddenLevel--; - if (currentHiddenLevel < maxHiddenLevel) { - maxHiddenLevel = currentHiddenLevel; - } - } - } - - return composedPath; - } - - _initialize(type, bubbles, cancelable) { - this.type = type; - this._initializedFlag = true; - - this._stopPropagationFlag = false; - this._stopImmediatePropagationFlag = false; - this._canceledFlag = false; - - this.isTrusted = false; - this.target = null; - this.bubbles = bubbles; - this.cancelable = cancelable; - } - - initEvent(type, bubbles, cancelable) { - if (this._dispatchFlag) { - return; - } - - this._initialize(type, bubbles, cancelable); - } -} -EventImpl.defaultInit = EventInit.convert(undefined, undefined); - -module.exports = { - implementation: EventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/EventModifierMixin-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/EventModifierMixin-impl.js deleted file mode 100644 index 1af2bb2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/EventModifierMixin-impl.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -// This mixin doesn't have an IDL equivalent, but since MouseEvent and KeyboardEvent implement getModifierState() the -// same way, its implementation is shared here. - -class EventModifierMixinImpl { - // Event's constructor assumes all options correspond to IDL attributes with the same names, and sets them on `this`. - // That is not the case for these modifier boolean options, but since the options are set on `this` anyway we'll - // access them that way. The spec doesn't say much about the case where keyArg is not one of the valid ones - // (https://w3c.github.io/uievents-key/#keys-modifier), but at least Chrome returns false for invalid modifiers. Since - // these invalid modifiers will be undefined on `this` (thus `false` after casting it to boolean), we don't need to do - // extra checking for validity. - getModifierState(keyArg) { - if (keyArg === "Control") { - return Boolean(this.ctrlKey); - } - if (["Alt", "Meta", "Shift"].includes(keyArg)) { - return Boolean(this[`${keyArg.toLowerCase()}Key`]); - } - return Boolean(this[`modifier${keyArg}`]); - } -} - -exports.implementation = EventModifierMixinImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js deleted file mode 100644 index 9cac0dd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js +++ /dev/null @@ -1,438 +0,0 @@ -"use strict"; -const DOMException = require("../generated/DOMException"); - -const isWindow = require("../helpers/is-window"); -const reportException = require("../helpers/runtime-script-errors"); -const idlUtils = require("../generated/utils"); -const { nodeRoot } = require("../helpers/node"); -const { - isNode, isShadowRoot, isSlotable, getEventTargetParent, - isShadowInclusiveAncestor, retarget -} = require("../helpers/shadow-dom"); - -const MouseEvent = require("../generated/MouseEvent"); - -const EVENT_PHASE = { - NONE: 0, - CAPTURING_PHASE: 1, - AT_TARGET: 2, - BUBBLING_PHASE: 3 -}; - -class EventTargetImpl { - constructor(globalObject) { - this._globalObject = globalObject; - this._eventListeners = Object.create(null); - } - - // Default argument is necessary because webidl2js cannot handle `= {}` with unions at the moment. - addEventListener(type, callback, options = { __proto__: null, capture: false, once: false }) { - let { capture, once, passive, signal } = flattenMoreEventListenerOptions(options); - - if (signal !== null && signal.aborted) { - return; - } - - if (callback === null) { - return; - } - - if (passive === null) { - passive = defaultPassiveValue(type, this); - } - - if (!this._eventListeners[type]) { - this._eventListeners[type] = []; - } - - for (let i = 0; i < this._eventListeners[type].length; ++i) { - const listener = this._eventListeners[type][i]; - if ( - listener.callback.objectReference === callback.objectReference && - listener.capture === capture - ) { - return; - } - } - - this._eventListeners[type].push({ - callback, - capture, - once, - passive, - signal - }); - - if (signal !== null) { - signal._addAlgorithm(() => { - this.removeEventListener(type, callback, options); - }); - } - } - - // Default argument is necessary because webidl2js cannot handle `= {}` with unions at the moment. - removeEventListener(type, callback, options = { __proto__: null, capture: false }) { - const capture = flattenEventListenerOptions(options); - - if (callback === null) { - // Optimization, not in the spec. - return; - } - - if (!this._eventListeners[type]) { - return; - } - - for (let i = 0; i < this._eventListeners[type].length; ++i) { - const listener = this._eventListeners[type][i]; - if ( - listener.callback.objectReference === callback.objectReference && - listener.capture === capture - ) { - this._eventListeners[type].splice(i, 1); - break; - } - } - } - - dispatchEvent(eventImpl) { - if (eventImpl._dispatchFlag || !eventImpl._initializedFlag) { - throw DOMException.create(this._globalObject, [ - "Tried to dispatch an uninitialized event", - "InvalidStateError" - ]); - } - if (eventImpl.eventPhase !== EVENT_PHASE.NONE) { - throw DOMException.create(this._globalObject, [ - "Tried to dispatch a dispatching event", - "InvalidStateError" - ]); - } - - eventImpl.isTrusted = false; - - return this._dispatch(eventImpl); - } - - // https://dom.spec.whatwg.org/#get-the-parent - _getTheParent() { - return null; - } - - // https://dom.spec.whatwg.org/#concept-event-dispatch - // legacyOutputDidListenersThrowFlag optional parameter is not necessary here since it is only used by indexDB. - _dispatch(eventImpl, legacyTargetOverrideFlag /* , legacyOutputDidListenersThrowFlag */) { - let targetImpl = this; - let clearTargets = false; - let activationTarget = null; - - eventImpl._dispatchFlag = true; - - const targetOverride = legacyTargetOverrideFlag ? - idlUtils.implForWrapper(targetImpl._globalObject._document) : - targetImpl; - let relatedTarget = retarget(eventImpl.relatedTarget, targetImpl); - - if (targetImpl !== relatedTarget || targetImpl === eventImpl.relatedTarget) { - const touchTargets = []; - - appendToEventPath(eventImpl, targetImpl, targetOverride, relatedTarget, touchTargets, false); - - const isActivationEvent = MouseEvent.isImpl(eventImpl) && eventImpl.type === "click"; - - if (isActivationEvent && targetImpl._hasActivationBehavior) { - activationTarget = targetImpl; - } - - let slotInClosedTree = false; - let slotable = isSlotable(targetImpl) && targetImpl._assignedSlot ? targetImpl : null; - let parent = getEventTargetParent(targetImpl, eventImpl); - - // Populate event path - // https://dom.spec.whatwg.org/#event-path - while (parent !== null) { - if (slotable !== null) { - if (parent.localName !== "slot") { - throw new Error(`JSDOM Internal Error: Expected parent to be a Slot`); - } - - slotable = null; - - const parentRoot = nodeRoot(parent); - if (isShadowRoot(parentRoot) && parentRoot.mode === "closed") { - slotInClosedTree = true; - } - } - - if (isSlotable(parent) && parent._assignedSlot) { - slotable = parent; - } - - relatedTarget = retarget(eventImpl.relatedTarget, parent); - - if ( - (isNode(parent) && isShadowInclusiveAncestor(nodeRoot(targetImpl), parent)) || - idlUtils.wrapperForImpl(parent).constructor.name === "Window" - ) { - if (isActivationEvent && eventImpl.bubbles && activationTarget === null && - parent._hasActivationBehavior) { - activationTarget = parent; - } - - appendToEventPath(eventImpl, parent, null, relatedTarget, touchTargets, slotInClosedTree); - } else if (parent === relatedTarget) { - parent = null; - } else { - targetImpl = parent; - - if (isActivationEvent && activationTarget === null && targetImpl._hasActivationBehavior) { - activationTarget = targetImpl; - } - - appendToEventPath(eventImpl, parent, targetImpl, relatedTarget, touchTargets, slotInClosedTree); - } - - if (parent !== null) { - parent = getEventTargetParent(parent, eventImpl); - } - - slotInClosedTree = false; - } - - let clearTargetsStructIndex = -1; - for (let i = eventImpl._path.length - 1; i >= 0 && clearTargetsStructIndex === -1; i--) { - if (eventImpl._path[i].target !== null) { - clearTargetsStructIndex = i; - } - } - const clearTargetsStruct = eventImpl._path[clearTargetsStructIndex]; - - clearTargets = - (isNode(clearTargetsStruct.target) && isShadowRoot(nodeRoot(clearTargetsStruct.target))) || - (isNode(clearTargetsStruct.relatedTarget) && isShadowRoot(nodeRoot(clearTargetsStruct.relatedTarget))); - - if (activationTarget !== null && activationTarget._legacyPreActivationBehavior) { - activationTarget._legacyPreActivationBehavior(); - } - - for (let i = eventImpl._path.length - 1; i >= 0; --i) { - const struct = eventImpl._path[i]; - - if (struct.target !== null) { - eventImpl.eventPhase = EVENT_PHASE.AT_TARGET; - } else { - eventImpl.eventPhase = EVENT_PHASE.CAPTURING_PHASE; - } - - invokeEventListeners(struct, eventImpl, "capturing"); - } - - for (let i = 0; i < eventImpl._path.length; i++) { - const struct = eventImpl._path[i]; - - if (struct.target !== null) { - eventImpl.eventPhase = EVENT_PHASE.AT_TARGET; - } else { - if (!eventImpl.bubbles) { - continue; - } - - eventImpl.eventPhase = EVENT_PHASE.BUBBLING_PHASE; - } - - invokeEventListeners(struct, eventImpl, "bubbling"); - } - } - - eventImpl.eventPhase = EVENT_PHASE.NONE; - - eventImpl.currentTarget = null; - eventImpl._path = []; - eventImpl._dispatchFlag = false; - eventImpl._stopPropagationFlag = false; - eventImpl._stopImmediatePropagationFlag = false; - - if (clearTargets) { - eventImpl.target = null; - eventImpl.relatedTarget = null; - } - - if (activationTarget !== null) { - if (!eventImpl._canceledFlag) { - activationTarget._activationBehavior(eventImpl); - } else if (activationTarget._legacyCanceledActivationBehavior) { - activationTarget._legacyCanceledActivationBehavior(); - } - } - - return !eventImpl._canceledFlag; - } -} - -module.exports = { - implementation: EventTargetImpl -}; - -// https://dom.spec.whatwg.org/#concept-event-listener-invoke -function invokeEventListeners(struct, eventImpl, phase) { - const structIndex = eventImpl._path.indexOf(struct); - for (let i = structIndex; i >= 0; i--) { - const t = eventImpl._path[i]; - if (t.target) { - eventImpl.target = t.target; - break; - } - } - - eventImpl.relatedTarget = idlUtils.wrapperForImpl(struct.relatedTarget); - - if (eventImpl._stopPropagationFlag) { - return; - } - - eventImpl.currentTarget = idlUtils.wrapperForImpl(struct.item); - - const listeners = struct.item._eventListeners; - innerInvokeEventListeners(eventImpl, listeners, phase, struct.itemInShadowTree); -} - -// https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke -function innerInvokeEventListeners(eventImpl, listeners, phase, itemInShadowTree) { - let found = false; - - const { type, target } = eventImpl; - const wrapper = idlUtils.wrapperForImpl(target); - - if (!listeners || !listeners[type]) { - return found; - } - - // Copy event listeners before iterating since the list can be modified during the iteration. - const handlers = listeners[type].slice(); - - for (let i = 0; i < handlers.length; i++) { - const listener = handlers[i]; - const { callback, capture, once, passive } = listener; - - // Check if the event listener has been removed since the listeners has been cloned. - if (!listeners[type].includes(listener)) { - continue; - } - - found = true; - - if ( - (phase === "capturing" && !capture) || - (phase === "bubbling" && capture) - ) { - continue; - } - - if (once) { - listeners[type].splice(listeners[type].indexOf(listener), 1); - } - - let window = null; - if (wrapper && wrapper._document) { - // Triggered by Window - window = wrapper; - } else if (target._ownerDocument) { - // Triggered by most webidl2js'ed instances - window = target._ownerDocument._defaultView; - } else if (wrapper._ownerDocument) { - // Currently triggered by some non-webidl2js things - window = wrapper._ownerDocument._defaultView; - } - - let currentEvent; - if (window) { - currentEvent = window._currentEvent; - if (!itemInShadowTree) { - window._currentEvent = eventImpl; - } - } - - if (passive) { - eventImpl._inPassiveListenerFlag = true; - } - - try { - callback.call(eventImpl.currentTarget, eventImpl); - } catch (e) { - if (window) { - reportException(window, e); - } - // Errors in window-less documents just get swallowed... can you think of anything better? - } - - eventImpl._inPassiveListenerFlag = false; - - if (window) { - window._currentEvent = currentEvent; - } - - if (eventImpl._stopImmediatePropagationFlag) { - return found; - } - } - - return found; -} - -function flattenMoreEventListenerOptions(options) { - const dict = { - capture: flattenEventListenerOptions(options), - once: false, - passive: null, - signal: null - }; - - if (options !== null && typeof options === "object") { - dict.once = options.once; - if ("passive" in options) { - dict.passive = options.passive; - } - if ("signal" in options) { - dict.signal = options.signal; - } - } - return dict; -} - -function flattenEventListenerOptions(options) { - if (typeof options === "boolean") { - return options; - } - return options.capture; -} - -function defaultPassiveValue(type, eventTarget) { - switch (type) { - case "touchstart": - case "touchmove": - case "wheel": - case "mousewheel": - return isWindow(eventTarget) || - eventTarget._ownerDocument === eventTarget || - eventTarget._ownerDocument.documentElement === eventTarget || - eventTarget._ownerDocument.body === eventTarget; - default: - return false; - } -} - -// https://dom.spec.whatwg.org/#concept-event-path-append -function appendToEventPath(eventImpl, target, targetOverride, relatedTarget, touchTargets, slotInClosedTree) { - const itemInShadowTree = isNode(target) && isShadowRoot(nodeRoot(target)); - const rootOfClosedTree = isShadowRoot(target) && target.mode === "closed"; - - eventImpl._path.push({ - item: target, - itemInShadowTree, - target: targetOverride, - relatedTarget, - touchTargets, - rootOfClosedTree, - slotInClosedTree - }); -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/FocusEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/FocusEvent-impl.js deleted file mode 100644 index 561cbfc..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/FocusEvent-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -const UIEventImpl = require("./UIEvent-impl").implementation; - -const FocusEventInit = require("../generated/FocusEventInit"); - -class FocusEventImpl extends UIEventImpl {} -FocusEventImpl.defaultInit = FocusEventInit.convert(undefined, undefined); - -exports.implementation = FocusEventImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/HashChangeEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/HashChangeEvent-impl.js deleted file mode 100644 index 8230e1d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/HashChangeEvent-impl.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const HashChangeEventInit = require("../generated/HashChangeEventInit"); - -class HashChangeEventImpl extends EventImpl { - -} -HashChangeEventImpl.defaultInit = HashChangeEventInit.convert(undefined, undefined); - -module.exports = { - implementation: HashChangeEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/InputEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/InputEvent-impl.js deleted file mode 100644 index d9df3cd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/InputEvent-impl.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -const UIEventImpl = require("./UIEvent-impl").implementation; -const InputEventInit = require("../generated/InputEventInit"); - -// https://w3c.github.io/uievents/#interface-inputevent -class InputEventImpl extends UIEventImpl { } -InputEventImpl.defaultInit = InputEventInit.convert(undefined, undefined); - -module.exports = { - implementation: InputEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/KeyboardEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/KeyboardEvent-impl.js deleted file mode 100644 index c540e1e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/KeyboardEvent-impl.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; - -const { mixin } = require("../../utils"); -const EventModifierMixinImpl = require("./EventModifierMixin-impl").implementation; -const UIEventImpl = require("./UIEvent-impl").implementation; - -const KeyboardEventInit = require("../generated/KeyboardEventInit"); - -class KeyboardEventImpl extends UIEventImpl { - initKeyboardEvent(type, bubbles, cancelable, view, key, location, ctrlKey, altKey, shiftKey, metaKey) { - if (this._dispatchFlag) { - return; - } - - this.initUIEvent(type, bubbles, cancelable, view, 0); - this.key = key; - this.location = location; - this.ctrlKey = ctrlKey; - this.altKey = altKey; - this.shiftKey = shiftKey; - this.metaKey = metaKey; - } -} -mixin(KeyboardEventImpl.prototype, EventModifierMixinImpl.prototype); -KeyboardEventImpl.defaultInit = KeyboardEventInit.convert(undefined, undefined); - -module.exports = { - implementation: KeyboardEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/MessageEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/MessageEvent-impl.js deleted file mode 100644 index 0290fd4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/MessageEvent-impl.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const MessageEventInit = require("../generated/MessageEventInit"); - -class MessageEventImpl extends EventImpl { - initMessageEvent(type, bubbles, cancelable, data, origin, lastEventId, source, ports) { - if (this._dispatchFlag) { - return; - } - - this.initEvent(type, bubbles, cancelable); - this.data = data; - this.origin = origin; - this.lastEventId = lastEventId; - this.source = source; - this.ports = ports; - } -} -MessageEventImpl.defaultInit = MessageEventInit.convert(undefined, undefined); - -module.exports = { - implementation: MessageEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/MouseEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/MouseEvent-impl.js deleted file mode 100644 index 15b309e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/MouseEvent-impl.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; - -const { mixin } = require("../../utils"); -const EventModifierMixinImpl = require("./EventModifierMixin-impl").implementation; -const UIEventImpl = require("./UIEvent-impl").implementation; - -const MouseEventInit = require("../generated/MouseEventInit"); - -class MouseEventImpl extends UIEventImpl { - get x() { - return this.clientX; - } - get y() { - return this.clientY; - } - get pageX() { - // TODO: consider dispatch flag and return page-relative event coordinate once layout is supported - return this.clientX; // TODO: add horizontal scroll offset once jsdom implements scrolling support - } - get pageY() { - // TODO: consider dispatch flag and return page-relative event coordinate once layout is supported - return this.clientY; // TODO: add vertical scroll offset once jsdom implements scrolling support - } - get offsetX() { - // TODO: consider dispatch flag and return target-relative event coordinate once layout is supported - return this.pageX; - } - get offsetY() { - // TODO: consider dispatch flag and return target-relative event coordinate once layout is supported - return this.pageY; - } - - initMouseEvent( - type, - bubbles, - cancelable, - view, - detail, - screenX, - screenY, - clientX, - clientY, - ctrlKey, - altKey, - shiftKey, - metaKey, - button, - relatedTarget - ) { - if (this._dispatchFlag) { - return; - } - - this.initUIEvent(type, bubbles, cancelable, view, detail); - this.screenX = screenX; - this.screenY = screenY; - this.clientX = clientX; - this.clientY = clientY; - this.ctrlKey = ctrlKey; - this.altKey = altKey; - this.shiftKey = shiftKey; - this.metaKey = metaKey; - this.button = button; - this.relatedTarget = relatedTarget; - } -} -mixin(MouseEventImpl.prototype, EventModifierMixinImpl.prototype); -MouseEventImpl.defaultInit = MouseEventInit.convert(undefined, undefined); - -module.exports = { - implementation: MouseEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/PageTransitionEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/PageTransitionEvent-impl.js deleted file mode 100644 index 565f246..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/PageTransitionEvent-impl.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const PageTransitionEventInit = require("../generated/PageTransitionEventInit"); - -// https://html.spec.whatwg.org/multipage/browsing-the-web.html#pagetransitionevent -class PageTransitionEventImpl extends EventImpl { - initPageTransitionEvent(type, bubbles, cancelable, persisted) { - if (this._dispatchFlag) { - return; - } - - this.initEvent(type, bubbles, cancelable); - this.persisted = persisted; - } -} -PageTransitionEventImpl.defaultInit = PageTransitionEventInit.convert(undefined, undefined); - -exports.implementation = PageTransitionEventImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/PointerEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/PointerEvent-impl.js deleted file mode 100644 index 2ad77f2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/PointerEvent-impl.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -const MouseEventImpl = require("./MouseEvent-impl").implementation; -const PointerEventInit = require("../generated/PointerEventInit"); - -class PointerEventImpl extends MouseEventImpl { - getCoalescedEvents() { - // The EventImpl constructor initializes this.coalescedEvents from the init dictionary. - // Return a new array each time (webidl2js doesn't handle this for us.) - return [...this.coalescedEvents]; - } - - getPredictedEvents() { - // As above. - return [...this.predictedEvents]; - } -} -PointerEventImpl.defaultInit = PointerEventInit.convert(undefined, undefined); - -module.exports = { - implementation: PointerEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/PopStateEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/PopStateEvent-impl.js deleted file mode 100644 index a500201..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/PopStateEvent-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -const EventImpl = require("./Event-impl.js").implementation; - -const PopStateEventInit = require("../generated/PopStateEventInit"); - -class PopStateEventImpl extends EventImpl {} -PopStateEventImpl.defaultInit = PopStateEventInit.convert(undefined, undefined); - -exports.implementation = PopStateEventImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/ProgressEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/ProgressEvent-impl.js deleted file mode 100644 index 59dcf03..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/ProgressEvent-impl.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const ProgressEventInit = require("../generated/ProgressEventInit"); - -class ProgressEventImpl extends EventImpl { - -} -ProgressEventImpl.defaultInit = ProgressEventInit.convert(undefined, undefined); - -module.exports = { - implementation: ProgressEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/PromiseRejectionEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/PromiseRejectionEvent-impl.js deleted file mode 100644 index 601241c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/PromiseRejectionEvent-impl.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -const EventImpl = require("./Event-impl").implementation; - -class PromiseRejectionEventImpl extends EventImpl {} - -// Cannot use the usual pattern because `promise` is required. -PromiseRejectionEventImpl.defaultInit = { - __proto__: null, - reason: undefined -}; - -module.exports = { - implementation: PromiseRejectionEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/StorageEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/StorageEvent-impl.js deleted file mode 100644 index 9eb6c26..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/StorageEvent-impl.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const StorageEventInit = require("../generated/StorageEventInit"); - -// https://html.spec.whatwg.org/multipage/webstorage.html#the-storageevent-interface -class StorageEventImpl extends EventImpl { - initStorageEvent(type, bubbles, cancelable, key, oldValue, newValue, url, storageArea) { - if (this._dispatchFlag) { - return; - } - - this.initEvent(type, bubbles, cancelable); - this.key = key; - this.oldValue = oldValue; - this.newValue = newValue; - this.url = url; - this.storageArea = storageArea; - } -} -StorageEventImpl.defaultInit = StorageEventInit.convert(undefined, undefined); - -module.exports = { - implementation: StorageEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/SubmitEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/SubmitEvent-impl.js deleted file mode 100644 index 2a9886e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/SubmitEvent-impl.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -const EventImpl = require("./Event-impl").implementation; - -const SubmitEventInit = require("../generated/SubmitEventInit"); - -// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#the-submitevent-interface -class SubmitEventImpl extends EventImpl {} -SubmitEventImpl.defaultInit = SubmitEventInit.convert(undefined, undefined); - -module.exports = { - implementation: SubmitEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/TouchEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/TouchEvent-impl.js deleted file mode 100644 index 623d20c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/TouchEvent-impl.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -const UIEventImpl = require("./UIEvent-impl").implementation; - -const TouchEventInit = require("../generated/TouchEventInit"); - -class TouchEventImpl extends UIEventImpl { - -} -TouchEventImpl.defaultInit = TouchEventInit.convert(undefined, undefined); - -module.exports = { - implementation: TouchEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/TransitionEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/TransitionEvent-impl.js deleted file mode 100644 index b66fa54..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/TransitionEvent-impl.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -const EventImpl = require("./Event-impl").implementation; -const TransitionEventInit = require("../generated/TransitionEventInit"); - -class TransitionEventImpl extends EventImpl {} -TransitionEventImpl.defaultInit = TransitionEventInit.convert(undefined, undefined); - -module.exports = { - implementation: TransitionEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/UIEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/UIEvent-impl.js deleted file mode 100644 index 5f7465b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/UIEvent-impl.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -const isWindow = require("../helpers/is-window"); -const UIEventInit = require("../generated/UIEventInit"); -const EventImpl = require("./Event-impl").implementation; - -class UIEventImpl extends EventImpl { - constructor(globalObject, args, privateData) { - const eventInitDict = args[1]; - - // undefined check included so that we can omit the property in internal usage. - if (eventInitDict && eventInitDict.view !== null && eventInitDict.view !== undefined) { - if (!isWindow(eventInitDict.view)) { - throw new TypeError(`Failed to construct '${new.target.name.replace(/Impl$/, "")}': member view is not of ` + - "type Window."); - } - } - - super(globalObject, args, privateData); - } - - initUIEvent(type, bubbles, cancelable, view, detail) { - if (view !== null) { - if (!isWindow(view)) { - throw new TypeError(`Failed to execute 'initUIEvent' on '${this.constructor.name.replace(/Impl$/, "")}': ` + - "parameter 4 is not of type 'Window'."); - } - } - - if (this._dispatchFlag) { - return; - } - - this.initEvent(type, bubbles, cancelable); - this.view = view; - this.detail = detail; - } -} -UIEventImpl.defaultInit = UIEventInit.convert(undefined, undefined); - -module.exports = { - implementation: UIEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/events/WheelEvent-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/events/WheelEvent-impl.js deleted file mode 100644 index c8ba882..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/events/WheelEvent-impl.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const MouseEventImpl = require("./MouseEvent-impl").implementation; - -const WheelEventInit = require("../generated/WheelEventInit"); - -class WheelEventImpl extends MouseEventImpl {} -WheelEventImpl.defaultInit = WheelEventInit.convert(undefined, undefined); - -module.exports = { - implementation: WheelEventImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/Headers-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/Headers-impl.js deleted file mode 100644 index fc56a48..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/Headers-impl.js +++ /dev/null @@ -1,173 +0,0 @@ -"use strict"; - -const { - isForbiddenRequestHeader, - isForbiddenResponseHeaderName, - isPrivilegedNoCORSRequestHeaderName, - isNoCORSSafelistedRequestHeaderName, - isNoCORSSafelistedRequestHeader -} = require("./header-types"); -const { isHeaderName, isHeaderValue, normalizeHeaderValue } = require("./header-utils"); -const HeaderList = require("./header-list"); - -function assertName(name) { - if (!isHeaderName(name)) { - throw new TypeError("name is invalid"); - } -} - -function assertValue(value) { - if (!isHeaderValue(value)) { - throw new TypeError("value is invalid"); - } -} - -class HeadersImpl { - constructor(globalObject, args) { - this.guard = "none"; - this.headerList = new HeaderList(); - - if (args[0]) { - this.#fill(args[0]); - } - } - - // https://fetch.spec.whatwg.org/#headers-validate - #validate(name, value) { - assertName(name); - assertValue(value); - - switch (this.guard) { - case "immutable": { - throw new TypeError("Headers is immutable"); - } - case "request": { - if (isForbiddenRequestHeader(name, value)) { - return false; - } - break; - } - case "response": { - if (isForbiddenResponseHeaderName(name)) { - return false; - } - break; - } - } - - return true; - } - - // https://fetch.spec.whatwg.org/#concept-headers-fill - #fill(init) { - if (Array.isArray(init)) { - for (const header of init) { - if (header.length !== 2) { - throw new TypeError("init is invalid"); - } - this.append(header[0], header[1]); - } - } else { - for (const [key, value] of Object.entries(init)) { - this.append(key, value); - } - } - } - - // https://fetch.spec.whatwg.org/#concept-headers-remove-privileged-no-cors-request-headers - #removePrivilegedNoCORSHeaders() { - this.headerList.delete("range"); - } - - // https://fetch.spec.whatwg.org/#dom-headers-append - append(name, value) { - value = normalizeHeaderValue(value); - if (!this.#validate(name, value)) { - return; - } - - if (this.guard === "request-no-cors") { - let temporaryValue = this.headerList.get(name); - if (temporaryValue === null) { - temporaryValue = value; - } else { - temporaryValue += ", " + value; - } - if (!isNoCORSSafelistedRequestHeader(name, temporaryValue)) { - return; - } - } - - this.headerList.append(name, value); - - if (this.guard === "request-no-cors") { - this.#removePrivilegedNoCORSHeaders(); - } - } - - // https://fetch.spec.whatwg.org/#dom-headers-delete - delete(name) { - if (!this.#validate(name, "")) { - return; - } - - if (this.guard === "request-no-cors" && - !isNoCORSSafelistedRequestHeaderName(name) && - !isPrivilegedNoCORSRequestHeaderName(name)) { - return; - } - - if (!this.headerList.contains(name)) { - return; - } - - this.headerList.delete(name); - - if (this.guard === "request-no-cors") { - this.#removePrivilegedNoCORSHeaders(); - } - } - - // https://fetch.spec.whatwg.org/#dom-headers-get - get(name) { - assertName(name); - return this.headerList.get(name); - } - - // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie - getSetCookie() { - return this.headerList.getAll("Set-Cookie") || []; - } - - // https://fetch.spec.whatwg.org/#dom-headers-has - has(name) { - assertName(name); - return this.headerList.contains(name); - } - - // https://fetch.spec.whatwg.org/#dom-headers-set - set(name, value) { - value = normalizeHeaderValue(value); - if (!this.#validate(name, value)) { - return; - } - - if (this.guard === "request-no-cors" && !isNoCORSSafelistedRequestHeader(name, value)) { - return; - } - - this.headerList.set(name, value); - - if (this.guard === "request-no-cors") { - this.#removePrivilegedNoCORSHeaders(); - } - } - - * [Symbol.iterator]() { - for (const header of this.headerList.sortAndCombine()) { - yield header; - } - } -} - -exports.implementation = HeadersImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/header-list.js b/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/header-list.js deleted file mode 100644 index 2777a74..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/header-list.js +++ /dev/null @@ -1,158 +0,0 @@ -"use strict"; - -/** - * Provides utility functions for efficiently managing a collection of headers. Corresponds to - * https://fetch.spec.whatwg.org/#concept-header-list. - * - * Notably, unlike `Headers`, this allows retrieving the original casing of header names and does no normalization of - * inputs, which is important for implementing `XMLHttpRequest`. See discussions on, e.g., - * https://github.com/whatwg/fetch/pull/476. - * - */ -class HeaderList { - // Note: we can use normal `toLowerCase()` in this class, instead of `asciiLowercase()`, because we assume all inputs - // are byte strings. - - constructor() { - // Internal storage: Map<lowercaseName, {name: originalName, values: Array<value>}> - this._headers = new Map(); - } - - // https://fetch.spec.whatwg.org/#concept-header-list-append - append(name, value) { - const lower = name.toLowerCase(); - const existing = this._headers.get(lower); - if (existing) { - existing.values.push(value); - } else { - this._headers.set(lower, { name, values: [value] }); - } - } - - // https://fetch.spec.whatwg.org/#header-list-contains - contains(name) { - return this._headers.has(name.toLowerCase()); - } - - // https://fetch.spec.whatwg.org/#concept-header-list-get - get(name) { - const entry = this._headers.get(name.toLowerCase()); - if (!entry) { - return null; - } - return entry.values.join(", "); - } - - // No corresponding spec algorithm, but equivalent to e.g. the steps used in - // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie. - getAll(name) { - const entry = this._headers.get(name.toLowerCase()); - if (!entry) { - return null; - } - return entry.values; - } - - // https://fetch.spec.whatwg.org/#concept-header-list-delete - delete(name) { - this._headers.delete(name.toLowerCase()); - } - - // https://fetch.spec.whatwg.org/#concept-header-list-set - set(name, value) { - const lower = name.toLowerCase(); - this._headers.set(lower, { name, values: [value] }); - } - - // https://fetch.spec.whatwg.org/#concept-header-list-combine - combine(name, value) { - const lower = name.toLowerCase(); - const existing = this._headers.get(lower); - if (existing) { - existing.values[0] += ", " + value; - } else { - this._headers.set(lower, { name, values: [value] }); - } - } - - // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine - sortAndCombine() { - const names = [...this._headers.keys()].sort(); - - const headers = []; - for (const name of names) { - const { values } = this._headers.get(name); - if (name === "set-cookie") { - for (const value of values) { - headers.push([name, value]); - } - } else { - headers.push([name, values.join(", ")]); - } - } - - return headers; - } - - /** - * Yields [name, value] pairs for iteration. - * Each header with multiple values yields multiple pairs. - * Preserves original casing. - */ - * [Symbol.iterator]() { - for (const { name, values } of this._headers.values()) { - for (const value of values) { - yield [name, value]; - } - } - } - - /** - * Yields unique header names (with original casing). - */ - * names() { - for (const { name } of this._headers.values()) { - yield name; - } - } - - /** - * Serializes the header list to an object. - * Format matches undici's headers object: {name: value} or {name: [values]} for multiple values. - */ - toJSON() { - const result = {}; - for (const { name, values } of this._headers.values()) { - result[name] = values.length === 1 ? values[0] : values; - } - return result; - } - - /** - * Creates a HeaderList from a headers object. - * Format: {name: value} or {name: [values]} for multiple values. - * @param {object} obj - Headers object - */ - static fromJSON(obj) { - const list = new HeaderList(); - for (const [name, value] of Object.entries(obj)) { - if (Array.isArray(value)) { - for (const v of value) { - list.append(name, v); - } - } else { - list.append(name, value); - } - } - return list; - } - - /** - * Creates a copy of this HeaderList. - */ - clone() { - return HeaderList.fromJSON(this.toJSON()); - } -} - -module.exports = HeaderList; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/header-types.js b/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/header-types.js deleted file mode 100644 index 7142220..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/header-types.js +++ /dev/null @@ -1,205 +0,0 @@ -"use strict"; - -const { MIMEType } = require("whatwg-mimetype"); - -// https://fetch.spec.whatwg.org/#privileged-no-cors-request-header-name -const PRIVILEGED_NO_CORS_REQUEST = new Set(["range"]); -function isPrivilegedNoCORSRequestHeaderName(name) { - return PRIVILEGED_NO_CORS_REQUEST.has(name.toLowerCase()); -} - -// https://fetch.spec.whatwg.org/#no-cors-safelisted-request-header-name -const NO_CORS_SAFELISTED_REQUEST = new Set([ - `accept`, - `accept-language`, - `content-language`, - `content-type` -]); -function isNoCORSSafelistedRequestHeaderName(name) { - return NO_CORS_SAFELISTED_REQUEST.has(name.toLowerCase()); -} - -// https://fetch.spec.whatwg.org/#forbidden-response-header-name -const FORBIDDEN_RESPONSE = new Set(["set-cookie", "set-cookie2"]); -function isForbiddenResponseHeaderName(name) { - return FORBIDDEN_RESPONSE.has(name.toLowerCase()); -} - -// https://fetch.spec.whatwg.org/#cors-safelisted-request-header -// Note: name and value are already ensured by the IDL layer to be byte strings. -const CORS_UNSAFE_BYTE = /[\x00-\x08\x0A-\x1F"():<>?@[\\\]{}\x7F]/; -function isCORSSafelistedRequestHeader(name, value) { - name = name.toLowerCase(); - switch (name) { - case "accept": - if (value.match(CORS_UNSAFE_BYTE)) { - return false; - } - break; - case "accept-language": - case "content-language": - if (value.match(/[^\x30-\x39\x41-\x5A\x61-\x7A *,\-.;=]/)) { - return false; - } - break; - case "content-type": { - if (value.match(CORS_UNSAFE_BYTE)) { - return false; - } - const mimeType = MIMEType.parse(value); - if (mimeType === null) { - return false; - } - if ( - ![ - "application/x-www-form-urlencoded", - "multipart/form-data", - "text/plain" - ].includes(mimeType.essence) - ) { - return false; - } - break; - } - default: - return false; - } - if (value.length > 128) { - return false; - } - return true; -} - -// https://fetch.spec.whatwg.org/#no-cors-safelisted-request-header -function isNoCORSSafelistedRequestHeader(name, value) { - if (!isNoCORSSafelistedRequestHeaderName(name)) { - return false; - } - return isCORSSafelistedRequestHeader(name, value); -} - -const BASIC_FORBIDDEN_REQUEST_HEADERS = new Set([ - "accept-charset", - "accept-encoding", - "access-control-request-headers", - "access-control-request-method", - "connection", - "content-length", - "cookie", - "cookie2", - "date", - "dnt", - "expect", - "host", - "keep-alive", - "origin", - "referer", - "te", - "trailer", - "transfer-encoding", - "upgrade", - "via" -]); - -const METHOD_CHECKING_FORBIDDEN_REQUEST_HEADERS = new Set([ - "x-http-method", - "x-http-method-override", - "x-method-override" -]); - -const FORBIDDEN_METHODS = new Set([ - "connect", - "trace", - "track" -]); - -// https://fetch.spec.whatwg.org/#forbidden-method -function isForbiddenMethod(value) { - return FORBIDDEN_METHODS.has(value.toLowerCase()); -} - -// https://fetch.spec.whatwg.org/#forbidden-request-header -function isForbiddenRequestHeader(name, value) { - const lowercaseName = name.toLowerCase(); - if (BASIC_FORBIDDEN_REQUEST_HEADERS.has(lowercaseName)) { - return true; - } - if (lowercaseName.startsWith("proxy-") || lowercaseName.startsWith("sec-")) { - return true; - } - - if (METHOD_CHECKING_FORBIDDEN_REQUEST_HEADERS.has(lowercaseName)) { - const parsedValues = getDecodeAndSplit(value); - return parsedValues.some(isForbiddenMethod); - } - - return false; -} - -// https://fetch.spec.whatwg.org/#header-value-get-decode-and-split -function getDecodeAndSplit(input) { - const values = []; - let temporaryValue = ""; - let position = 0; - - while (true) { - // Collect sequence of code points that are not " or , - while (position < input.length && input[position] !== "\"" && input[position] !== ",") { - temporaryValue += input[position++]; - } - - // If position is not past end and code point is " - if (position < input.length && input[position] === '"') { - // Inlined: collect HTTP quoted string (extract-value = false) - const positionStart = position++; - while (true) { - while (position < input.length && input[position] !== "\"" && input[position] !== "\\") { - position++; - } - if (position >= input.length) { - break; - } - if (input[position++] === "\\") { - if (position >= input.length) { - break; - } - position++; - } else { - break; // It was " - } - } - temporaryValue += input.slice(positionStart, position); - if (position < input.length) { - continue; - } - } - - // Remove HTTP tab or space from start and end - let start = 0; - let end = temporaryValue.length; - while (start < end && (temporaryValue[start] === "\t" || temporaryValue[start] === " ")) { - start++; - } - while (end > start && (temporaryValue[end - 1] === "\t" || temporaryValue[end - 1] === " ")) { - end--; - } - - values.push(temporaryValue.slice(start, end)); - temporaryValue = ""; - - if (position >= input.length) { - return values; - } - // Assert: code point at position is , - position++; - } -} - -module.exports = { - isPrivilegedNoCORSRequestHeaderName, - isNoCORSSafelistedRequestHeaderName, - isNoCORSSafelistedRequestHeader, - isForbiddenRequestHeader, - isForbiddenResponseHeaderName, - isCORSSafelistedRequestHeader -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/header-utils.js b/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/header-utils.js deleted file mode 100644 index bddd87c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/fetch/header-utils.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -// https://fetch.spec.whatwg.org/#header-name -function isHeaderName(name) { - return /^[!#$%&'*+\-.^`|~\w]+$/.test(name); -} - -// https://fetch.spec.whatwg.org/#header-value -function isHeaderValue(value) { - return value[0] !== "\t" && - value[0] !== " " && - value[value.length - 1] !== "\t" && - value[value.length - 1] !== " " && - !/[\0\r\n]/.test(value); -} - -// https://fetch.spec.whatwg.org/#concept-header-value-normalize -function normalizeHeaderValue(potentialValue) { - return potentialValue.replace(/^[\n\r\t ]+|[\n\r\t ]+$/g, ""); -} - -module.exports = { - isHeaderName, - isHeaderValue, - normalizeHeaderValue -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/Blob-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/Blob-impl.js deleted file mode 100644 index df57967..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/Blob-impl.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -const { utf8Encode } = require("../helpers/encoding"); -const Blob = require("../generated/Blob"); -const { isArrayBuffer } = require("../generated/utils"); -const { concatTypedArrays } = require("../helpers/binary-data"); - -function convertLineEndingsToNative(s) { - // jsdom always pretends to be *nix, for consistency. - // See also https://github.com/jsdom/jsdom/issues/2396. - return s.replace(/\r\n|\r|\n/g, "\n"); -} - -exports.implementation = class BlobImpl { - constructor(globalObject, [parts, properties], { fastPathArrayBufferToWrap } = {}) { - this._globalObject = globalObject; - - this.type = properties.type; - if (/[^\u0020-\u007E]/.test(this.type)) { - this.type = ""; - } else { - this.type = this.type.toLowerCase(); - } - - // A word about `this._bytes`: - // - // It is a `Uint8Array`. The realm of that `Uint8Array`, and/or the realm of its underlying `ArrayBuffer`, may be - // arbitrary. In particular, they likely do *not* match `this._globalObject`. The underlying `ArrayBuffer` may have - // been acquired from some other part of the system, e.g., the `ws` library, or aliased to another `BlobImpl`'s - // `_bytes`. - // - // This is fine, and indeed desirable, for efficiency. The key is that `Blob` is conceptually immutable, so users - // will never mutate the underlying `ArrayBuffer`. And, we never expose `this._bytes` or the underlying - // `ArrayBuffer` directly to the user: we always use something like `copyToArrayBufferInTargetRealm()` to ensure the - // result is in the realm appropriate for the user's request, and that if the user mutates the exposed bytes, this - // doesn't impact `this._bytes`. - - // Used internally in jsdom when we receive an `ArrayBuffer` from elsewhere in the system and know we don't need to - // copy it because the user doesn't have any references to it. It's OK if `fastPathArrayBufferToWrap` is in the - // wrong realm even, because it never directly escapes the `BlobImpl` without a copy. - if (fastPathArrayBufferToWrap) { - this._bytes = new Uint8Array(fastPathArrayBufferToWrap); - return; - } - - const chunks = []; - if (parts !== undefined) { - for (const part of parts) { - let chunk; - if (isArrayBuffer(part)) { - // Create a wrapper. The copying will happen in `concatTypedArrays()`. - chunk = new Uint8Array(part); - } else if (ArrayBuffer.isView(part)) { - // Use the part as-is. The copying will happen in `concatTypedArrays()`. - chunk = part; - } else if (Blob.isImpl(part)) { - // Use the existing `Uint8Array` as-is. The copying will happen in `concatTypedArrays()`. - chunk = part._bytes; - } else { - let s = part; - if (properties.endings === "native") { - s = convertLineEndingsToNative(s); - } - chunk = utf8Encode(s); - } - chunks.push(chunk); - } - } - this._bytes = concatTypedArrays(chunks); - } - - get size() { - return this._bytes.length; - } - - slice(start, end, contentType) { - const { size } = this; - - let relativeStart, relativeEnd, relativeContentType; - - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - - if (contentType === undefined) { - relativeContentType = ""; - } else { - // sanitization (lower case and invalid char check) is done in the - // constructor - relativeContentType = contentType; - } - - const span = Math.max(relativeEnd - relativeStart, 0); - - const slicedBuffer = this._bytes.slice(relativeStart, relativeStart + span); - - const blob = Blob.createImpl(this._globalObject, [[], { type: relativeContentType }], {}); - blob._bytes = slicedBuffer; - return blob; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/File-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/File-impl.js deleted file mode 100644 index 911faaf..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/File-impl.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const BlobImpl = require("./Blob-impl").implementation; - -exports.implementation = class FileImpl extends BlobImpl { - constructor(globalObject, [fileBits, fileName, options], privateData) { - super(globalObject, [fileBits, options], privateData); - - this.name = fileName; - this.lastModified = "lastModified" in options ? options.lastModified : Date.now(); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/FileList-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/FileList-impl.js deleted file mode 100644 index 04eedcb..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/FileList-impl.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils.js"); - -exports.implementation = class FileListImpl extends Array { - constructor() { - super(0); - } - item(index) { - return this[index] || null; - } - get [idlUtils.supportedPropertyIndices]() { - return this.keys(); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/FileReader-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/FileReader-impl.js deleted file mode 100644 index b6b24a4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/file-api/FileReader-impl.js +++ /dev/null @@ -1,132 +0,0 @@ -"use strict"; - -const { labelToName, legacyHookDecode } = require("@exodus/bytes/encoding.js"); -const { toBase64 } = require("@exodus/bytes/base64.js"); -const { MIMEType } = require("whatwg-mimetype"); -const DOMException = require("../generated/DOMException"); -const EventTargetImpl = require("../events/EventTarget-impl").implementation; -const ProgressEvent = require("../generated/ProgressEvent"); -const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor"); -const { fireAnEvent } = require("../helpers/events"); -const { copyToArrayBufferInTargetRealm } = require("../helpers/binary-data"); - -const READY_STATES = Object.freeze({ - EMPTY: 0, - LOADING: 1, - DONE: 2 -}); - -const events = ["loadstart", "progress", "load", "abort", "error", "loadend"]; - -class FileReaderImpl extends EventTargetImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this.error = null; - this.readyState = READY_STATES.EMPTY; - this.result = null; - - this._globalObject = globalObject; - this._ownerDocument = globalObject.document; - this._terminated = false; - } - - readAsArrayBuffer(file) { - this._readFile(file, "buffer"); - } - readAsBinaryString(file) { - this._readFile(file, "binaryString"); - } - readAsDataURL(file) { - this._readFile(file, "dataURL"); - } - readAsText(file, encodingLabel) { - this._readFile(file, "text", labelToName(encodingLabel) || "UTF-8"); - } - - abort() { - if (this.readyState === READY_STATES.EMPTY || this.readyState === READY_STATES.DONE) { - this.result = null; - return; - } - - if (this.readyState === READY_STATES.LOADING) { - this.readyState = READY_STATES.DONE; - this.result = null; - } - - this._terminated = true; - this._fireProgressEvent("abort"); - this._fireProgressEvent("loadend"); - } - - _fireProgressEvent(name, props) { - fireAnEvent(name, this, ProgressEvent, props); - } - - _readFile(file, format, encodingLabel) { - if (this.readyState === READY_STATES.LOADING) { - throw DOMException.create(this._globalObject, [ - "The object is in an invalid state.", - "InvalidStateError" - ]); - } - - this.readyState = READY_STATES.LOADING; - - setImmediate(() => { - if (this._terminated) { - this._terminated = false; - return; - } - - this._fireProgressEvent("loadstart"); - - this._fireProgressEvent("progress", { - lengthComputable: !isNaN(file.size), - total: file.size, - loaded: file._bytes.length - }); - - setImmediate(() => { - if (this._terminated) { - this._terminated = false; - return; - } - - switch (format) { - case "binaryString": { - // Convert Uint8Array to binary string (each byte as a code point) - let binaryString = ""; - for (let i = 0; i < file._bytes.length; i++) { - binaryString += String.fromCharCode(file._bytes[i]); - } - this.result = binaryString; - break; - } - case "dataURL": { - // Spec seems very unclear here; see https://github.com/w3c/FileAPI/issues/104. - const contentType = MIMEType.parse(file.type) || "application/octet-stream"; - this.result = `data:${contentType};base64,${toBase64(file._bytes)}`; - break; - } - case "text": { - this.result = legacyHookDecode(file._bytes, encodingLabel); - break; - } - case "buffer": - default: { - this.result = copyToArrayBufferInTargetRealm(file._bytes.buffer, this._globalObject); - break; - } - } - this.readyState = READY_STATES.DONE; - this._fireProgressEvent("load"); - this._fireProgressEvent("loadend"); - }); - }); - } -} -setupForSimpleEventAccessors(FileReaderImpl.prototype, events); - -exports.implementation = FileReaderImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AbortController.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AbortController.js deleted file mode 100644 index a08b424..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AbortController.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "AbortController"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'AbortController'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["AbortController"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class AbortController { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - abort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'abort' called on an object that is not a valid instance of AbortController." - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["any"](curArg, { - context: "Failed to execute 'abort' on 'AbortController': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].abort(...args); - } - - get signal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get signal' called on an object that is not a valid instance of AbortController." - ); - } - - return utils.getSameObject(this, "signal", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["signal"]); - }); - } - } - Object.defineProperties(AbortController.prototype, { - abort: { enumerable: true }, - signal: { enumerable: true }, - [Symbol.toStringTag]: { value: "AbortController", configurable: true } - }); - ctorRegistry[interfaceName] = AbortController; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: AbortController - }); -}; - -const Impl = require("../aborting/AbortController-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AbortSignal.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AbortSignal.js deleted file mode 100644 index 4b52812..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AbortSignal.js +++ /dev/null @@ -1,249 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const EventTarget = require("./EventTarget.js"); - -const interfaceName = "AbortSignal"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'AbortSignal'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["AbortSignal"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - EventTarget._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class AbortSignal extends globalObject.EventTarget { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - throwIfAborted() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'throwIfAborted' called on an object that is not a valid instance of AbortSignal." - ); - } - - return esValue[implSymbol].throwIfAborted(); - } - - get aborted() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get aborted' called on an object that is not a valid instance of AbortSignal." - ); - } - - return esValue[implSymbol]["aborted"]; - } - - get reason() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get reason' called on an object that is not a valid instance of AbortSignal." - ); - } - - return esValue[implSymbol]["reason"]; - } - - get onabort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onabort' called on an object that is not a valid instance of AbortSignal." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onabort"]); - } - - set onabort(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onabort' called on an object that is not a valid instance of AbortSignal." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onabort' property on 'AbortSignal': The provided value" - }); - } - esValue[implSymbol]["onabort"] = V; - } - - static abort() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["any"](curArg, { - context: "Failed to execute 'abort' on 'AbortSignal': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - return utils.tryWrapperForImpl(Impl.implementation.abort(globalObject, ...args)); - } - - static timeout(milliseconds) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'timeout' on 'AbortSignal': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long long"](curArg, { - context: "Failed to execute 'timeout' on 'AbortSignal': parameter 1", - globals: globalObject, - enforceRange: true - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(Impl.implementation.timeout(globalObject, ...args)); - } - - static any(signals) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'any' on 'AbortSignal': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (!utils.isObject(curArg)) { - throw new globalObject.TypeError( - "Failed to execute 'any' on 'AbortSignal': parameter 1" + " is not an iterable object." - ); - } else { - const V = []; - const tmp = curArg; - for (let nextItem of tmp) { - nextItem = exports.convert(globalObject, nextItem, { - context: "Failed to execute 'any' on 'AbortSignal': parameter 1" + "'s element" - }); - - V.push(nextItem); - } - curArg = V; - } - args.push(curArg); - } - return utils.tryWrapperForImpl(Impl.implementation.any(globalObject, ...args)); - } - } - Object.defineProperties(AbortSignal.prototype, { - throwIfAborted: { enumerable: true }, - aborted: { enumerable: true }, - reason: { enumerable: true }, - onabort: { enumerable: true }, - [Symbol.toStringTag]: { value: "AbortSignal", configurable: true } - }); - Object.defineProperties(AbortSignal, { - abort: { enumerable: true }, - timeout: { enumerable: true }, - any: { enumerable: true } - }); - ctorRegistry[interfaceName] = AbortSignal; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: AbortSignal - }); -}; - -const Impl = require("../aborting/AbortSignal-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AbstractRange.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AbstractRange.js deleted file mode 100644 index 37af8d4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AbstractRange.js +++ /dev/null @@ -1,171 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "AbstractRange"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'AbstractRange'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["AbstractRange"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class AbstractRange { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get startContainer() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get startContainer' called on an object that is not a valid instance of AbstractRange." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["startContainer"]); - } - - get startOffset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get startOffset' called on an object that is not a valid instance of AbstractRange." - ); - } - - return esValue[implSymbol]["startOffset"]; - } - - get endContainer() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get endContainer' called on an object that is not a valid instance of AbstractRange." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["endContainer"]); - } - - get endOffset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get endOffset' called on an object that is not a valid instance of AbstractRange." - ); - } - - return esValue[implSymbol]["endOffset"]; - } - - get collapsed() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get collapsed' called on an object that is not a valid instance of AbstractRange." - ); - } - - return esValue[implSymbol]["collapsed"]; - } - } - Object.defineProperties(AbstractRange.prototype, { - startContainer: { enumerable: true }, - startOffset: { enumerable: true }, - endContainer: { enumerable: true }, - endOffset: { enumerable: true }, - collapsed: { enumerable: true }, - [Symbol.toStringTag]: { value: "AbstractRange", configurable: true } - }); - ctorRegistry[interfaceName] = AbstractRange; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: AbstractRange - }); -}; - -const Impl = require("../range/AbstractRange-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AddEventListenerOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AddEventListenerOptions.js deleted file mode 100644 index 18a4a67..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AddEventListenerOptions.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const AbortSignal = require("./AbortSignal.js"); -const EventListenerOptions = require("./EventListenerOptions.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventListenerOptions._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "once"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'once' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "passive"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'passive' that", globals: globalObject }); - - ret[key] = value; - } - } - - { - const key = "signal"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = AbortSignal.convert(globalObject, value, { context: context + " has member 'signal' that" }); - - ret[key] = value; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AssignedNodesOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AssignedNodesOptions.js deleted file mode 100644 index 6a68e09..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/AssignedNodesOptions.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "flatten"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'flatten' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Attr.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Attr.js deleted file mode 100644 index 7ac8d10..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Attr.js +++ /dev/null @@ -1,217 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Node = require("./Node.js"); - -const interfaceName = "Attr"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Attr'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Attr"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Node._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Attr extends globalObject.Node { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get namespaceURI() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get namespaceURI' called on an object that is not a valid instance of Attr." - ); - } - - return esValue[implSymbol]["namespaceURI"]; - } - - get prefix() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get prefix' called on an object that is not a valid instance of Attr."); - } - - return esValue[implSymbol]["prefix"]; - } - - get localName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get localName' called on an object that is not a valid instance of Attr."); - } - - return esValue[implSymbol]["localName"]; - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get name' called on an object that is not a valid instance of Attr."); - } - - return esValue[implSymbol]["name"]; - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get value' called on an object that is not a valid instance of Attr."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["value"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set value' called on an object that is not a valid instance of Attr."); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'Attr': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["value"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ownerElement() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ownerElement' called on an object that is not a valid instance of Attr." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ownerElement"]); - } - - get specified() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get specified' called on an object that is not a valid instance of Attr."); - } - - return esValue[implSymbol]["specified"]; - } - } - Object.defineProperties(Attr.prototype, { - namespaceURI: { enumerable: true }, - prefix: { enumerable: true }, - localName: { enumerable: true }, - name: { enumerable: true }, - value: { enumerable: true }, - ownerElement: { enumerable: true }, - specified: { enumerable: true }, - [Symbol.toStringTag]: { value: "Attr", configurable: true } - }); - ctorRegistry[interfaceName] = Attr; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Attr - }); -}; - -const Impl = require("../attributes/Attr-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BarProp.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BarProp.js deleted file mode 100644 index 071dd5c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BarProp.js +++ /dev/null @@ -1,117 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "BarProp"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'BarProp'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["BarProp"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class BarProp { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get visible() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get visible' called on an object that is not a valid instance of BarProp."); - } - - return esValue[implSymbol]["visible"]; - } - } - Object.defineProperties(BarProp.prototype, { - visible: { enumerable: true }, - [Symbol.toStringTag]: { value: "BarProp", configurable: true } - }); - ctorRegistry[interfaceName] = BarProp; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: BarProp - }); -}; - -const Impl = require("../window/BarProp-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BeforeUnloadEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BeforeUnloadEvent.js deleted file mode 100644 index ac3e74f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BeforeUnloadEvent.js +++ /dev/null @@ -1,139 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "BeforeUnloadEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'BeforeUnloadEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["BeforeUnloadEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class BeforeUnloadEvent extends globalObject.Event { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get returnValue() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get returnValue' called on an object that is not a valid instance of BeforeUnloadEvent." - ); - } - - return esValue[implSymbol]["returnValue"]; - } - - set returnValue(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set returnValue' called on an object that is not a valid instance of BeforeUnloadEvent." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'returnValue' property on 'BeforeUnloadEvent': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["returnValue"] = V; - } - } - Object.defineProperties(BeforeUnloadEvent.prototype, { - returnValue: { enumerable: true }, - [Symbol.toStringTag]: { value: "BeforeUnloadEvent", configurable: true } - }); - ctorRegistry[interfaceName] = BeforeUnloadEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: BeforeUnloadEvent - }); -}; - -const Impl = require("../events/BeforeUnloadEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BinaryType.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BinaryType.js deleted file mode 100644 index 72fb574..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BinaryType.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["blob", "arraybuffer"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for BinaryType`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Blob.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Blob.js deleted file mode 100644 index 3ff4872..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Blob.js +++ /dev/null @@ -1,211 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const BlobPropertyBag = require("./BlobPropertyBag.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Blob"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Blob'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Blob"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Blob { - constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - if (!utils.isObject(curArg)) { - throw new globalObject.TypeError("Failed to construct 'Blob': parameter 1" + " is not an iterable object."); - } else { - const V = []; - const tmp = curArg; - for (let nextItem of tmp) { - if (exports.is(nextItem)) { - nextItem = utils.implForWrapper(nextItem); - } else if (utils.isArrayBuffer(nextItem)) { - nextItem = conversions["ArrayBuffer"](nextItem, { - context: "Failed to construct 'Blob': parameter 1" + "'s element", - globals: globalObject - }); - } else if (ArrayBuffer.isView(nextItem)) { - nextItem = conversions["ArrayBufferView"](nextItem, { - context: "Failed to construct 'Blob': parameter 1" + "'s element", - globals: globalObject - }); - } else { - nextItem = conversions["USVString"](nextItem, { - context: "Failed to construct 'Blob': parameter 1" + "'s element", - globals: globalObject - }); - } - V.push(nextItem); - } - curArg = V; - } - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = BlobPropertyBag.convert(globalObject, curArg, { context: "Failed to construct 'Blob': parameter 2" }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - slice() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'slice' called on an object that is not a valid instance of Blob."); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["long long"](curArg, { - context: "Failed to execute 'slice' on 'Blob': parameter 1", - globals: globalObject, - clamp: true - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["long long"](curArg, { - context: "Failed to execute 'slice' on 'Blob': parameter 2", - globals: globalObject, - clamp: true - }); - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'slice' on 'Blob': parameter 3", - globals: globalObject - }); - } - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].slice(...args)); - } - - get size() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get size' called on an object that is not a valid instance of Blob."); - } - - return esValue[implSymbol]["size"]; - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get type' called on an object that is not a valid instance of Blob."); - } - - return esValue[implSymbol]["type"]; - } - } - Object.defineProperties(Blob.prototype, { - slice: { enumerable: true }, - size: { enumerable: true }, - type: { enumerable: true }, - [Symbol.toStringTag]: { value: "Blob", configurable: true } - }); - ctorRegistry[interfaceName] = Blob; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Blob - }); -}; - -const Impl = require("../file-api/Blob-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobCallback.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobCallback.js deleted file mode 100644 index a302a40..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobCallback.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (typeof value !== "function") { - throw new globalObject.TypeError(context + " is not a function"); - } - - function invokeTheCallbackFunction(blob) { - const thisArg = utils.tryWrapperForImpl(this); - let callResult; - - blob = utils.tryWrapperForImpl(blob); - - callResult = Reflect.apply(value, thisArg, [blob]); - } - - invokeTheCallbackFunction.construct = blob => { - blob = utils.tryWrapperForImpl(blob); - - let callResult = Reflect.construct(value, [blob]); - }; - - invokeTheCallbackFunction[utils.wrapperSymbol] = value; - invokeTheCallbackFunction.objectReference = value; - - return invokeTheCallbackFunction; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobEvent.js deleted file mode 100644 index 0902bcd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobEvent.js +++ /dev/null @@ -1,157 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const BlobEventInit = require("./BlobEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "BlobEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'BlobEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["BlobEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class BlobEvent extends globalObject.Event { - constructor(type, eventInitDict) { - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to construct 'BlobEvent': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'BlobEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = BlobEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'BlobEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get data() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get data' called on an object that is not a valid instance of BlobEvent."); - } - - return utils.getSameObject(this, "data", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["data"]); - }); - } - - get timecode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get timecode' called on an object that is not a valid instance of BlobEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["timecode"]); - } - } - Object.defineProperties(BlobEvent.prototype, { - data: { enumerable: true }, - timecode: { enumerable: true }, - [Symbol.toStringTag]: { value: "BlobEvent", configurable: true } - }); - ctorRegistry[interfaceName] = BlobEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: BlobEvent - }); -}; - -const Impl = require("../events/BlobEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobEventInit.js deleted file mode 100644 index a359807..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobEventInit.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Blob = require("./Blob.js"); -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "data"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = Blob.convert(globalObject, value, { context: context + " has member 'data' that" }); - - ret[key] = value; - } else { - throw new globalObject.TypeError("data is required in 'BlobEventInit'"); - } - } - - { - const key = "timecode"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'timecode' that", globals: globalObject }); - - ret[key] = value; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobPropertyBag.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobPropertyBag.js deleted file mode 100644 index fc20211..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/BlobPropertyBag.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EndingType = require("./EndingType.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "endings"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = EndingType.convert(globalObject, value, { context: context + " has member 'endings' that" }); - - ret[key] = value; - } else { - ret[key] = "transparent"; - } - } - - { - const key = "type"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { context: context + " has member 'type' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CDATASection.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CDATASection.js deleted file mode 100644 index 1fa98ad..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CDATASection.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Text = require("./Text.js"); - -const interfaceName = "CDATASection"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'CDATASection'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["CDATASection"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Text._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class CDATASection extends globalObject.Text { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(CDATASection.prototype, { - [Symbol.toStringTag]: { value: "CDATASection", configurable: true } - }); - ctorRegistry[interfaceName] = CDATASection; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: CDATASection - }); -}; - -const Impl = require("../nodes/CDATASection-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CanPlayTypeResult.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CanPlayTypeResult.js deleted file mode 100644 index 2ebe383..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CanPlayTypeResult.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["", "maybe", "probably"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for CanPlayTypeResult`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CharacterData.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CharacterData.js deleted file mode 100644 index 50eb6e0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CharacterData.js +++ /dev/null @@ -1,453 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Node = require("./Node.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "CharacterData"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'CharacterData'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["CharacterData"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Node._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class CharacterData extends globalObject.Node { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - substringData(offset, count) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'substringData' called on an object that is not a valid instance of CharacterData." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'substringData' on 'CharacterData': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'substringData' on 'CharacterData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'substringData' on 'CharacterData': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].substringData(...args); - } - - appendData(data) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'appendData' called on an object that is not a valid instance of CharacterData." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'appendData' on 'CharacterData': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'appendData' on 'CharacterData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].appendData(...args); - } - - insertData(offset, data) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'insertData' called on an object that is not a valid instance of CharacterData." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'insertData' on 'CharacterData': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'insertData' on 'CharacterData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'insertData' on 'CharacterData': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].insertData(...args); - } - - deleteData(offset, count) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'deleteData' called on an object that is not a valid instance of CharacterData." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'deleteData' on 'CharacterData': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'deleteData' on 'CharacterData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'deleteData' on 'CharacterData': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].deleteData(...args); - } - - replaceData(offset, count, data) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'replaceData' called on an object that is not a valid instance of CharacterData." - ); - } - - if (arguments.length < 3) { - throw new globalObject.TypeError( - `Failed to execute 'replaceData' on 'CharacterData': 3 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'replaceData' on 'CharacterData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'replaceData' on 'CharacterData': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'replaceData' on 'CharacterData': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].replaceData(...args); - } - - before() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'before' called on an object that is not a valid instance of CharacterData."); - } - 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 'before' on 'CharacterData': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].before(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - after() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'after' called on an object that is not a valid instance of CharacterData."); - } - 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 'after' on 'CharacterData': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].after(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - replaceWith() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'replaceWith' called on an object that is not a valid instance of CharacterData." - ); - } - 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 'replaceWith' on 'CharacterData': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].replaceWith(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - remove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'remove' called on an object that is not a valid instance of CharacterData."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].remove(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get data() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get data' called on an object that is not a valid instance of CharacterData." - ); - } - - return esValue[implSymbol]["data"]; - } - - set data(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set data' called on an object that is not a valid instance of CharacterData." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'data' property on 'CharacterData': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - esValue[implSymbol]["data"] = V; - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of CharacterData." - ); - } - - return esValue[implSymbol]["length"]; - } - - get previousElementSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get previousElementSibling' called on an object that is not a valid instance of CharacterData." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["previousElementSibling"]); - } - - get nextElementSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get nextElementSibling' called on an object that is not a valid instance of CharacterData." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["nextElementSibling"]); - } - } - Object.defineProperties(CharacterData.prototype, { - substringData: { enumerable: true }, - appendData: { enumerable: true }, - insertData: { enumerable: true }, - deleteData: { enumerable: true }, - replaceData: { enumerable: true }, - before: { enumerable: true }, - after: { enumerable: true }, - replaceWith: { enumerable: true }, - remove: { enumerable: true }, - data: { enumerable: true }, - length: { enumerable: true }, - previousElementSibling: { enumerable: true }, - nextElementSibling: { enumerable: true }, - [Symbol.toStringTag]: { value: "CharacterData", configurable: true }, - [Symbol.unscopables]: { - value: { before: true, after: true, replaceWith: true, remove: true, __proto__: null }, - configurable: true - } - }); - ctorRegistry[interfaceName] = CharacterData; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: CharacterData - }); -}; - -const Impl = require("../nodes/CharacterData-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CloseEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CloseEvent.js deleted file mode 100644 index 51dacc6..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CloseEvent.js +++ /dev/null @@ -1,168 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const CloseEventInit = require("./CloseEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "CloseEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'CloseEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["CloseEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class CloseEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'CloseEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'CloseEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = CloseEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'CloseEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get wasClean() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get wasClean' called on an object that is not a valid instance of CloseEvent." - ); - } - - return esValue[implSymbol]["wasClean"]; - } - - get code() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get code' called on an object that is not a valid instance of CloseEvent."); - } - - return esValue[implSymbol]["code"]; - } - - get reason() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get reason' called on an object that is not a valid instance of CloseEvent." - ); - } - - return esValue[implSymbol]["reason"]; - } - } - Object.defineProperties(CloseEvent.prototype, { - wasClean: { enumerable: true }, - code: { enumerable: true }, - reason: { enumerable: true }, - [Symbol.toStringTag]: { value: "CloseEvent", configurable: true } - }); - ctorRegistry[interfaceName] = CloseEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: CloseEvent - }); -}; - -const Impl = require("../events/CloseEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CloseEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CloseEventInit.js deleted file mode 100644 index afdb65b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CloseEventInit.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "code"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned short"](value, { - context: context + " has member 'code' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "reason"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["USVString"](value, { - context: context + " has member 'reason' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "wasClean"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'wasClean' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Comment.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Comment.js deleted file mode 100644 index 6c21cec..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Comment.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const CharacterData = require("./CharacterData.js"); - -const interfaceName = "Comment"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Comment'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Comment"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - CharacterData._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Comment extends globalObject.CharacterData { - constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'Comment': parameter 1", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - } - Object.defineProperties(Comment.prototype, { [Symbol.toStringTag]: { value: "Comment", configurable: true } }); - ctorRegistry[interfaceName] = Comment; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Comment - }); -}; - -const Impl = require("../nodes/Comment-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CompositionEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CompositionEvent.js deleted file mode 100644 index d7c42ce..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CompositionEvent.js +++ /dev/null @@ -1,219 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const CompositionEventInit = require("./CompositionEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const UIEvent = require("./UIEvent.js"); - -const interfaceName = "CompositionEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'CompositionEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["CompositionEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - UIEvent._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class CompositionEvent extends globalObject.UIEvent { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'CompositionEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'CompositionEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = CompositionEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'CompositionEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - initCompositionEvent(typeArg) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'initCompositionEvent' called on an object that is not a valid instance of CompositionEvent." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'initCompositionEvent' on 'CompositionEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initCompositionEvent' on 'CompositionEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initCompositionEvent' on 'CompositionEvent': parameter 2", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initCompositionEvent' on 'CompositionEvent': parameter 3", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = utils.tryImplForWrapper(curArg); - } - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[4]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initCompositionEvent' on 'CompositionEvent': parameter 5", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - return esValue[implSymbol].initCompositionEvent(...args); - } - - get data() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get data' called on an object that is not a valid instance of CompositionEvent." - ); - } - - return esValue[implSymbol]["data"]; - } - } - Object.defineProperties(CompositionEvent.prototype, { - initCompositionEvent: { enumerable: true }, - data: { enumerable: true }, - [Symbol.toStringTag]: { value: "CompositionEvent", configurable: true } - }); - ctorRegistry[interfaceName] = CompositionEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: CompositionEvent - }); -}; - -const Impl = require("../events/CompositionEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CompositionEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CompositionEventInit.js deleted file mode 100644 index e9d9c1d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CompositionEventInit.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const UIEventInit = require("./UIEventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - UIEventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "data"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { context: context + " has member 'data' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Crypto.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Crypto.js deleted file mode 100644 index 0c4c517..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Crypto.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Crypto"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Crypto'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Crypto"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Crypto { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - getRandomValues(array) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getRandomValues' called on an object that is not a valid instance of Crypto." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getRandomValues' on 'Crypto': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (ArrayBuffer.isView(curArg)) { - curArg = conversions["ArrayBufferView"](curArg, { - context: "Failed to execute 'getRandomValues' on 'Crypto': parameter 1", - globals: globalObject - }); - } else { - throw new globalObject.TypeError( - "Failed to execute 'getRandomValues' on 'Crypto': parameter 1" + " is not of any supported type." - ); - } - args.push(curArg); - } - return esValue[implSymbol].getRandomValues(...args); - } - - randomUUID() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'randomUUID' called on an object that is not a valid instance of Crypto."); - } - - return esValue[implSymbol].randomUUID(); - } - } - Object.defineProperties(Crypto.prototype, { - getRandomValues: { enumerable: true }, - randomUUID: { enumerable: true }, - [Symbol.toStringTag]: { value: "Crypto", configurable: true } - }); - ctorRegistry[interfaceName] = Crypto; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Crypto - }); -}; - -const Impl = require("../crypto/Crypto-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomElementConstructor.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomElementConstructor.js deleted file mode 100644 index 7fac7e0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomElementConstructor.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (typeof value !== "function") { - throw new globalObject.TypeError(context + " is not a function"); - } - - function invokeTheCallbackFunction() { - const thisArg = utils.tryWrapperForImpl(this); - let callResult; - - callResult = Reflect.apply(value, thisArg, []); - - callResult = conversions["any"](callResult, { context: context, globals: globalObject }); - - return callResult; - } - - invokeTheCallbackFunction.construct = () => { - let callResult = Reflect.construct(value, []); - - callResult = conversions["any"](callResult, { context: context, globals: globalObject }); - - return callResult; - }; - - invokeTheCallbackFunction[utils.wrapperSymbol] = value; - invokeTheCallbackFunction.objectReference = value; - - return invokeTheCallbackFunction; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomElementRegistry.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomElementRegistry.js deleted file mode 100644 index 627b714..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomElementRegistry.js +++ /dev/null @@ -1,267 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const CustomElementConstructor = require("./CustomElementConstructor.js"); -const ElementDefinitionOptions = require("./ElementDefinitionOptions.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 implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "CustomElementRegistry"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'CustomElementRegistry'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["CustomElementRegistry"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class CustomElementRegistry { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - define(name, constructor) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'define' called on an object that is not a valid instance of CustomElementRegistry." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'define' on 'CustomElementRegistry': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'define' on 'CustomElementRegistry': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = CustomElementConstructor.convert(globalObject, curArg, { - context: "Failed to execute 'define' on 'CustomElementRegistry': parameter 2" - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = ElementDefinitionOptions.convert(globalObject, curArg, { - context: "Failed to execute 'define' on 'CustomElementRegistry': parameter 3" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].define(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get' called on an object that is not a valid instance of CustomElementRegistry." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'get' on 'CustomElementRegistry': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'get' on 'CustomElementRegistry': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].get(...args); - } - - getName(constructor) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getName' called on an object that is not a valid instance of CustomElementRegistry." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getName' on 'CustomElementRegistry': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = CustomElementConstructor.convert(globalObject, curArg, { - context: "Failed to execute 'getName' on 'CustomElementRegistry': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].getName(...args); - } - - whenDefined(name) { - try { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'whenDefined' called on an object that is not a valid instance of CustomElementRegistry." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'whenDefined' on 'CustomElementRegistry': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'whenDefined' on 'CustomElementRegistry': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].whenDefined(...args)); - } catch (e) { - return globalObject.Promise.reject(e); - } - } - - upgrade(root) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'upgrade' called on an object that is not a valid instance of CustomElementRegistry." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'upgrade' on 'CustomElementRegistry': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'upgrade' on 'CustomElementRegistry': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].upgrade(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(CustomElementRegistry.prototype, { - define: { enumerable: true }, - get: { enumerable: true }, - getName: { enumerable: true }, - whenDefined: { enumerable: true }, - upgrade: { enumerable: true }, - [Symbol.toStringTag]: { value: "CustomElementRegistry", configurable: true } - }); - ctorRegistry[interfaceName] = CustomElementRegistry; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: CustomElementRegistry - }); -}; - -const Impl = require("../custom-elements/CustomElementRegistry-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomEvent.js deleted file mode 100644 index a264be1..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomEvent.js +++ /dev/null @@ -1,206 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const CustomEventInit = require("./CustomEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "CustomEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'CustomEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["CustomEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class CustomEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'CustomEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'CustomEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = CustomEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'CustomEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - initCustomEvent(type) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'initCustomEvent' called on an object that is not a valid instance of CustomEvent." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'initCustomEvent' on 'CustomEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initCustomEvent' on 'CustomEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initCustomEvent' on 'CustomEvent': parameter 2", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initCustomEvent' on 'CustomEvent': parameter 3", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - curArg = conversions["any"](curArg, { - context: "Failed to execute 'initCustomEvent' on 'CustomEvent': parameter 4", - globals: globalObject - }); - } else { - curArg = null; - } - args.push(curArg); - } - return esValue[implSymbol].initCustomEvent(...args); - } - - get detail() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get detail' called on an object that is not a valid instance of CustomEvent." - ); - } - - return esValue[implSymbol]["detail"]; - } - } - Object.defineProperties(CustomEvent.prototype, { - initCustomEvent: { enumerable: true }, - detail: { enumerable: true }, - [Symbol.toStringTag]: { value: "CustomEvent", configurable: true } - }); - ctorRegistry[interfaceName] = CustomEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: CustomEvent - }); -}; - -const Impl = require("../events/CustomEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomEventInit.js deleted file mode 100644 index faf921f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/CustomEventInit.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "detail"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["any"](value, { context: context + " has member 'detail' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = null; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMException.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMException.js deleted file mode 100644 index bcc5ff6..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMException.js +++ /dev/null @@ -1,222 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DOMException"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DOMException'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DOMException"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DOMException { - constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'DOMException': parameter 1", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'DOMException': parameter 2", - globals: globalObject - }); - } else { - curArg = "Error"; - } - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of DOMException." - ); - } - - return esValue[implSymbol]["name"]; - } - - get message() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get message' called on an object that is not a valid instance of DOMException." - ); - } - - return esValue[implSymbol]["message"]; - } - - get code() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get code' called on an object that is not a valid instance of DOMException." - ); - } - - return esValue[implSymbol]["code"]; - } - } - Object.defineProperties(DOMException.prototype, { - name: { enumerable: true }, - message: { enumerable: true }, - code: { enumerable: true }, - [Symbol.toStringTag]: { value: "DOMException", configurable: true }, - INDEX_SIZE_ERR: { value: 1, enumerable: true }, - DOMSTRING_SIZE_ERR: { value: 2, enumerable: true }, - HIERARCHY_REQUEST_ERR: { value: 3, enumerable: true }, - WRONG_DOCUMENT_ERR: { value: 4, enumerable: true }, - INVALID_CHARACTER_ERR: { value: 5, enumerable: true }, - NO_DATA_ALLOWED_ERR: { value: 6, enumerable: true }, - NO_MODIFICATION_ALLOWED_ERR: { value: 7, enumerable: true }, - NOT_FOUND_ERR: { value: 8, enumerable: true }, - NOT_SUPPORTED_ERR: { value: 9, enumerable: true }, - INUSE_ATTRIBUTE_ERR: { value: 10, enumerable: true }, - INVALID_STATE_ERR: { value: 11, enumerable: true }, - SYNTAX_ERR: { value: 12, enumerable: true }, - INVALID_MODIFICATION_ERR: { value: 13, enumerable: true }, - NAMESPACE_ERR: { value: 14, enumerable: true }, - INVALID_ACCESS_ERR: { value: 15, enumerable: true }, - VALIDATION_ERR: { value: 16, enumerable: true }, - TYPE_MISMATCH_ERR: { value: 17, enumerable: true }, - SECURITY_ERR: { value: 18, enumerable: true }, - NETWORK_ERR: { value: 19, enumerable: true }, - ABORT_ERR: { value: 20, enumerable: true }, - URL_MISMATCH_ERR: { value: 21, enumerable: true }, - QUOTA_EXCEEDED_ERR: { value: 22, enumerable: true }, - TIMEOUT_ERR: { value: 23, enumerable: true }, - INVALID_NODE_TYPE_ERR: { value: 24, enumerable: true }, - DATA_CLONE_ERR: { value: 25, enumerable: true } - }); - Object.defineProperties(DOMException, { - INDEX_SIZE_ERR: { value: 1, enumerable: true }, - DOMSTRING_SIZE_ERR: { value: 2, enumerable: true }, - HIERARCHY_REQUEST_ERR: { value: 3, enumerable: true }, - WRONG_DOCUMENT_ERR: { value: 4, enumerable: true }, - INVALID_CHARACTER_ERR: { value: 5, enumerable: true }, - NO_DATA_ALLOWED_ERR: { value: 6, enumerable: true }, - NO_MODIFICATION_ALLOWED_ERR: { value: 7, enumerable: true }, - NOT_FOUND_ERR: { value: 8, enumerable: true }, - NOT_SUPPORTED_ERR: { value: 9, enumerable: true }, - INUSE_ATTRIBUTE_ERR: { value: 10, enumerable: true }, - INVALID_STATE_ERR: { value: 11, enumerable: true }, - SYNTAX_ERR: { value: 12, enumerable: true }, - INVALID_MODIFICATION_ERR: { value: 13, enumerable: true }, - NAMESPACE_ERR: { value: 14, enumerable: true }, - INVALID_ACCESS_ERR: { value: 15, enumerable: true }, - VALIDATION_ERR: { value: 16, enumerable: true }, - TYPE_MISMATCH_ERR: { value: 17, enumerable: true }, - SECURITY_ERR: { value: 18, enumerable: true }, - NETWORK_ERR: { value: 19, enumerable: true }, - ABORT_ERR: { value: 20, enumerable: true }, - URL_MISMATCH_ERR: { value: 21, enumerable: true }, - QUOTA_EXCEEDED_ERR: { value: 22, enumerable: true }, - TIMEOUT_ERR: { value: 23, enumerable: true }, - INVALID_NODE_TYPE_ERR: { value: 24, enumerable: true }, - DATA_CLONE_ERR: { value: 25, enumerable: true } - }); - ctorRegistry[interfaceName] = DOMException; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DOMException - }); -}; - -const Impl = require("../webidl/DOMException-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMImplementation.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMImplementation.js deleted file mode 100644 index ee8ee5d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMImplementation.js +++ /dev/null @@ -1,237 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const DocumentType = require("./DocumentType.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DOMImplementation"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DOMImplementation'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DOMImplementation"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DOMImplementation { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - createDocumentType(qualifiedName, publicId, systemId) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createDocumentType' called on an object that is not a valid instance of DOMImplementation." - ); - } - - if (arguments.length < 3) { - throw new globalObject.TypeError( - `Failed to execute 'createDocumentType' on 'DOMImplementation': 3 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].createDocumentType(...args)); - } - - createDocument(namespace, qualifiedName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createDocument' called on an object that is not a valid instance of DOMImplementation." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'createDocument' on 'DOMImplementation': 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 'createDocument' on 'DOMImplementation': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'createDocument' on 'DOMImplementation': parameter 2", - globals: globalObject, - treatNullAsEmptyString: true - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = DocumentType.convert(globalObject, curArg, { - context: "Failed to execute 'createDocument' on 'DOMImplementation': parameter 3" - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].createDocument(...args)); - } - - createHTMLDocument() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createHTMLDocument' called on an object that is not a valid instance of DOMImplementation." - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].createHTMLDocument(...args)); - } - - hasFeature() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'hasFeature' called on an object that is not a valid instance of DOMImplementation." - ); - } - - return esValue[implSymbol].hasFeature(); - } - } - Object.defineProperties(DOMImplementation.prototype, { - createDocumentType: { enumerable: true }, - createDocument: { enumerable: true }, - createHTMLDocument: { enumerable: true }, - hasFeature: { enumerable: true }, - [Symbol.toStringTag]: { value: "DOMImplementation", configurable: true } - }); - ctorRegistry[interfaceName] = DOMImplementation; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DOMImplementation - }); -}; - -const Impl = require("../nodes/DOMImplementation-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMParser.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMParser.js deleted file mode 100644 index 92eafdd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMParser.js +++ /dev/null @@ -1,140 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const SupportedType = require("./SupportedType.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DOMParser"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DOMParser'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DOMParser"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DOMParser { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - parseFromString(str, type) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'parseFromString' called on an object that is not a valid instance of DOMParser." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'parseFromString' on 'DOMParser': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'parseFromString' on 'DOMParser': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = SupportedType.convert(globalObject, curArg, { - context: "Failed to execute 'parseFromString' on 'DOMParser': parameter 2" - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].parseFromString(...args)); - } - } - Object.defineProperties(DOMParser.prototype, { - parseFromString: { enumerable: true }, - [Symbol.toStringTag]: { value: "DOMParser", configurable: true } - }); - ctorRegistry[interfaceName] = DOMParser; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DOMParser - }); -}; - -const Impl = require("../domparsing/DOMParser-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMRect.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMRect.js deleted file mode 100644 index 869b26d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMRect.js +++ /dev/null @@ -1,276 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const DOMRectInit = require("./DOMRectInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const DOMRectReadOnly = require("./DOMRectReadOnly.js"); - -const interfaceName = "DOMRect"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DOMRect'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DOMRect"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - DOMRectReadOnly._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DOMRect extends globalObject.DOMRectReadOnly { - constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["unrestricted double"](curArg, { - context: "Failed to construct 'DOMRect': parameter 1", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["unrestricted double"](curArg, { - context: "Failed to construct 'DOMRect': parameter 2", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["unrestricted double"](curArg, { - context: "Failed to construct 'DOMRect': parameter 3", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - curArg = conversions["unrestricted double"](curArg, { - context: "Failed to construct 'DOMRect': parameter 4", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get x() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get x' called on an object that is not a valid instance of DOMRect."); - } - - return esValue[implSymbol]["x"]; - } - - set x(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set x' called on an object that is not a valid instance of DOMRect."); - } - - V = conversions["unrestricted double"](V, { - context: "Failed to set the 'x' property on 'DOMRect': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["x"] = V; - } - - get y() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get y' called on an object that is not a valid instance of DOMRect."); - } - - return esValue[implSymbol]["y"]; - } - - set y(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set y' called on an object that is not a valid instance of DOMRect."); - } - - V = conversions["unrestricted double"](V, { - context: "Failed to set the 'y' property on 'DOMRect': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["y"] = V; - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get width' called on an object that is not a valid instance of DOMRect."); - } - - return esValue[implSymbol]["width"]; - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set width' called on an object that is not a valid instance of DOMRect."); - } - - V = conversions["unrestricted double"](V, { - context: "Failed to set the 'width' property on 'DOMRect': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["width"] = V; - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get height' called on an object that is not a valid instance of DOMRect."); - } - - return esValue[implSymbol]["height"]; - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set height' called on an object that is not a valid instance of DOMRect."); - } - - V = conversions["unrestricted double"](V, { - context: "Failed to set the 'height' property on 'DOMRect': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["height"] = V; - } - - static fromRect() { - const args = []; - { - let curArg = arguments[0]; - curArg = DOMRectInit.convert(globalObject, curArg, { - context: "Failed to execute 'fromRect' on 'DOMRect': parameter 1" - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(Impl.implementation.fromRect(globalObject, ...args)); - } - } - Object.defineProperties(DOMRect.prototype, { - x: { enumerable: true }, - y: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - [Symbol.toStringTag]: { value: "DOMRect", configurable: true } - }); - Object.defineProperties(DOMRect, { fromRect: { enumerable: true } }); - ctorRegistry[interfaceName] = DOMRect; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DOMRect - }); -}; - -const Impl = require("../geometry/DOMRect-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMRectInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMRectInit.js deleted file mode 100644 index 520aa96..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMRectInit.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "height"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unrestricted double"](value, { - context: context + " has member 'height' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "width"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unrestricted double"](value, { - context: context + " has member 'width' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "x"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unrestricted double"](value, { - context: context + " has member 'x' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "y"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unrestricted double"](value, { - context: context + " has member 'y' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMRectReadOnly.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMRectReadOnly.js deleted file mode 100644 index 79cdffe..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMRectReadOnly.js +++ /dev/null @@ -1,285 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const DOMRectInit = require("./DOMRectInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DOMRectReadOnly"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DOMRectReadOnly'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DOMRectReadOnly"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DOMRectReadOnly { - constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["unrestricted double"](curArg, { - context: "Failed to construct 'DOMRectReadOnly': parameter 1", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["unrestricted double"](curArg, { - context: "Failed to construct 'DOMRectReadOnly': parameter 2", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["unrestricted double"](curArg, { - context: "Failed to construct 'DOMRectReadOnly': parameter 3", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - curArg = conversions["unrestricted double"](curArg, { - context: "Failed to construct 'DOMRectReadOnly': parameter 4", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - toJSON() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'toJSON' called on an object that is not a valid instance of DOMRectReadOnly." - ); - } - - return esValue[implSymbol].toJSON(); - } - - get x() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get x' called on an object that is not a valid instance of DOMRectReadOnly." - ); - } - - return esValue[implSymbol]["x"]; - } - - get y() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get y' called on an object that is not a valid instance of DOMRectReadOnly." - ); - } - - return esValue[implSymbol]["y"]; - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of DOMRectReadOnly." - ); - } - - return esValue[implSymbol]["width"]; - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of DOMRectReadOnly." - ); - } - - return esValue[implSymbol]["height"]; - } - - get top() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get top' called on an object that is not a valid instance of DOMRectReadOnly." - ); - } - - return esValue[implSymbol]["top"]; - } - - get right() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get right' called on an object that is not a valid instance of DOMRectReadOnly." - ); - } - - return esValue[implSymbol]["right"]; - } - - get bottom() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get bottom' called on an object that is not a valid instance of DOMRectReadOnly." - ); - } - - return esValue[implSymbol]["bottom"]; - } - - get left() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get left' called on an object that is not a valid instance of DOMRectReadOnly." - ); - } - - return esValue[implSymbol]["left"]; - } - - static fromRect() { - const args = []; - { - let curArg = arguments[0]; - curArg = DOMRectInit.convert(globalObject, curArg, { - context: "Failed to execute 'fromRect' on 'DOMRectReadOnly': parameter 1" - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(Impl.implementation.fromRect(globalObject, ...args)); - } - } - Object.defineProperties(DOMRectReadOnly.prototype, { - toJSON: { enumerable: true }, - x: { enumerable: true }, - y: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - top: { enumerable: true }, - right: { enumerable: true }, - bottom: { enumerable: true }, - left: { enumerable: true }, - [Symbol.toStringTag]: { value: "DOMRectReadOnly", configurable: true } - }); - Object.defineProperties(DOMRectReadOnly, { fromRect: { enumerable: true } }); - ctorRegistry[interfaceName] = DOMRectReadOnly; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DOMRectReadOnly - }); -}; - -const Impl = require("../geometry/DOMRectReadOnly-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMStringMap.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMStringMap.js deleted file mode 100644 index 26a5fb6..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMStringMap.js +++ /dev/null @@ -1,297 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DOMStringMap"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DOMStringMap'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DOMStringMap"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DOMStringMap { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(DOMStringMap.prototype, { - [Symbol.toStringTag]: { value: "DOMStringMap", configurable: true } - }); - ctorRegistry[interfaceName] = DOMStringMap; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DOMStringMap - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!Object.hasOwn(target, key)) { - keys.add(`${key}`); - } - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - const namedValue = target[implSymbol][utils.namedGet](P); - - if (namedValue !== undefined && !Object.hasOwn(target, P) && !ignoreNamedProps) { - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - - if (typeof P === "string") { - let namedValue = V; - - namedValue = conversions["DOMString"](namedValue, { - context: "Failed to set the '" + P + "' property on 'DOMStringMap': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const creating = !(target[implSymbol][utils.namedGet](P) !== undefined); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - - return true; - } - } - let ownDesc; - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (desc.get || desc.set) { - return false; - } - - let namedValue = desc.value; - - namedValue = conversions["DOMString"](namedValue, { - context: "Failed to set the '" + P + "' property on 'DOMStringMap': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const creating = !(target[implSymbol][utils.namedGet](P) !== undefined); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - - return true; - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (target[implSymbol][utils.namedGet](P) !== undefined && !Object.hasOwn(target, P)) { - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - target[implSymbol][utils.namedDelete](P); - return true; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../nodes/DOMStringMap-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMTokenList.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMTokenList.js deleted file mode 100644 index 15e8ae4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DOMTokenList.js +++ /dev/null @@ -1,537 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DOMTokenList"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DOMTokenList'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DOMTokenList"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DOMTokenList { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'item' called on an object that is not a valid instance of DOMTokenList."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'DOMTokenList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'DOMTokenList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].item(...args); - } - - contains(token) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'contains' called on an object that is not a valid instance of DOMTokenList." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'contains' on 'DOMTokenList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'contains' on 'DOMTokenList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].contains(...args); - } - - add() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'add' called on an object that is not a valid instance of DOMTokenList."); - } - const args = []; - for (let i = 0; i < arguments.length; i++) { - let curArg = arguments[i]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'add' on 'DOMTokenList': parameter " + (i + 1), - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].add(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - remove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'remove' called on an object that is not a valid instance of DOMTokenList."); - } - const args = []; - for (let i = 0; i < arguments.length; i++) { - let curArg = arguments[i]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'remove' on 'DOMTokenList': parameter " + (i + 1), - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].remove(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - toggle(token) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'toggle' called on an object that is not a valid instance of DOMTokenList."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'toggle' on 'DOMTokenList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'toggle' on 'DOMTokenList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'toggle' on 'DOMTokenList': parameter 2", - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].toggle(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - replace(token, newToken) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'replace' called on an object that is not a valid instance of DOMTokenList."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'replace' on 'DOMTokenList': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'replace' on 'DOMTokenList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'replace' on 'DOMTokenList': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].replace(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - supports(token) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'supports' called on an object that is not a valid instance of DOMTokenList." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'supports' on 'DOMTokenList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'supports' on 'DOMTokenList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].supports(...args); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of DOMTokenList." - ); - } - - return esValue[implSymbol]["length"]; - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of DOMTokenList." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["value"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of DOMTokenList." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'DOMTokenList': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["value"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - toString() { - const esValue = this; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'toString' called on an object that is not a valid instance of DOMTokenList." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["value"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(DOMTokenList.prototype, { - item: { enumerable: true }, - contains: { enumerable: true }, - add: { enumerable: true }, - remove: { enumerable: true }, - toggle: { enumerable: true }, - replace: { enumerable: true }, - supports: { enumerable: true }, - length: { enumerable: true }, - value: { enumerable: true }, - toString: { enumerable: true }, - [Symbol.toStringTag]: { value: "DOMTokenList", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true }, - keys: { value: globalObject.Array.prototype.keys, configurable: true, enumerable: true, writable: true }, - values: { value: globalObject.Array.prototype.values, configurable: true, enumerable: true, writable: true }, - entries: { value: globalObject.Array.prototype.entries, configurable: true, enumerable: true, writable: true }, - forEach: { value: globalObject.Array.prototype.forEach, configurable: true, enumerable: true, writable: true } - }); - ctorRegistry[interfaceName] = DOMTokenList; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DOMTokenList - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../nodes/DOMTokenList-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEvent.js deleted file mode 100644 index b743c4c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEvent.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const DeviceMotionEventInit = require("./DeviceMotionEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "DeviceMotionEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DeviceMotionEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DeviceMotionEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DeviceMotionEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'DeviceMotionEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'DeviceMotionEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = DeviceMotionEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'DeviceMotionEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get acceleration() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get acceleration' called on an object that is not a valid instance of DeviceMotionEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["acceleration"]); - } - - get accelerationIncludingGravity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get accelerationIncludingGravity' called on an object that is not a valid instance of DeviceMotionEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["accelerationIncludingGravity"]); - } - - get rotationRate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rotationRate' called on an object that is not a valid instance of DeviceMotionEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["rotationRate"]); - } - - get interval() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get interval' called on an object that is not a valid instance of DeviceMotionEvent." - ); - } - - return esValue[implSymbol]["interval"]; - } - } - Object.defineProperties(DeviceMotionEvent.prototype, { - acceleration: { enumerable: true }, - accelerationIncludingGravity: { enumerable: true }, - rotationRate: { enumerable: true }, - interval: { enumerable: true }, - [Symbol.toStringTag]: { value: "DeviceMotionEvent", configurable: true } - }); - ctorRegistry[interfaceName] = DeviceMotionEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DeviceMotionEvent - }); -}; - -const Impl = require("../events/DeviceMotionEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventAcceleration.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventAcceleration.js deleted file mode 100644 index f5ed43c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventAcceleration.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DeviceMotionEventAcceleration"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DeviceMotionEventAcceleration'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DeviceMotionEventAcceleration"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DeviceMotionEventAcceleration { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get x() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get x' called on an object that is not a valid instance of DeviceMotionEventAcceleration." - ); - } - - return esValue[implSymbol]["x"]; - } - - get y() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get y' called on an object that is not a valid instance of DeviceMotionEventAcceleration." - ); - } - - return esValue[implSymbol]["y"]; - } - - get z() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get z' called on an object that is not a valid instance of DeviceMotionEventAcceleration." - ); - } - - return esValue[implSymbol]["z"]; - } - } - Object.defineProperties(DeviceMotionEventAcceleration.prototype, { - x: { enumerable: true }, - y: { enumerable: true }, - z: { enumerable: true }, - [Symbol.toStringTag]: { value: "DeviceMotionEventAcceleration", configurable: true } - }); - ctorRegistry[interfaceName] = DeviceMotionEventAcceleration; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DeviceMotionEventAcceleration - }); -}; - -const Impl = require("../deviceorientation/DeviceMotionEventAcceleration-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventAccelerationInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventAccelerationInit.js deleted file mode 100644 index de24a13..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventAccelerationInit.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "x"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["double"](value, { context: context + " has member 'x' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "y"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["double"](value, { context: context + " has member 'y' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "z"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["double"](value, { context: context + " has member 'z' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventInit.js deleted file mode 100644 index 9cb215e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventInit.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const DeviceMotionEventAccelerationInit = require("./DeviceMotionEventAccelerationInit.js"); -const DeviceMotionEventRotationRateInit = require("./DeviceMotionEventRotationRateInit.js"); -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "acceleration"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = DeviceMotionEventAccelerationInit.convert(globalObject, value, { - context: context + " has member 'acceleration' that" - }); - - ret[key] = value; - } - } - - { - const key = "accelerationIncludingGravity"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = DeviceMotionEventAccelerationInit.convert(globalObject, value, { - context: context + " has member 'accelerationIncludingGravity' that" - }); - - ret[key] = value; - } - } - - { - const key = "interval"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'interval' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "rotationRate"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = DeviceMotionEventRotationRateInit.convert(globalObject, value, { - context: context + " has member 'rotationRate' that" - }); - - ret[key] = value; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventRotationRate.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventRotationRate.js deleted file mode 100644 index 7413f08..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventRotationRate.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DeviceMotionEventRotationRate"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DeviceMotionEventRotationRate'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DeviceMotionEventRotationRate"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DeviceMotionEventRotationRate { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get alpha() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get alpha' called on an object that is not a valid instance of DeviceMotionEventRotationRate." - ); - } - - return esValue[implSymbol]["alpha"]; - } - - get beta() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get beta' called on an object that is not a valid instance of DeviceMotionEventRotationRate." - ); - } - - return esValue[implSymbol]["beta"]; - } - - get gamma() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get gamma' called on an object that is not a valid instance of DeviceMotionEventRotationRate." - ); - } - - return esValue[implSymbol]["gamma"]; - } - } - Object.defineProperties(DeviceMotionEventRotationRate.prototype, { - alpha: { enumerable: true }, - beta: { enumerable: true }, - gamma: { enumerable: true }, - [Symbol.toStringTag]: { value: "DeviceMotionEventRotationRate", configurable: true } - }); - ctorRegistry[interfaceName] = DeviceMotionEventRotationRate; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DeviceMotionEventRotationRate - }); -}; - -const Impl = require("../deviceorientation/DeviceMotionEventRotationRate-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventRotationRateInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventRotationRateInit.js deleted file mode 100644 index 355bcfb..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventRotationRateInit.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "alpha"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["double"](value, { context: context + " has member 'alpha' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "beta"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["double"](value, { context: context + " has member 'beta' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "gamma"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["double"](value, { context: context + " has member 'gamma' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceOrientationEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceOrientationEvent.js deleted file mode 100644 index 87f3158..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceOrientationEvent.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const DeviceOrientationEventInit = require("./DeviceOrientationEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "DeviceOrientationEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DeviceOrientationEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DeviceOrientationEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DeviceOrientationEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'DeviceOrientationEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'DeviceOrientationEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = DeviceOrientationEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'DeviceOrientationEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get alpha() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get alpha' called on an object that is not a valid instance of DeviceOrientationEvent." - ); - } - - return esValue[implSymbol]["alpha"]; - } - - get beta() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get beta' called on an object that is not a valid instance of DeviceOrientationEvent." - ); - } - - return esValue[implSymbol]["beta"]; - } - - get gamma() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get gamma' called on an object that is not a valid instance of DeviceOrientationEvent." - ); - } - - return esValue[implSymbol]["gamma"]; - } - - get absolute() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get absolute' called on an object that is not a valid instance of DeviceOrientationEvent." - ); - } - - return esValue[implSymbol]["absolute"]; - } - } - Object.defineProperties(DeviceOrientationEvent.prototype, { - alpha: { enumerable: true }, - beta: { enumerable: true }, - gamma: { enumerable: true }, - absolute: { enumerable: true }, - [Symbol.toStringTag]: { value: "DeviceOrientationEvent", configurable: true } - }); - ctorRegistry[interfaceName] = DeviceOrientationEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DeviceOrientationEvent - }); -}; - -const Impl = require("../events/DeviceOrientationEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceOrientationEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceOrientationEventInit.js deleted file mode 100644 index ce676ca..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DeviceOrientationEventInit.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "absolute"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'absolute' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "alpha"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["double"](value, { context: context + " has member 'alpha' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "beta"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["double"](value, { context: context + " has member 'beta' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "gamma"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["double"](value, { context: context + " has member 'gamma' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Document.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Document.js deleted file mode 100644 index 2d6acd4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Document.js +++ /dev/null @@ -1,4509 +0,0 @@ -"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 NodeFilter = require("./NodeFilter.js"); -const HTMLElement = require("./HTMLElement.js"); -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const OnErrorEventHandlerNonNull = require("./OnErrorEventHandlerNonNull.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Document"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Document'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Document"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -function getUnforgeables(globalObject) { - let unforgeables = unforgeablesMap.get(globalObject); - if (unforgeables === undefined) { - unforgeables = Object.create(null); - utils.define(unforgeables, { - get location() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get location' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["location"]); - }, - set location(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set location' called on an object that is not a valid instance of Document." - ); - } - - const Q = esValue["location"]; - if (!utils.isObject(Q)) { - throw new globalObject.TypeError("Property 'location' is not an object"); - } - Reflect.set(Q, "href", V); - } - }); - Object.defineProperties(unforgeables, { - location: { configurable: false } - }); - unforgeablesMap.set(globalObject, unforgeables); - } - return unforgeables; -} - -exports._internalSetup = (wrapper, globalObject) => { - Node._internalSetup(wrapper, globalObject); - - utils.define(wrapper, getUnforgeables(globalObject)); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const unforgeablesMap = new WeakMap(); -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - 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 globalObject.TypeError( - "'getElementsByTagName' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError( - "'getElementsByTagNameNS' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 2) { - throw new globalObject.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", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getElementsByTagNameNS' on 'Document': parameter 2", - globals: globalObject - }); - 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 globalObject.TypeError( - "'getElementsByClassName' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError( - "'createElement' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = ElementCreationOptions.convert(globalObject, curArg, { - context: "Failed to execute 'createElement' on 'Document': parameter 2" - }); - } else if (utils.isObject(curArg)) { - curArg = ElementCreationOptions.convert(globalObject, 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", - globals: globalObject - }); - } - } - 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 globalObject.TypeError( - "'createElementNS' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 2) { - throw new globalObject.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", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'createElementNS' on 'Document': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = ElementCreationOptions.convert(globalObject, curArg, { - context: "Failed to execute 'createElementNS' on 'Document': parameter 3" - }); - } else if (utils.isObject(curArg)) { - curArg = ElementCreationOptions.convert(globalObject, 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", - globals: globalObject - }); - } - } - 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 globalObject.TypeError( - "'createDocumentFragment' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].createDocumentFragment()); - } - - createTextNode(data) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createTextNode' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError( - "'createCDATASection' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError( - "'createComment' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError( - "'createProcessingInstruction' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 2) { - throw new globalObject.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", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'createProcessingInstruction' on 'Document': parameter 2", - globals: globalObject - }); - 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 globalObject.TypeError("'importNode' called on an object that is not a valid instance of Document."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'importNode' on 'Document': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, 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", - globals: globalObject - }); - } 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 globalObject.TypeError("'adoptNode' called on an object that is not a valid instance of Document."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'adoptNode' on 'Document': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, 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 globalObject.TypeError( - "'createAttribute' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError( - "'createAttributeNS' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 2) { - throw new globalObject.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", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'createAttributeNS' on 'Document': parameter 2", - globals: globalObject - }); - 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 globalObject.TypeError("'createEvent' called on an object that is not a valid instance of Document."); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError("'createRange' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].createRange()); - } - - createNodeIterator(root) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createNodeIterator' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'createNodeIterator' on 'Document': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, 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", - globals: globalObject - }); - } else { - curArg = 0xffffffff; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = NodeFilter.convert(globalObject, curArg, { - context: "Failed to execute 'createNodeIterator' on 'Document': parameter 3" - }); - } - } 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 globalObject.TypeError( - "'createTreeWalker' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'createTreeWalker' on 'Document': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, 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", - globals: globalObject - }); - } else { - curArg = 0xffffffff; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = NodeFilter.convert(globalObject, curArg, { - context: "Failed to execute 'createTreeWalker' on 'Document': parameter 3" - }); - } - } 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 globalObject.TypeError( - "'getElementsByName' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError("'open' called on an object that is not a valid instance of Document."); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'open' on 'Document': parameter 1", - globals: globalObject - }); - } 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", - globals: globalObject - }); - } 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 globalObject.TypeError("'close' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'write' called on an object that is not a valid instance of Document."); - } - 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), - globals: globalObject - }); - 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 globalObject.TypeError("'writeln' called on an object that is not a valid instance of Document."); - } - 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), - globals: globalObject - }); - 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 globalObject.TypeError("'hasFocus' called on an object that is not a valid instance of Document."); - } - - return esValue[implSymbol].hasFocus(); - } - - clear() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'clear' called on an object that is not a valid instance of Document."); - } - - return esValue[implSymbol].clear(); - } - - captureEvents() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'captureEvents' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol].captureEvents(); - } - - releaseEvents() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'releaseEvents' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol].releaseEvents(); - } - - getSelection() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getSelection' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].getSelection()); - } - - getElementById(elementId) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getElementById' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError("'prepend' called on an object that is not a valid instance of Document."); - } - 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), - globals: globalObject - }); - } - 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 globalObject.TypeError("'append' called on an object that is not a valid instance of Document."); - } - 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), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].append(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - replaceChildren() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'replaceChildren' called on an object that is not a valid instance of Document." - ); - } - 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 'replaceChildren' on 'Document': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].replaceChildren(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - querySelector(selectors) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'querySelector' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError( - "'querySelectorAll' called on an object that is not a valid instance of Document." - ); - } - - if (arguments.length < 1) { - throw new globalObject.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", - globals: globalObject - }); - 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 globalObject.TypeError( - "'get implementation' called on an object that is not a valid instance of Document." - ); - } - - 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 globalObject.TypeError("'get URL' called on an object that is not a valid instance of Document."); - } - - return esValue[implSymbol]["URL"]; - } - - get documentURI() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get documentURI' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol]["documentURI"]; - } - - get compatMode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get compatMode' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol]["compatMode"]; - } - - get characterSet() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get characterSet' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol]["characterSet"]; - } - - get charset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get charset' called on an object that is not a valid instance of Document."); - } - - return esValue[implSymbol]["charset"]; - } - - get inputEncoding() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get inputEncoding' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol]["inputEncoding"]; - } - - get contentType() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get contentType' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol]["contentType"]; - } - - get doctype() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get doctype' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["doctype"]); - } - - get documentElement() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get documentElement' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["documentElement"]); - } - - get referrer() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get referrer' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol]["referrer"]; - } - - get cookie() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get cookie' called on an object that is not a valid instance of Document."); - } - - return esValue[implSymbol]["cookie"]; - } - - set cookie(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set cookie' called on an object that is not a valid instance of Document."); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'cookie' property on 'Document': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["cookie"] = V; - } - - get lastModified() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get lastModified' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol]["lastModified"]; - } - - get readyState() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get readyState' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["readyState"]); - } - - get title() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get title' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'set title' called on an object that is not a valid instance of Document."); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'title' property on 'Document': The provided value", - globals: globalObject - }); - - 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 globalObject.TypeError("'get dir' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'set dir' called on an object that is not a valid instance of Document."); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'dir' property on 'Document': The provided value", - globals: globalObject - }); - - 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 globalObject.TypeError("'get body' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'set body' called on an object that is not a valid instance of Document."); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = HTMLElement.convert(globalObject, 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 globalObject.TypeError("'get head' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["head"]); - } - - get images() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get images' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'get embeds' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'get plugins' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'get links' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'get forms' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'get scripts' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError( - "'get currentScript' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["currentScript"]); - } - - get defaultView() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defaultView' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["defaultView"]); - } - - get onreadystatechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onreadystatechange"]); - } - - set onreadystatechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onreadystatechange' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onreadystatechange"] = V; - } - - get anchors() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get anchors' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError("'get applets' called on an object that is not a valid instance of Document."); - } - - 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 globalObject.TypeError( - "'get styleSheets' called on an object that is not a valid instance of Document." - ); - } - - 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 globalObject.TypeError("'get hidden' called on an object that is not a valid instance of Document."); - } - - return esValue[implSymbol]["hidden"]; - } - - get visibilityState() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get visibilityState' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["visibilityState"]); - } - - get onvisibilitychange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onvisibilitychange' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onvisibilitychange"]); - } - - set onvisibilitychange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onvisibilitychange' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onvisibilitychange' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onvisibilitychange"] = V; - } - - get onabort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onabort' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onabort"]); - } - - set onabort(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onabort' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onabort' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onabort"] = V; - } - - get onauxclick() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onauxclick' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onauxclick"]); - } - - set onauxclick(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onauxclick' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onauxclick' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onauxclick"] = V; - } - - get onbeforeinput() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforeinput' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforeinput"]); - } - - set onbeforeinput(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforeinput' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforeinput' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onbeforeinput"] = V; - } - - get onbeforematch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforematch' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforematch"]); - } - - set onbeforematch(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforematch' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforematch' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onbeforematch"] = V; - } - - get onbeforetoggle() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforetoggle' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforetoggle"]); - } - - set onbeforetoggle(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforetoggle' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforetoggle' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onbeforetoggle"] = V; - } - - get onblur() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onblur' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onblur"]); - } - - set onblur(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onblur' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onblur' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onblur"] = V; - } - - get oncancel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncancel' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncancel"]); - } - - set oncancel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncancel' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncancel' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oncancel"] = V; - } - - get oncanplay() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncanplay' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncanplay"]); - } - - set oncanplay(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncanplay' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncanplay' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oncanplay"] = V; - } - - get oncanplaythrough() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncanplaythrough' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncanplaythrough"]); - } - - set oncanplaythrough(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncanplaythrough' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncanplaythrough' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oncanplaythrough"] = V; - } - - get onchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onchange' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onchange"]); - } - - set onchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onchange' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onchange' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onchange"] = V; - } - - get onclick() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onclick' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onclick"]); - } - - set onclick(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onclick' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onclick' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onclick"] = V; - } - - get onclose() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onclose' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onclose"]); - } - - set onclose(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onclose' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onclose' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onclose"] = V; - } - - get oncontextlost() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncontextlost' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextlost"]); - } - - set oncontextlost(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncontextlost' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncontextlost' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oncontextlost"] = V; - } - - get oncontextmenu() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncontextmenu' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextmenu"]); - } - - set oncontextmenu(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncontextmenu' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncontextmenu' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oncontextmenu"] = V; - } - - get oncontextrestored() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncontextrestored' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextrestored"]); - } - - set oncontextrestored(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncontextrestored' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncontextrestored' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oncontextrestored"] = V; - } - - get oncopy() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get oncopy' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncopy"]); - } - - set oncopy(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set oncopy' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncopy' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oncopy"] = V; - } - - get oncuechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncuechange' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncuechange"]); - } - - set oncuechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncuechange' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncuechange' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oncuechange"] = V; - } - - get oncut() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get oncut' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncut"]); - } - - set oncut(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set oncut' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncut' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oncut"] = V; - } - - get ondblclick() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondblclick' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondblclick"]); - } - - set ondblclick(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondblclick' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondblclick' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ondblclick"] = V; - } - - get ondrag() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get ondrag' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondrag"]); - } - - set ondrag(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set ondrag' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondrag' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ondrag"] = V; - } - - get ondragend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragend' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragend"]); - } - - set ondragend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragend' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragend' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ondragend"] = V; - } - - get ondragenter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragenter' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragenter"]); - } - - set ondragenter(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragenter' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragenter' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ondragenter"] = V; - } - - get ondragleave() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragleave' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragleave"]); - } - - set ondragleave(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragleave' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragleave' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ondragleave"] = V; - } - - get ondragover() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragover' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragover"]); - } - - set ondragover(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragover' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragover' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ondragover"] = V; - } - - get ondragstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragstart' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragstart"]); - } - - set ondragstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragstart' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragstart' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ondragstart"] = V; - } - - get ondrop() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get ondrop' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondrop"]); - } - - set ondrop(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set ondrop' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondrop' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ondrop"] = V; - } - - get ondurationchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondurationchange' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondurationchange"]); - } - - set ondurationchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondurationchange' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondurationchange' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ondurationchange"] = V; - } - - get onemptied() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onemptied' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onemptied"]); - } - - set onemptied(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onemptied' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onemptied' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onemptied"] = V; - } - - get onended() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onended' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onended"]); - } - - set onended(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onended' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onended' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onended"] = V; - } - - get onerror() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onerror' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onerror"]); - } - - set onerror(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onerror' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = OnErrorEventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onerror' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onerror"] = V; - } - - get onfocus() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onfocus' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onfocus"]); - } - - set onfocus(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onfocus' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onfocus' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onfocus"] = V; - } - - get onformdata() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onformdata' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onformdata"]); - } - - set onformdata(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onformdata' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onformdata' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onformdata"] = V; - } - - get oninput() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get oninput' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oninput"]); - } - - set oninput(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set oninput' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oninput' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oninput"] = V; - } - - get oninvalid() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oninvalid' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oninvalid"]); - } - - set oninvalid(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oninvalid' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oninvalid' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["oninvalid"] = V; - } - - get onkeydown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onkeydown' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onkeydown"]); - } - - set onkeydown(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onkeydown' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onkeydown' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onkeydown"] = V; - } - - get onkeypress() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onkeypress' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onkeypress"]); - } - - set onkeypress(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onkeypress' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onkeypress' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onkeypress"] = V; - } - - get onkeyup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onkeyup' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onkeyup"]); - } - - set onkeyup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onkeyup' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onkeyup' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onkeyup"] = V; - } - - get onload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onload' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onload"]); - } - - set onload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onload' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onload' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onload"] = V; - } - - get onloadeddata() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadeddata' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadeddata"]); - } - - set onloadeddata(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadeddata' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadeddata' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onloadeddata"] = V; - } - - get onloadedmetadata() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadedmetadata' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadedmetadata"]); - } - - set onloadedmetadata(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadedmetadata' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadedmetadata' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onloadedmetadata"] = V; - } - - get onloadstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadstart' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadstart"]); - } - - set onloadstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadstart' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadstart' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onloadstart"] = V; - } - - get onmousedown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmousedown' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmousedown"]); - } - - set onmousedown(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmousedown' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmousedown' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onmousedown"] = V; - } - - get onmouseenter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseenter"]); - } - - set onmouseenter(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseenter' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onmouseenter"] = V; - } - - get onmouseleave() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseleave"]); - } - - set onmouseleave(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseleave' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onmouseleave"] = V; - } - - get onmousemove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmousemove' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmousemove"]); - } - - set onmousemove(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmousemove' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmousemove' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onmousemove"] = V; - } - - get onmouseout() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmouseout' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseout"]); - } - - set onmouseout(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmouseout' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseout' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onmouseout"] = V; - } - - get onmouseover() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmouseover' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseover"]); - } - - set onmouseover(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmouseover' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseover' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onmouseover"] = V; - } - - get onmouseup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmouseup' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseup"]); - } - - set onmouseup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmouseup' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseup' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onmouseup"] = V; - } - - get onpaste() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onpaste' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpaste"]); - } - - set onpaste(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onpaste' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpaste' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpaste"] = V; - } - - get onpause() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onpause' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpause"]); - } - - set onpause(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onpause' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpause' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpause"] = V; - } - - get onplay() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onplay' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onplay"]); - } - - set onplay(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onplay' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onplay' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onplay"] = V; - } - - get onplaying() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onplaying' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onplaying"]); - } - - set onplaying(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onplaying' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onplaying' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onplaying"] = V; - } - - get onprogress() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onprogress' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onprogress"]); - } - - set onprogress(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onprogress' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onprogress' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onprogress"] = V; - } - - get onratechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onratechange' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onratechange"]); - } - - set onratechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onratechange' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onratechange' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onratechange"] = V; - } - - get onreset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onreset' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onreset"]); - } - - set onreset(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onreset' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onreset' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onreset"] = V; - } - - get onresize() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onresize' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onresize"]); - } - - set onresize(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onresize' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onresize' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onresize"] = V; - } - - get onscroll() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onscroll' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onscroll"]); - } - - set onscroll(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onscroll' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onscroll' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onscroll"] = V; - } - - get onscrollend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onscrollend' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onscrollend"]); - } - - set onscrollend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onscrollend' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onscrollend' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onscrollend"] = V; - } - - get onsecuritypolicyviolation() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onsecuritypolicyviolation' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onsecuritypolicyviolation"]); - } - - set onsecuritypolicyviolation(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onsecuritypolicyviolation' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onsecuritypolicyviolation' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onsecuritypolicyviolation"] = V; - } - - get onseeked() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onseeked' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onseeked"]); - } - - set onseeked(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onseeked' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onseeked' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onseeked"] = V; - } - - get onseeking() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onseeking' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onseeking"]); - } - - set onseeking(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onseeking' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onseeking' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onseeking"] = V; - } - - get onselect() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onselect' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onselect"]); - } - - set onselect(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onselect' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onselect' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onselect"] = V; - } - - get onslotchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onslotchange' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onslotchange"]); - } - - set onslotchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onslotchange' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onslotchange' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onslotchange"] = V; - } - - get onstalled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onstalled' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onstalled"]); - } - - set onstalled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onstalled' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onstalled' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onstalled"] = V; - } - - get onsubmit() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onsubmit' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onsubmit"]); - } - - set onsubmit(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onsubmit' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onsubmit' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onsubmit"] = V; - } - - get onsuspend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onsuspend' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onsuspend"]); - } - - set onsuspend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onsuspend' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onsuspend' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onsuspend"] = V; - } - - get ontimeupdate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontimeupdate' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontimeupdate"]); - } - - set ontimeupdate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontimeupdate' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontimeupdate' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ontimeupdate"] = V; - } - - get ontoggle() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontoggle' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontoggle"]); - } - - set ontoggle(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontoggle' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontoggle' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ontoggle"] = V; - } - - get onvolumechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onvolumechange' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onvolumechange"]); - } - - set onvolumechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onvolumechange' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onvolumechange' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onvolumechange"] = V; - } - - get onwaiting() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwaiting' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwaiting"]); - } - - set onwaiting(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwaiting' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwaiting' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onwaiting"] = V; - } - - get onwebkitanimationend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkitanimationend' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkitanimationend"]); - } - - set onwebkitanimationend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkitanimationend' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkitanimationend' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onwebkitanimationend"] = V; - } - - get onwebkitanimationiteration() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkitanimationiteration' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkitanimationiteration"]); - } - - set onwebkitanimationiteration(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkitanimationiteration' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkitanimationiteration' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onwebkitanimationiteration"] = V; - } - - get onwebkitanimationstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkitanimationstart' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkitanimationstart"]); - } - - set onwebkitanimationstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkitanimationstart' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkitanimationstart' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onwebkitanimationstart"] = V; - } - - get onwebkittransitionend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkittransitionend' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkittransitionend"]); - } - - set onwebkittransitionend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkittransitionend' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkittransitionend' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onwebkittransitionend"] = V; - } - - get onwheel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onwheel' called on an object that is not a valid instance of Document."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwheel"]); - } - - set onwheel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onwheel' called on an object that is not a valid instance of Document."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwheel' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onwheel"] = V; - } - - get ontouchstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchstart' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchstart"]); - } - - set ontouchstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchstart' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchstart' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ontouchstart"] = V; - } - - get ontouchend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchend' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchend"]); - } - - set ontouchend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchend' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchend' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ontouchend"] = V; - } - - get ontouchmove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchmove' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchmove"]); - } - - set ontouchmove(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchmove' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchmove' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ontouchmove"] = V; - } - - get ontouchcancel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchcancel' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchcancel"]); - } - - set ontouchcancel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchcancel' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchcancel' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ontouchcancel"] = V; - } - - get onpointerover() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerover' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerover"]); - } - - set onpointerover(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerover' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerover' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpointerover"] = V; - } - - get onpointerenter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerenter' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerenter"]); - } - - set onpointerenter(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerenter' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerenter' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpointerenter"] = V; - } - - get onpointerdown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerdown' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerdown"]); - } - - set onpointerdown(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerdown' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerdown' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpointerdown"] = V; - } - - get onpointermove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointermove' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointermove"]); - } - - set onpointermove(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointermove' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointermove' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpointermove"] = V; - } - - get onpointerrawupdate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerrawupdate' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerrawupdate"]); - } - - set onpointerrawupdate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerrawupdate' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerrawupdate' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpointerrawupdate"] = V; - } - - get onpointerup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerup' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerup"]); - } - - set onpointerup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerup' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerup' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpointerup"] = V; - } - - get onpointercancel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointercancel' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointercancel"]); - } - - set onpointercancel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointercancel' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointercancel' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpointercancel"] = V; - } - - get onpointerout() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerout' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerout"]); - } - - set onpointerout(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerout' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerout' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpointerout"] = V; - } - - get onpointerleave() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerleave' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerleave"]); - } - - set onpointerleave(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerleave' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerleave' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onpointerleave"] = V; - } - - get ongotpointercapture() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ongotpointercapture' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ongotpointercapture"]); - } - - set ongotpointercapture(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ongotpointercapture' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ongotpointercapture' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["ongotpointercapture"] = V; - } - - get onlostpointercapture() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onlostpointercapture' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onlostpointercapture"]); - } - - set onlostpointercapture(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onlostpointercapture' called on an object that is not a valid instance of Document." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onlostpointercapture' property on 'Document': The provided value" - }); - } - esValue[implSymbol]["onlostpointercapture"] = V; - } - - get activeElement() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get activeElement' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["activeElement"]); - } - - get children() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get children' called on an object that is not a valid instance of Document." - ); - } - - return utils.getSameObject(this, "children", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["children"]); - }); - } - - get firstElementChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get firstElementChild' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["firstElementChild"]); - } - - get lastElementChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get lastElementChild' called on an object that is not a valid instance of Document." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["lastElementChild"]); - } - - get childElementCount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get childElementCount' called on an object that is not a valid instance of Document." - ); - } - - return esValue[implSymbol]["childElementCount"]; - } - } - Object.defineProperties(Document.prototype, { - getElementsByTagName: { enumerable: true }, - getElementsByTagNameNS: { enumerable: true }, - getElementsByClassName: { enumerable: true }, - createElement: { enumerable: true }, - createElementNS: { enumerable: true }, - createDocumentFragment: { enumerable: true }, - createTextNode: { enumerable: true }, - createCDATASection: { enumerable: true }, - createComment: { enumerable: true }, - createProcessingInstruction: { enumerable: true }, - importNode: { enumerable: true }, - adoptNode: { enumerable: true }, - createAttribute: { enumerable: true }, - createAttributeNS: { enumerable: true }, - createEvent: { enumerable: true }, - createRange: { enumerable: true }, - createNodeIterator: { enumerable: true }, - createTreeWalker: { enumerable: true }, - getElementsByName: { enumerable: true }, - open: { enumerable: true }, - close: { enumerable: true }, - write: { enumerable: true }, - writeln: { enumerable: true }, - hasFocus: { enumerable: true }, - clear: { enumerable: true }, - captureEvents: { enumerable: true }, - releaseEvents: { enumerable: true }, - getSelection: { enumerable: true }, - getElementById: { enumerable: true }, - prepend: { enumerable: true }, - append: { enumerable: true }, - replaceChildren: { enumerable: true }, - querySelector: { enumerable: true }, - querySelectorAll: { enumerable: true }, - implementation: { enumerable: true }, - URL: { enumerable: true }, - documentURI: { enumerable: true }, - compatMode: { enumerable: true }, - characterSet: { enumerable: true }, - charset: { enumerable: true }, - inputEncoding: { enumerable: true }, - contentType: { enumerable: true }, - doctype: { enumerable: true }, - documentElement: { enumerable: true }, - referrer: { enumerable: true }, - cookie: { enumerable: true }, - lastModified: { enumerable: true }, - readyState: { enumerable: true }, - title: { enumerable: true }, - dir: { enumerable: true }, - body: { enumerable: true }, - head: { enumerable: true }, - images: { enumerable: true }, - embeds: { enumerable: true }, - plugins: { enumerable: true }, - links: { enumerable: true }, - forms: { enumerable: true }, - scripts: { enumerable: true }, - currentScript: { enumerable: true }, - defaultView: { enumerable: true }, - onreadystatechange: { enumerable: true }, - anchors: { enumerable: true }, - applets: { enumerable: true }, - styleSheets: { enumerable: true }, - hidden: { enumerable: true }, - visibilityState: { enumerable: true }, - onvisibilitychange: { enumerable: true }, - onabort: { enumerable: true }, - onauxclick: { enumerable: true }, - onbeforeinput: { enumerable: true }, - onbeforematch: { enumerable: true }, - onbeforetoggle: { enumerable: true }, - onblur: { enumerable: true }, - oncancel: { enumerable: true }, - oncanplay: { enumerable: true }, - oncanplaythrough: { enumerable: true }, - onchange: { enumerable: true }, - onclick: { enumerable: true }, - onclose: { enumerable: true }, - oncontextlost: { enumerable: true }, - oncontextmenu: { enumerable: true }, - oncontextrestored: { enumerable: true }, - oncopy: { enumerable: true }, - oncuechange: { enumerable: true }, - oncut: { enumerable: true }, - ondblclick: { enumerable: true }, - ondrag: { enumerable: true }, - ondragend: { enumerable: true }, - ondragenter: { enumerable: true }, - ondragleave: { enumerable: true }, - ondragover: { enumerable: true }, - ondragstart: { enumerable: true }, - ondrop: { enumerable: true }, - ondurationchange: { enumerable: true }, - onemptied: { enumerable: true }, - onended: { enumerable: true }, - onerror: { enumerable: true }, - onfocus: { enumerable: true }, - onformdata: { enumerable: true }, - oninput: { enumerable: true }, - oninvalid: { enumerable: true }, - onkeydown: { enumerable: true }, - onkeypress: { enumerable: true }, - onkeyup: { enumerable: true }, - onload: { enumerable: true }, - onloadeddata: { enumerable: true }, - onloadedmetadata: { enumerable: true }, - onloadstart: { enumerable: true }, - onmousedown: { enumerable: true }, - onmouseenter: { enumerable: true }, - onmouseleave: { enumerable: true }, - onmousemove: { enumerable: true }, - onmouseout: { enumerable: true }, - onmouseover: { enumerable: true }, - onmouseup: { enumerable: true }, - onpaste: { enumerable: true }, - onpause: { enumerable: true }, - onplay: { enumerable: true }, - onplaying: { enumerable: true }, - onprogress: { enumerable: true }, - onratechange: { enumerable: true }, - onreset: { enumerable: true }, - onresize: { enumerable: true }, - onscroll: { enumerable: true }, - onscrollend: { enumerable: true }, - onsecuritypolicyviolation: { enumerable: true }, - onseeked: { enumerable: true }, - onseeking: { enumerable: true }, - onselect: { enumerable: true }, - onslotchange: { enumerable: true }, - onstalled: { enumerable: true }, - onsubmit: { enumerable: true }, - onsuspend: { enumerable: true }, - ontimeupdate: { enumerable: true }, - ontoggle: { enumerable: true }, - onvolumechange: { enumerable: true }, - onwaiting: { enumerable: true }, - onwebkitanimationend: { enumerable: true }, - onwebkitanimationiteration: { enumerable: true }, - onwebkitanimationstart: { enumerable: true }, - onwebkittransitionend: { enumerable: true }, - onwheel: { enumerable: true }, - ontouchstart: { enumerable: true }, - ontouchend: { enumerable: true }, - ontouchmove: { enumerable: true }, - ontouchcancel: { enumerable: true }, - onpointerover: { enumerable: true }, - onpointerenter: { enumerable: true }, - onpointerdown: { enumerable: true }, - onpointermove: { enumerable: true }, - onpointerrawupdate: { enumerable: true }, - onpointerup: { enumerable: true }, - onpointercancel: { enumerable: true }, - onpointerout: { enumerable: true }, - onpointerleave: { enumerable: true }, - ongotpointercapture: { enumerable: true }, - onlostpointercapture: { enumerable: true }, - activeElement: { enumerable: true }, - children: { enumerable: true }, - firstElementChild: { enumerable: true }, - lastElementChild: { enumerable: true }, - childElementCount: { enumerable: true }, - [Symbol.toStringTag]: { value: "Document", configurable: true }, - [Symbol.unscopables]: { - value: { prepend: true, append: true, replaceChildren: true, __proto__: null }, - configurable: true - } - }); - ctorRegistry[interfaceName] = Document; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Document - }); -}; - -const Impl = require("../nodes/Document-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DocumentFragment.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DocumentFragment.js deleted file mode 100644 index 25991ff..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DocumentFragment.js +++ /dev/null @@ -1,334 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Node = require("./Node.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DocumentFragment"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DocumentFragment'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DocumentFragment"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Node._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DocumentFragment extends globalObject.Node { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - getElementById(elementId) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getElementById' called on an object that is not a valid instance of DocumentFragment." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getElementById' on 'DocumentFragment': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getElementById' on 'DocumentFragment': parameter 1", - globals: globalObject - }); - 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 globalObject.TypeError( - "'prepend' called on an object that is not a valid instance of DocumentFragment." - ); - } - 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 'DocumentFragment': parameter " + (i + 1), - globals: globalObject - }); - } - 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 globalObject.TypeError( - "'append' called on an object that is not a valid instance of DocumentFragment." - ); - } - 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 'DocumentFragment': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].append(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - replaceChildren() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'replaceChildren' called on an object that is not a valid instance of DocumentFragment." - ); - } - 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 'replaceChildren' on 'DocumentFragment': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].replaceChildren(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - querySelector(selectors) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'querySelector' called on an object that is not a valid instance of DocumentFragment." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'querySelector' on 'DocumentFragment': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'querySelector' on 'DocumentFragment': parameter 1", - globals: globalObject - }); - 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 globalObject.TypeError( - "'querySelectorAll' called on an object that is not a valid instance of DocumentFragment." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'querySelectorAll' on 'DocumentFragment': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'querySelectorAll' on 'DocumentFragment': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].querySelectorAll(...args)); - } - - get children() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get children' called on an object that is not a valid instance of DocumentFragment." - ); - } - - return utils.getSameObject(this, "children", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["children"]); - }); - } - - get firstElementChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get firstElementChild' called on an object that is not a valid instance of DocumentFragment." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["firstElementChild"]); - } - - get lastElementChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get lastElementChild' called on an object that is not a valid instance of DocumentFragment." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["lastElementChild"]); - } - - get childElementCount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get childElementCount' called on an object that is not a valid instance of DocumentFragment." - ); - } - - return esValue[implSymbol]["childElementCount"]; - } - } - Object.defineProperties(DocumentFragment.prototype, { - getElementById: { enumerable: true }, - prepend: { enumerable: true }, - append: { enumerable: true }, - replaceChildren: { enumerable: true }, - querySelector: { enumerable: true }, - querySelectorAll: { enumerable: true }, - children: { enumerable: true }, - firstElementChild: { enumerable: true }, - lastElementChild: { enumerable: true }, - childElementCount: { enumerable: true }, - [Symbol.toStringTag]: { value: "DocumentFragment", configurable: true }, - [Symbol.unscopables]: { - value: { prepend: true, append: true, replaceChildren: true, __proto__: null }, - configurable: true - } - }); - ctorRegistry[interfaceName] = DocumentFragment; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DocumentFragment - }); -}; - -const Impl = require("../nodes/DocumentFragment-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DocumentReadyState.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DocumentReadyState.js deleted file mode 100644 index 5b7e85d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DocumentReadyState.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["loading", "interactive", "complete"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for DocumentReadyState`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DocumentType.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DocumentType.js deleted file mode 100644 index 2ffb894..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/DocumentType.js +++ /dev/null @@ -1,252 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Node = require("./Node.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "DocumentType"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'DocumentType'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["DocumentType"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Node._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class DocumentType extends globalObject.Node { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - before() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'before' called on an object that is not a valid instance of DocumentType."); - } - 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 'before' on 'DocumentType': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].before(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - after() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'after' called on an object that is not a valid instance of DocumentType."); - } - 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 'after' on 'DocumentType': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].after(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - replaceWith() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'replaceWith' called on an object that is not a valid instance of DocumentType." - ); - } - 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 'replaceWith' on 'DocumentType': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].replaceWith(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - remove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'remove' called on an object that is not a valid instance of DocumentType."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].remove(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of DocumentType." - ); - } - - return esValue[implSymbol]["name"]; - } - - get publicId() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get publicId' called on an object that is not a valid instance of DocumentType." - ); - } - - return esValue[implSymbol]["publicId"]; - } - - get systemId() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get systemId' called on an object that is not a valid instance of DocumentType." - ); - } - - return esValue[implSymbol]["systemId"]; - } - } - Object.defineProperties(DocumentType.prototype, { - before: { enumerable: true }, - after: { enumerable: true }, - replaceWith: { enumerable: true }, - remove: { enumerable: true }, - name: { enumerable: true }, - publicId: { enumerable: true }, - systemId: { enumerable: true }, - [Symbol.toStringTag]: { value: "DocumentType", configurable: true }, - [Symbol.unscopables]: { - value: { before: true, after: true, replaceWith: true, remove: true, __proto__: null }, - configurable: true - } - }); - ctorRegistry[interfaceName] = DocumentType; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DocumentType - }); -}; - -const Impl = require("../nodes/DocumentType-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Element.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Element.js deleted file mode 100644 index 713b7c1..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Element.js +++ /dev/null @@ -1,3718 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const Attr = require("./Attr.js"); -const ShadowRootInit = require("./ShadowRootInit.js"); -const Node = require("./Node.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Element"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Element'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Element"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Node._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Element extends globalObject.Node { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - hasAttributes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'hasAttributes' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol].hasAttributes(); - } - - getAttributeNames() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getAttributeNames' called on an object that is not a valid instance of Element." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].getAttributeNames()); - } - - getAttribute(qualifiedName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'getAttribute' called on an object that is not a valid instance of Element."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getAttribute' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getAttribute' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].getAttribute(...args); - } - - getAttributeNS(namespace, localName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getAttributeNS' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'getAttributeNS' on 'Element': 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 'getAttributeNS' on 'Element': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getAttributeNS' on 'Element': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].getAttributeNS(...args); - } - - setAttribute(qualifiedName, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'setAttribute' called on an object that is not a valid instance of Element."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'setAttribute' on 'Element': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setAttribute' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setAttribute' on 'Element': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].setAttribute(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - setAttributeNS(namespace, qualifiedName, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setAttributeNS' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 3) { - throw new globalObject.TypeError( - `Failed to execute 'setAttributeNS' on 'Element': 3 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 'setAttributeNS' on 'Element': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setAttributeNS' on 'Element': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setAttributeNS' on 'Element': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].setAttributeNS(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - removeAttribute(qualifiedName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'removeAttribute' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'removeAttribute' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'removeAttribute' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].removeAttribute(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - removeAttributeNS(namespace, localName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'removeAttributeNS' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'removeAttributeNS' on 'Element': 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 'removeAttributeNS' on 'Element': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'removeAttributeNS' on 'Element': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].removeAttributeNS(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - toggleAttribute(qualifiedName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'toggleAttribute' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'toggleAttribute' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'toggleAttribute' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'toggleAttribute' on 'Element': parameter 2", - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].toggleAttribute(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - hasAttribute(qualifiedName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'hasAttribute' called on an object that is not a valid instance of Element."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'hasAttribute' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'hasAttribute' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].hasAttribute(...args); - } - - hasAttributeNS(namespace, localName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'hasAttributeNS' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'hasAttributeNS' on 'Element': 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 'hasAttributeNS' on 'Element': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'hasAttributeNS' on 'Element': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].hasAttributeNS(...args); - } - - getAttributeNode(qualifiedName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getAttributeNode' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getAttributeNode' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getAttributeNode' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getAttributeNode(...args)); - } - - getAttributeNodeNS(namespace, localName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getAttributeNodeNS' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'getAttributeNodeNS' on 'Element': 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 'getAttributeNodeNS' on 'Element': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getAttributeNodeNS' on 'Element': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getAttributeNodeNS(...args)); - } - - setAttributeNode(attr) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setAttributeNode' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setAttributeNode' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Attr.convert(globalObject, curArg, { - context: "Failed to execute 'setAttributeNode' on 'Element': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].setAttributeNode(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - setAttributeNodeNS(attr) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setAttributeNodeNS' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setAttributeNodeNS' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Attr.convert(globalObject, curArg, { - context: "Failed to execute 'setAttributeNodeNS' on 'Element': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].setAttributeNodeNS(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - removeAttributeNode(attr) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'removeAttributeNode' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'removeAttributeNode' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Attr.convert(globalObject, curArg, { - context: "Failed to execute 'removeAttributeNode' on 'Element': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].removeAttributeNode(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - attachShadow(init) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'attachShadow' called on an object that is not a valid instance of Element."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'attachShadow' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = ShadowRootInit.convert(globalObject, curArg, { - context: "Failed to execute 'attachShadow' on 'Element': parameter 1" - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].attachShadow(...args)); - } - - closest(selectors) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'closest' called on an object that is not a valid instance of Element."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'closest' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'closest' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].closest(...args)); - } - - matches(selectors) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'matches' called on an object that is not a valid instance of Element."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'matches' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'matches' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].matches(...args); - } - - webkitMatchesSelector(selectors) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'webkitMatchesSelector' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'webkitMatchesSelector' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'webkitMatchesSelector' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].webkitMatchesSelector(...args); - } - - getElementsByTagName(qualifiedName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getElementsByTagName' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getElementsByTagName' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getElementsByTagName' on 'Element': parameter 1", - globals: globalObject - }); - 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 globalObject.TypeError( - "'getElementsByTagNameNS' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'getElementsByTagNameNS' on 'Element': 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 'Element': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getElementsByTagNameNS' on 'Element': parameter 2", - globals: globalObject - }); - 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 globalObject.TypeError( - "'getElementsByClassName' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getElementsByClassName' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getElementsByClassName' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getElementsByClassName(...args)); - } - - insertAdjacentElement(where, element) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'insertAdjacentElement' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'insertAdjacentElement' on 'Element': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'insertAdjacentElement' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'insertAdjacentElement' on 'Element': parameter 2" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].insertAdjacentElement(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - insertAdjacentText(where, data) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'insertAdjacentText' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'insertAdjacentText' on 'Element': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'insertAdjacentText' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'insertAdjacentText' on 'Element': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].insertAdjacentText(...args); - } - - insertAdjacentHTML(position, text) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'insertAdjacentHTML' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'insertAdjacentHTML' on 'Element': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'insertAdjacentHTML' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'insertAdjacentHTML' on 'Element': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].insertAdjacentHTML(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - getClientRects() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getClientRects' called on an object that is not a valid instance of Element." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].getClientRects()); - } - - getBoundingClientRect() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getBoundingClientRect' called on an object that is not a valid instance of Element." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].getBoundingClientRect()); - } - - before() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'before' called on an object that is not a valid instance of Element."); - } - 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 'before' on 'Element': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].before(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - after() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'after' called on an object that is not a valid instance of Element."); - } - 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 'after' on 'Element': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].after(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - replaceWith() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'replaceWith' called on an object that is not a valid instance of Element."); - } - 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 'replaceWith' on 'Element': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].replaceWith(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - remove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'remove' called on an object that is not a valid instance of Element."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].remove(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - prepend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'prepend' called on an object that is not a valid instance of Element."); - } - 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 'Element': parameter " + (i + 1), - globals: globalObject - }); - } - 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 globalObject.TypeError("'append' called on an object that is not a valid instance of Element."); - } - 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 'Element': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].append(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - replaceChildren() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'replaceChildren' called on an object that is not a valid instance of Element." - ); - } - 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 'replaceChildren' on 'Element': parameter " + (i + 1), - globals: globalObject - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].replaceChildren(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - querySelector(selectors) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'querySelector' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'querySelector' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'querySelector' on 'Element': parameter 1", - globals: globalObject - }); - 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 globalObject.TypeError( - "'querySelectorAll' called on an object that is not a valid instance of Element." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'querySelectorAll' on 'Element': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'querySelectorAll' on 'Element': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].querySelectorAll(...args)); - } - - get namespaceURI() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get namespaceURI' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["namespaceURI"]; - } - - get prefix() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get prefix' called on an object that is not a valid instance of Element."); - } - - return esValue[implSymbol]["prefix"]; - } - - get localName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get localName' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["localName"]; - } - - get tagName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get tagName' called on an object that is not a valid instance of Element."); - } - - return esValue[implSymbol]["tagName"]; - } - - get id() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get id' called on an object that is not a valid instance of Element."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("id"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set id(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set id' called on an object that is not a valid instance of Element."); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'id' property on 'Element': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("id", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get className() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get className' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("class"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set className(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set className' called on an object that is not a valid instance of Element." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'className' property on 'Element': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("class", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get classList() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get classList' called on an object that is not a valid instance of Element." - ); - } - - return utils.getSameObject(this, "classList", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["classList"]); - }); - } - - set classList(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set classList' called on an object that is not a valid instance of Element." - ); - } - - const Q = esValue["classList"]; - if (!utils.isObject(Q)) { - throw new globalObject.TypeError("Property 'classList' is not an object"); - } - Reflect.set(Q, "value", V); - } - - get slot() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get slot' called on an object that is not a valid instance of Element."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("slot"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set slot(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set slot' called on an object that is not a valid instance of Element."); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'slot' property on 'Element': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("slot", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get attributes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get attributes' called on an object that is not a valid instance of Element." - ); - } - - return utils.getSameObject(this, "attributes", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["attributes"]); - }); - } - - get shadowRoot() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get shadowRoot' called on an object that is not a valid instance of Element." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["shadowRoot"]); - } - - get outerHTML() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get outerHTML' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["outerHTML"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set outerHTML(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set outerHTML' called on an object that is not a valid instance of Element." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'outerHTML' property on 'Element': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["outerHTML"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get scrollTop() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scrollTop' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["scrollTop"]; - } - - set scrollTop(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set scrollTop' called on an object that is not a valid instance of Element." - ); - } - - V = conversions["unrestricted double"](V, { - context: "Failed to set the 'scrollTop' property on 'Element': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["scrollTop"] = V; - } - - get scrollLeft() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scrollLeft' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["scrollLeft"]; - } - - set scrollLeft(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set scrollLeft' called on an object that is not a valid instance of Element." - ); - } - - V = conversions["unrestricted double"](V, { - context: "Failed to set the 'scrollLeft' property on 'Element': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["scrollLeft"] = V; - } - - get scrollWidth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scrollWidth' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["scrollWidth"]; - } - - get scrollHeight() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scrollHeight' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["scrollHeight"]; - } - - get clientTop() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get clientTop' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["clientTop"]; - } - - get clientLeft() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get clientLeft' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["clientLeft"]; - } - - get clientWidth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get clientWidth' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["clientWidth"]; - } - - get clientHeight() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get clientHeight' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["clientHeight"]; - } - - get innerHTML() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get innerHTML' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["innerHTML"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set innerHTML(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set innerHTML' called on an object that is not a valid instance of Element." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'innerHTML' property on 'Element': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["innerHTML"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get role() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get role' called on an object that is not a valid instance of Element."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("role"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set role(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set role' called on an object that is not a valid instance of Element."); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'role' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("role"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("role", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaAtomic() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaAtomic' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-atomic"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaAtomic(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaAtomic' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaAtomic' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-atomic"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-atomic", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaAutoComplete() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaAutoComplete' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-autocomplete"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaAutoComplete(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaAutoComplete' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaAutoComplete' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-autocomplete"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-autocomplete", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaBusy() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get ariaBusy' called on an object that is not a valid instance of Element."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-busy"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaBusy(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set ariaBusy' called on an object that is not a valid instance of Element."); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaBusy' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-busy"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-busy", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaChecked() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaChecked' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-checked"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaChecked(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaChecked' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaChecked' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-checked"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-checked", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaColCount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaColCount' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-colcount"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaColCount(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaColCount' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaColCount' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-colcount"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-colcount", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaColIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaColIndex' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-colindex"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaColIndex(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaColIndex' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaColIndex' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-colindex"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-colindex", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaColIndexText() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaColIndexText' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-colindextext"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaColIndexText(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaColIndexText' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaColIndexText' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-colindextext"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-colindextext", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaColSpan() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaColSpan' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-colspan"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaColSpan(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaColSpan' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaColSpan' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-colspan"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-colspan", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaCurrent() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaCurrent' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-current"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaCurrent(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaCurrent' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaCurrent' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-current"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-current", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaDescription() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaDescription' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-description"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaDescription(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaDescription' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaDescription' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-description"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-description", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaDisabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaDisabled' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-disabled"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaDisabled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaDisabled' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaDisabled' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-disabled"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-disabled", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaExpanded() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaExpanded' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-expanded"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaExpanded(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaExpanded' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaExpanded' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-expanded"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-expanded", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaHasPopup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaHasPopup' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-haspopup"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaHasPopup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaHasPopup' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaHasPopup' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-haspopup"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-haspopup", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaHidden() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaHidden' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-hidden"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaHidden(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaHidden' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaHidden' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-hidden"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-hidden", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaInvalid() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaInvalid' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-invalid"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaInvalid(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaInvalid' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaInvalid' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-invalid"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-invalid", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaKeyShortcuts() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaKeyShortcuts' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-keyshortcuts"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaKeyShortcuts(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaKeyShortcuts' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaKeyShortcuts' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-keyshortcuts"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-keyshortcuts", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaLabel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaLabel' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-label"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaLabel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaLabel' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaLabel' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-label"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-label", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaLevel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaLevel' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-level"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaLevel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaLevel' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaLevel' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-level"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-level", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaLive() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get ariaLive' called on an object that is not a valid instance of Element."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-live"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaLive(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set ariaLive' called on an object that is not a valid instance of Element."); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaLive' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-live"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-live", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaModal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaModal' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-modal"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaModal(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaModal' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaModal' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-modal"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-modal", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaMultiLine() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaMultiLine' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-multiline"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaMultiLine(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaMultiLine' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaMultiLine' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-multiline"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-multiline", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaMultiSelectable() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaMultiSelectable' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-multiselectable"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaMultiSelectable(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaMultiSelectable' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaMultiSelectable' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-multiselectable"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-multiselectable", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaOrientation() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaOrientation' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-orientation"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaOrientation(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaOrientation' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaOrientation' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-orientation"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-orientation", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaPlaceholder() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaPlaceholder' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-placeholder"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaPlaceholder(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaPlaceholder' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaPlaceholder' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-placeholder"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-placeholder", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaPosInSet() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaPosInSet' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-posinset"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaPosInSet(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaPosInSet' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaPosInSet' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-posinset"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-posinset", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaPressed() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaPressed' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-pressed"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaPressed(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaPressed' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaPressed' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-pressed"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-pressed", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaReadOnly() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaReadOnly' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-readonly"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaReadOnly(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaReadOnly' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaReadOnly' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-readonly"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-readonly", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRequired() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRequired' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-required"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRequired(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRequired' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRequired' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-required"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-required", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRoleDescription() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRoleDescription' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-roledescription"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRoleDescription(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRoleDescription' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRoleDescription' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-roledescription"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-roledescription", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRowCount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRowCount' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-rowcount"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRowCount(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRowCount' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRowCount' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-rowcount"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-rowcount", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRowIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRowIndex' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-rowindex"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRowIndex(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRowIndex' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRowIndex' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-rowindex"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-rowindex", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRowIndexText() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRowIndexText' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-rowindextext"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRowIndexText(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRowIndexText' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRowIndexText' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-rowindextext"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-rowindextext", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRowSpan() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRowSpan' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-rowspan"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRowSpan(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRowSpan' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRowSpan' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-rowspan"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-rowspan", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaSelected() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaSelected' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-selected"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaSelected(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaSelected' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaSelected' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-selected"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-selected", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaSetSize() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaSetSize' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-setsize"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaSetSize(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaSetSize' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaSetSize' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-setsize"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-setsize", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaSort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get ariaSort' called on an object that is not a valid instance of Element."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-sort"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaSort(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set ariaSort' called on an object that is not a valid instance of Element."); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaSort' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-sort"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-sort", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaValueMax() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaValueMax' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-valuemax"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaValueMax(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaValueMax' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaValueMax' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-valuemax"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-valuemax", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaValueMin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaValueMin' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-valuemin"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaValueMin(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaValueMin' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaValueMin' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-valuemin"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-valuemin", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaValueNow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaValueNow' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-valuenow"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaValueNow(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaValueNow' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaValueNow' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-valuenow"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-valuenow", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaValueText() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaValueText' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-valuetext"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaValueText(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaValueText' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaValueText' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-valuetext"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-valuetext", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRelevant() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRelevant' called on an object that is not a valid instance of Element." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-relevant"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRelevant(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRelevant' called on an object that is not a valid instance of Element." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRelevant' property on 'Element': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-relevant"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-relevant", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get previousElementSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get previousElementSibling' called on an object that is not a valid instance of Element." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["previousElementSibling"]); - } - - get nextElementSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get nextElementSibling' called on an object that is not a valid instance of Element." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["nextElementSibling"]); - } - - get children() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get children' called on an object that is not a valid instance of Element."); - } - - return utils.getSameObject(this, "children", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["children"]); - }); - } - - get firstElementChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get firstElementChild' called on an object that is not a valid instance of Element." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["firstElementChild"]); - } - - get lastElementChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get lastElementChild' called on an object that is not a valid instance of Element." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["lastElementChild"]); - } - - get childElementCount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get childElementCount' called on an object that is not a valid instance of Element." - ); - } - - return esValue[implSymbol]["childElementCount"]; - } - - get assignedSlot() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get assignedSlot' called on an object that is not a valid instance of Element." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["assignedSlot"]); - } - } - Object.defineProperties(Element.prototype, { - hasAttributes: { enumerable: true }, - getAttributeNames: { enumerable: true }, - getAttribute: { enumerable: true }, - getAttributeNS: { enumerable: true }, - setAttribute: { enumerable: true }, - setAttributeNS: { enumerable: true }, - removeAttribute: { enumerable: true }, - removeAttributeNS: { enumerable: true }, - toggleAttribute: { enumerable: true }, - hasAttribute: { enumerable: true }, - hasAttributeNS: { enumerable: true }, - getAttributeNode: { enumerable: true }, - getAttributeNodeNS: { enumerable: true }, - setAttributeNode: { enumerable: true }, - setAttributeNodeNS: { enumerable: true }, - removeAttributeNode: { enumerable: true }, - attachShadow: { enumerable: true }, - closest: { enumerable: true }, - matches: { enumerable: true }, - webkitMatchesSelector: { enumerable: true }, - getElementsByTagName: { enumerable: true }, - getElementsByTagNameNS: { enumerable: true }, - getElementsByClassName: { enumerable: true }, - insertAdjacentElement: { enumerable: true }, - insertAdjacentText: { enumerable: true }, - insertAdjacentHTML: { enumerable: true }, - getClientRects: { enumerable: true }, - getBoundingClientRect: { enumerable: true }, - before: { enumerable: true }, - after: { enumerable: true }, - replaceWith: { enumerable: true }, - remove: { enumerable: true }, - prepend: { enumerable: true }, - append: { enumerable: true }, - replaceChildren: { enumerable: true }, - querySelector: { enumerable: true }, - querySelectorAll: { enumerable: true }, - namespaceURI: { enumerable: true }, - prefix: { enumerable: true }, - localName: { enumerable: true }, - tagName: { enumerable: true }, - id: { enumerable: true }, - className: { enumerable: true }, - classList: { enumerable: true }, - slot: { enumerable: true }, - attributes: { enumerable: true }, - shadowRoot: { enumerable: true }, - outerHTML: { enumerable: true }, - scrollTop: { enumerable: true }, - scrollLeft: { enumerable: true }, - scrollWidth: { enumerable: true }, - scrollHeight: { enumerable: true }, - clientTop: { enumerable: true }, - clientLeft: { enumerable: true }, - clientWidth: { enumerable: true }, - clientHeight: { enumerable: true }, - innerHTML: { enumerable: true }, - role: { enumerable: true }, - ariaAtomic: { enumerable: true }, - ariaAutoComplete: { enumerable: true }, - ariaBusy: { enumerable: true }, - ariaChecked: { enumerable: true }, - ariaColCount: { enumerable: true }, - ariaColIndex: { enumerable: true }, - ariaColIndexText: { enumerable: true }, - ariaColSpan: { enumerable: true }, - ariaCurrent: { enumerable: true }, - ariaDescription: { enumerable: true }, - ariaDisabled: { enumerable: true }, - ariaExpanded: { enumerable: true }, - ariaHasPopup: { enumerable: true }, - ariaHidden: { enumerable: true }, - ariaInvalid: { enumerable: true }, - ariaKeyShortcuts: { enumerable: true }, - ariaLabel: { enumerable: true }, - ariaLevel: { enumerable: true }, - ariaLive: { enumerable: true }, - ariaModal: { enumerable: true }, - ariaMultiLine: { enumerable: true }, - ariaMultiSelectable: { enumerable: true }, - ariaOrientation: { enumerable: true }, - ariaPlaceholder: { enumerable: true }, - ariaPosInSet: { enumerable: true }, - ariaPressed: { enumerable: true }, - ariaReadOnly: { enumerable: true }, - ariaRequired: { enumerable: true }, - ariaRoleDescription: { enumerable: true }, - ariaRowCount: { enumerable: true }, - ariaRowIndex: { enumerable: true }, - ariaRowIndexText: { enumerable: true }, - ariaRowSpan: { enumerable: true }, - ariaSelected: { enumerable: true }, - ariaSetSize: { enumerable: true }, - ariaSort: { enumerable: true }, - ariaValueMax: { enumerable: true }, - ariaValueMin: { enumerable: true }, - ariaValueNow: { enumerable: true }, - ariaValueText: { enumerable: true }, - ariaRelevant: { enumerable: true }, - previousElementSibling: { enumerable: true }, - nextElementSibling: { enumerable: true }, - children: { enumerable: true }, - firstElementChild: { enumerable: true }, - lastElementChild: { enumerable: true }, - childElementCount: { enumerable: true }, - assignedSlot: { enumerable: true }, - [Symbol.toStringTag]: { value: "Element", configurable: true }, - [Symbol.unscopables]: { - value: { - slot: true, - before: true, - after: true, - replaceWith: true, - remove: true, - prepend: true, - append: true, - replaceChildren: true, - __proto__: null - }, - configurable: true - } - }); - ctorRegistry[interfaceName] = Element; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Element - }); -}; - -const Impl = require("../nodes/Element-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ElementCreationOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ElementCreationOptions.js deleted file mode 100644 index 873b2a7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ElementCreationOptions.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "is"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { context: context + " has member 'is' that", globals: globalObject }); - - ret[key] = value; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ElementDefinitionOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ElementDefinitionOptions.js deleted file mode 100644 index e32d1e8..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ElementDefinitionOptions.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "extends"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { - context: context + " has member 'extends' that", - globals: globalObject - }); - - ret[key] = value; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ElementInternals.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ElementInternals.js deleted file mode 100644 index 7b46393..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ElementInternals.js +++ /dev/null @@ -1,2150 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "ElementInternals"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'ElementInternals'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["ElementInternals"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class ElementInternals { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get shadowRoot() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get shadowRoot' called on an object that is not a valid instance of ElementInternals." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["shadowRoot"]); - } - - get labels() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get labels' called on an object that is not a valid instance of ElementInternals." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]); - } - - get role() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get role' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("role"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set role(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set role' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'role' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("role"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("role", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaAtomic() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaAtomic' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-atomic"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaAtomic(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaAtomic' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaAtomic' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-atomic"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-atomic", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaAutoComplete() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaAutoComplete' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-autocomplete"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaAutoComplete(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaAutoComplete' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaAutoComplete' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-autocomplete"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-autocomplete", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaBusy() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaBusy' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-busy"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaBusy(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaBusy' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaBusy' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-busy"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-busy", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaChecked() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaChecked' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-checked"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaChecked(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaChecked' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaChecked' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-checked"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-checked", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaColCount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaColCount' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-colcount"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaColCount(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaColCount' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaColCount' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-colcount"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-colcount", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaColIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaColIndex' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-colindex"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaColIndex(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaColIndex' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaColIndex' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-colindex"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-colindex", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaColIndexText() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaColIndexText' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-colindextext"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaColIndexText(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaColIndexText' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaColIndexText' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-colindextext"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-colindextext", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaColSpan() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaColSpan' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-colspan"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaColSpan(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaColSpan' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaColSpan' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-colspan"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-colspan", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaCurrent() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaCurrent' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-current"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaCurrent(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaCurrent' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaCurrent' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-current"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-current", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaDescription() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaDescription' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-description"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaDescription(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaDescription' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaDescription' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-description"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-description", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaDisabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaDisabled' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-disabled"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaDisabled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaDisabled' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaDisabled' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-disabled"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-disabled", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaExpanded() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaExpanded' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-expanded"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaExpanded(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaExpanded' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaExpanded' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-expanded"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-expanded", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaHasPopup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaHasPopup' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-haspopup"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaHasPopup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaHasPopup' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaHasPopup' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-haspopup"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-haspopup", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaHidden() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaHidden' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-hidden"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaHidden(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaHidden' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaHidden' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-hidden"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-hidden", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaInvalid() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaInvalid' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-invalid"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaInvalid(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaInvalid' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaInvalid' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-invalid"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-invalid", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaKeyShortcuts() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaKeyShortcuts' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-keyshortcuts"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaKeyShortcuts(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaKeyShortcuts' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaKeyShortcuts' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-keyshortcuts"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-keyshortcuts", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaLabel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaLabel' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-label"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaLabel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaLabel' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaLabel' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-label"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-label", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaLevel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaLevel' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-level"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaLevel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaLevel' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaLevel' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-level"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-level", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaLive() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaLive' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-live"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaLive(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaLive' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaLive' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-live"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-live", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaModal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaModal' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-modal"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaModal(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaModal' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaModal' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-modal"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-modal", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaMultiLine() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaMultiLine' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-multiline"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaMultiLine(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaMultiLine' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaMultiLine' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-multiline"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-multiline", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaMultiSelectable() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaMultiSelectable' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-multiselectable"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaMultiSelectable(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaMultiSelectable' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaMultiSelectable' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-multiselectable"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-multiselectable", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaOrientation() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaOrientation' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-orientation"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaOrientation(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaOrientation' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaOrientation' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-orientation"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-orientation", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaPlaceholder() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaPlaceholder' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-placeholder"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaPlaceholder(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaPlaceholder' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaPlaceholder' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-placeholder"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-placeholder", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaPosInSet() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaPosInSet' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-posinset"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaPosInSet(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaPosInSet' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaPosInSet' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-posinset"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-posinset", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaPressed() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaPressed' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-pressed"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaPressed(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaPressed' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaPressed' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-pressed"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-pressed", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaReadOnly() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaReadOnly' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-readonly"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaReadOnly(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaReadOnly' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaReadOnly' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-readonly"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-readonly", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRequired() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRequired' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-required"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRequired(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRequired' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRequired' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-required"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-required", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRoleDescription() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRoleDescription' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-roledescription"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRoleDescription(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRoleDescription' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRoleDescription' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-roledescription"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-roledescription", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRowCount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRowCount' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-rowcount"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRowCount(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRowCount' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRowCount' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-rowcount"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-rowcount", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRowIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRowIndex' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-rowindex"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRowIndex(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRowIndex' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRowIndex' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-rowindex"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-rowindex", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRowIndexText() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRowIndexText' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-rowindextext"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRowIndexText(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRowIndexText' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRowIndexText' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-rowindextext"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-rowindextext", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRowSpan() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRowSpan' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-rowspan"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRowSpan(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRowSpan' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRowSpan' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-rowspan"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-rowspan", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaSelected() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaSelected' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-selected"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaSelected(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaSelected' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaSelected' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-selected"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-selected", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaSetSize() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaSetSize' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-setsize"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaSetSize(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaSetSize' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaSetSize' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-setsize"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-setsize", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaSort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaSort' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-sort"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaSort(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaSort' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaSort' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-sort"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-sort", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaValueMax() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaValueMax' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-valuemax"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaValueMax(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaValueMax' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaValueMax' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-valuemax"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-valuemax", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaValueMin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaValueMin' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-valuemin"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaValueMin(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaValueMin' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaValueMin' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-valuemin"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-valuemin", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaValueNow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaValueNow' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-valuenow"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaValueNow(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaValueNow' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaValueNow' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-valuenow"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-valuenow", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaValueText() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaValueText' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-valuetext"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaValueText(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaValueText' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaValueText' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-valuetext"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-valuetext", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ariaRelevant() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ariaRelevant' called on an object that is not a valid instance of ElementInternals." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("aria-relevant"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ariaRelevant(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ariaRelevant' called on an object that is not a valid instance of ElementInternals." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'ariaRelevant' property on 'ElementInternals': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("aria-relevant"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("aria-relevant", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(ElementInternals.prototype, { - shadowRoot: { enumerable: true }, - labels: { enumerable: true }, - role: { enumerable: true }, - ariaAtomic: { enumerable: true }, - ariaAutoComplete: { enumerable: true }, - ariaBusy: { enumerable: true }, - ariaChecked: { enumerable: true }, - ariaColCount: { enumerable: true }, - ariaColIndex: { enumerable: true }, - ariaColIndexText: { enumerable: true }, - ariaColSpan: { enumerable: true }, - ariaCurrent: { enumerable: true }, - ariaDescription: { enumerable: true }, - ariaDisabled: { enumerable: true }, - ariaExpanded: { enumerable: true }, - ariaHasPopup: { enumerable: true }, - ariaHidden: { enumerable: true }, - ariaInvalid: { enumerable: true }, - ariaKeyShortcuts: { enumerable: true }, - ariaLabel: { enumerable: true }, - ariaLevel: { enumerable: true }, - ariaLive: { enumerable: true }, - ariaModal: { enumerable: true }, - ariaMultiLine: { enumerable: true }, - ariaMultiSelectable: { enumerable: true }, - ariaOrientation: { enumerable: true }, - ariaPlaceholder: { enumerable: true }, - ariaPosInSet: { enumerable: true }, - ariaPressed: { enumerable: true }, - ariaReadOnly: { enumerable: true }, - ariaRequired: { enumerable: true }, - ariaRoleDescription: { enumerable: true }, - ariaRowCount: { enumerable: true }, - ariaRowIndex: { enumerable: true }, - ariaRowIndexText: { enumerable: true }, - ariaRowSpan: { enumerable: true }, - ariaSelected: { enumerable: true }, - ariaSetSize: { enumerable: true }, - ariaSort: { enumerable: true }, - ariaValueMax: { enumerable: true }, - ariaValueMin: { enumerable: true }, - ariaValueNow: { enumerable: true }, - ariaValueText: { enumerable: true }, - ariaRelevant: { enumerable: true }, - [Symbol.toStringTag]: { value: "ElementInternals", configurable: true } - }); - ctorRegistry[interfaceName] = ElementInternals; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: ElementInternals - }); -}; - -const Impl = require("../custom-elements/ElementInternals-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EndingType.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EndingType.js deleted file mode 100644 index 05128c2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EndingType.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["transparent", "native"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for EndingType`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ErrorEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ErrorEvent.js deleted file mode 100644 index a264b3c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ErrorEvent.js +++ /dev/null @@ -1,192 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ErrorEventInit = require("./ErrorEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "ErrorEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'ErrorEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["ErrorEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class ErrorEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'ErrorEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'ErrorEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = ErrorEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'ErrorEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get message() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get message' called on an object that is not a valid instance of ErrorEvent." - ); - } - - return esValue[implSymbol]["message"]; - } - - get filename() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get filename' called on an object that is not a valid instance of ErrorEvent." - ); - } - - return esValue[implSymbol]["filename"]; - } - - get lineno() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get lineno' called on an object that is not a valid instance of ErrorEvent." - ); - } - - return esValue[implSymbol]["lineno"]; - } - - get colno() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get colno' called on an object that is not a valid instance of ErrorEvent."); - } - - return esValue[implSymbol]["colno"]; - } - - get error() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get error' called on an object that is not a valid instance of ErrorEvent."); - } - - return esValue[implSymbol]["error"]; - } - } - Object.defineProperties(ErrorEvent.prototype, { - message: { enumerable: true }, - filename: { enumerable: true }, - lineno: { enumerable: true }, - colno: { enumerable: true }, - error: { enumerable: true }, - [Symbol.toStringTag]: { value: "ErrorEvent", configurable: true } - }); - ctorRegistry[interfaceName] = ErrorEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: ErrorEvent - }); -}; - -const Impl = require("../events/ErrorEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ErrorEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ErrorEventInit.js deleted file mode 100644 index e615f5a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ErrorEventInit.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "colno"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long"](value, { - context: context + " has member 'colno' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "error"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["any"](value, { context: context + " has member 'error' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "filename"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["USVString"](value, { - context: context + " has member 'filename' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "lineno"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long"](value, { - context: context + " has member 'lineno' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "message"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { - context: context + " has member 'message' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Event.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Event.js deleted file mode 100644 index c8239c3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Event.js +++ /dev/null @@ -1,430 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Event"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Event'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Event"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -function getUnforgeables(globalObject) { - let unforgeables = unforgeablesMap.get(globalObject); - if (unforgeables === undefined) { - unforgeables = Object.create(null); - utils.define(unforgeables, { - get isTrusted() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get isTrusted' called on an object that is not a valid instance of Event." - ); - } - - return esValue[implSymbol]["isTrusted"]; - } - }); - Object.defineProperties(unforgeables, { - isTrusted: { configurable: false } - }); - unforgeablesMap.set(globalObject, unforgeables); - } - return unforgeables; -} - -exports._internalSetup = (wrapper, globalObject) => { - utils.define(wrapper, getUnforgeables(globalObject)); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const unforgeablesMap = new WeakMap(); -const exposed = new Set(["Window", "Worker", "AudioWorklet"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'Event': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'Event': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = EventInit.convert(globalObject, curArg, { context: "Failed to construct 'Event': parameter 2" }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - composedPath() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'composedPath' called on an object that is not a valid instance of Event."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].composedPath()); - } - - stopPropagation() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'stopPropagation' called on an object that is not a valid instance of Event." - ); - } - - return esValue[implSymbol].stopPropagation(); - } - - stopImmediatePropagation() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'stopImmediatePropagation' called on an object that is not a valid instance of Event." - ); - } - - return esValue[implSymbol].stopImmediatePropagation(); - } - - preventDefault() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'preventDefault' called on an object that is not a valid instance of Event."); - } - - return esValue[implSymbol].preventDefault(); - } - - initEvent(type) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'initEvent' called on an object that is not a valid instance of Event."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'initEvent' on 'Event': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initEvent' on 'Event': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initEvent' on 'Event': parameter 2", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initEvent' on 'Event': parameter 3", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - return esValue[implSymbol].initEvent(...args); - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get type' called on an object that is not a valid instance of Event."); - } - - return esValue[implSymbol]["type"]; - } - - get target() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get target' called on an object that is not a valid instance of Event."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["target"]); - } - - get srcElement() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get srcElement' called on an object that is not a valid instance of Event."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["srcElement"]); - } - - get currentTarget() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get currentTarget' called on an object that is not a valid instance of Event." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["currentTarget"]); - } - - get eventPhase() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get eventPhase' called on an object that is not a valid instance of Event."); - } - - return esValue[implSymbol]["eventPhase"]; - } - - get cancelBubble() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cancelBubble' called on an object that is not a valid instance of Event." - ); - } - - return esValue[implSymbol]["cancelBubble"]; - } - - set cancelBubble(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set cancelBubble' called on an object that is not a valid instance of Event." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'cancelBubble' property on 'Event': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["cancelBubble"] = V; - } - - get bubbles() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get bubbles' called on an object that is not a valid instance of Event."); - } - - return esValue[implSymbol]["bubbles"]; - } - - get cancelable() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get cancelable' called on an object that is not a valid instance of Event."); - } - - return esValue[implSymbol]["cancelable"]; - } - - get returnValue() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get returnValue' called on an object that is not a valid instance of Event." - ); - } - - return esValue[implSymbol]["returnValue"]; - } - - set returnValue(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set returnValue' called on an object that is not a valid instance of Event." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'returnValue' property on 'Event': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["returnValue"] = V; - } - - get defaultPrevented() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defaultPrevented' called on an object that is not a valid instance of Event." - ); - } - - return esValue[implSymbol]["defaultPrevented"]; - } - - get composed() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get composed' called on an object that is not a valid instance of Event."); - } - - return esValue[implSymbol]["composed"]; - } - - get timeStamp() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get timeStamp' called on an object that is not a valid instance of Event."); - } - - return esValue[implSymbol]["timeStamp"]; - } - } - Object.defineProperties(Event.prototype, { - composedPath: { enumerable: true }, - stopPropagation: { enumerable: true }, - stopImmediatePropagation: { enumerable: true }, - preventDefault: { enumerable: true }, - initEvent: { enumerable: true }, - type: { enumerable: true }, - target: { enumerable: true }, - srcElement: { enumerable: true }, - currentTarget: { enumerable: true }, - eventPhase: { enumerable: true }, - cancelBubble: { enumerable: true }, - bubbles: { enumerable: true }, - cancelable: { enumerable: true }, - returnValue: { enumerable: true }, - defaultPrevented: { enumerable: true }, - composed: { enumerable: true }, - timeStamp: { enumerable: true }, - [Symbol.toStringTag]: { value: "Event", configurable: true }, - NONE: { value: 0, enumerable: true }, - CAPTURING_PHASE: { value: 1, enumerable: true }, - AT_TARGET: { value: 2, enumerable: true }, - BUBBLING_PHASE: { value: 3, enumerable: true } - }); - Object.defineProperties(Event, { - NONE: { value: 0, enumerable: true }, - CAPTURING_PHASE: { value: 1, enumerable: true }, - AT_TARGET: { value: 2, enumerable: true }, - BUBBLING_PHASE: { value: 3, enumerable: true } - }); - ctorRegistry[interfaceName] = Event; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Event - }); -}; - -const Impl = require("../events/Event-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventHandlerNonNull.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventHandlerNonNull.js deleted file mode 100644 index a8fc666..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventHandlerNonNull.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - function invokeTheCallbackFunction(event) { - const thisArg = utils.tryWrapperForImpl(this); - let callResult; - - if (typeof value === "function") { - event = utils.tryWrapperForImpl(event); - - callResult = Reflect.apply(value, thisArg, [event]); - } - - callResult = conversions["any"](callResult, { context: context, globals: globalObject }); - - return callResult; - } - - invokeTheCallbackFunction.construct = event => { - event = utils.tryWrapperForImpl(event); - - let callResult = Reflect.construct(value, [event]); - - callResult = conversions["any"](callResult, { context: context, globals: globalObject }); - - return callResult; - }; - - invokeTheCallbackFunction[utils.wrapperSymbol] = value; - invokeTheCallbackFunction.objectReference = value; - - return invokeTheCallbackFunction; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventInit.js deleted file mode 100644 index b0bdcbc..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventInit.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "bubbles"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'bubbles' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "cancelable"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'cancelable' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "composed"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'composed' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventListener.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventListener.js deleted file mode 100644 index d747736..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventListener.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (!utils.isObject(value)) { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - function callTheUserObjectsOperation(event) { - let thisArg = utils.tryWrapperForImpl(this); - let O = value; - let X = O; - - if (typeof O !== "function") { - X = O["handleEvent"]; - if (typeof X !== "function") { - throw new globalObject.TypeError(`${context} does not correctly implement EventListener.`); - } - thisArg = O; - } - - event = utils.tryWrapperForImpl(event); - - let callResult = Reflect.apply(X, thisArg, [event]); - } - - callTheUserObjectsOperation[utils.wrapperSymbol] = value; - callTheUserObjectsOperation.objectReference = value; - - return callTheUserObjectsOperation; -}; - -exports.install = (globalObject, globalNames) => {}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventListenerOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventListenerOptions.js deleted file mode 100644 index 49e4686..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventListenerOptions.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "capture"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'capture' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventModifierInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventModifierInit.js deleted file mode 100644 index 227250b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventModifierInit.js +++ /dev/null @@ -1,221 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const UIEventInit = require("./UIEventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - UIEventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "altKey"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'altKey' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "ctrlKey"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'ctrlKey' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "metaKey"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'metaKey' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierAltGraph"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierAltGraph' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierCapsLock"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierCapsLock' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierFn"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierFn' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierFnLock"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierFnLock' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierHyper"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierHyper' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierNumLock"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierNumLock' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierScrollLock"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierScrollLock' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierSuper"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierSuper' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierSymbol"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierSymbol' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "modifierSymbolLock"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'modifierSymbolLock' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "shiftKey"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'shiftKey' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js deleted file mode 100644 index d9eca4d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js +++ /dev/null @@ -1,259 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventListener = require("./EventListener.js"); -const AddEventListenerOptions = require("./AddEventListenerOptions.js"); -const EventListenerOptions = require("./EventListenerOptions.js"); -const Event = require("./Event.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "EventTarget"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'EventTarget'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["EventTarget"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker", "AudioWorklet"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class EventTarget { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - addEventListener(type, callback) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'addEventListener' called on an object that is not a valid instance of EventTarget." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'addEventListener' on 'EventTarget': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = EventListener.convert(globalObject, curArg, { - context: "Failed to execute 'addEventListener' on 'EventTarget': parameter 2" - }); - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = AddEventListenerOptions.convert(globalObject, curArg, { - context: "Failed to execute 'addEventListener' on 'EventTarget': parameter 3" - }); - } else if (utils.isObject(curArg)) { - curArg = AddEventListenerOptions.convert(globalObject, curArg, { - context: "Failed to execute 'addEventListener' on 'EventTarget': parameter 3" + " dictionary" - }); - } else if (typeof curArg === "boolean") { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'addEventListener' on 'EventTarget': parameter 3", - globals: globalObject - }); - } else { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'addEventListener' on 'EventTarget': parameter 3", - globals: globalObject - }); - } - } - args.push(curArg); - } - return esValue[implSymbol].addEventListener(...args); - } - - removeEventListener(type, callback) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'removeEventListener' called on an object that is not a valid instance of EventTarget." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'removeEventListener' on 'EventTarget': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'removeEventListener' on 'EventTarget': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = EventListener.convert(globalObject, curArg, { - context: "Failed to execute 'removeEventListener' on 'EventTarget': parameter 2" - }); - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = EventListenerOptions.convert(globalObject, curArg, { - context: "Failed to execute 'removeEventListener' on 'EventTarget': parameter 3" - }); - } else if (utils.isObject(curArg)) { - curArg = EventListenerOptions.convert(globalObject, curArg, { - context: "Failed to execute 'removeEventListener' on 'EventTarget': parameter 3" + " dictionary" - }); - } else if (typeof curArg === "boolean") { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'removeEventListener' on 'EventTarget': parameter 3", - globals: globalObject - }); - } else { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'removeEventListener' on 'EventTarget': parameter 3", - globals: globalObject - }); - } - } - args.push(curArg); - } - return esValue[implSymbol].removeEventListener(...args); - } - - dispatchEvent(event) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'dispatchEvent' called on an object that is not a valid instance of EventTarget." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'dispatchEvent' on 'EventTarget': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Event.convert(globalObject, curArg, { - context: "Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].dispatchEvent(...args); - } - } - Object.defineProperties(EventTarget.prototype, { - addEventListener: { enumerable: true }, - removeEventListener: { enumerable: true }, - dispatchEvent: { enumerable: true }, - [Symbol.toStringTag]: { value: "EventTarget", configurable: true } - }); - ctorRegistry[interfaceName] = EventTarget; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: EventTarget - }); -}; - -const Impl = require("../events/EventTarget-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/External.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/External.js deleted file mode 100644 index 37d450b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/External.js +++ /dev/null @@ -1,130 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "External"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'External'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["External"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class External { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - AddSearchProvider() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'AddSearchProvider' called on an object that is not a valid instance of External." - ); - } - - return esValue[implSymbol].AddSearchProvider(); - } - - IsSearchProviderInstalled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'IsSearchProviderInstalled' called on an object that is not a valid instance of External." - ); - } - - return esValue[implSymbol].IsSearchProviderInstalled(); - } - } - Object.defineProperties(External.prototype, { - AddSearchProvider: { enumerable: true }, - IsSearchProviderInstalled: { enumerable: true }, - [Symbol.toStringTag]: { value: "External", configurable: true } - }); - ctorRegistry[interfaceName] = External; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: External - }); -}; - -const Impl = require("../window/External-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/File.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/File.js deleted file mode 100644 index 734c25a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/File.js +++ /dev/null @@ -1,185 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Blob = require("./Blob.js"); -const FilePropertyBag = require("./FilePropertyBag.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "File"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'File'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["File"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Blob._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class File extends globalObject.Blob { - constructor(fileBits, fileName) { - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (!utils.isObject(curArg)) { - throw new globalObject.TypeError("Failed to construct 'File': parameter 1" + " is not an iterable object."); - } else { - const V = []; - const tmp = curArg; - for (let nextItem of tmp) { - if (Blob.is(nextItem)) { - nextItem = utils.implForWrapper(nextItem); - } else if (utils.isArrayBuffer(nextItem)) { - nextItem = conversions["ArrayBuffer"](nextItem, { - context: "Failed to construct 'File': parameter 1" + "'s element", - globals: globalObject - }); - } else if (ArrayBuffer.isView(nextItem)) { - nextItem = conversions["ArrayBufferView"](nextItem, { - context: "Failed to construct 'File': parameter 1" + "'s element", - globals: globalObject - }); - } else { - nextItem = conversions["USVString"](nextItem, { - context: "Failed to construct 'File': parameter 1" + "'s element", - globals: globalObject - }); - } - V.push(nextItem); - } - curArg = V; - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["USVString"](curArg, { - context: "Failed to construct 'File': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = FilePropertyBag.convert(globalObject, curArg, { context: "Failed to construct 'File': parameter 3" }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get name' called on an object that is not a valid instance of File."); - } - - return esValue[implSymbol]["name"]; - } - - get lastModified() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get lastModified' called on an object that is not a valid instance of File." - ); - } - - return esValue[implSymbol]["lastModified"]; - } - } - Object.defineProperties(File.prototype, { - name: { enumerable: true }, - lastModified: { enumerable: true }, - [Symbol.toStringTag]: { value: "File", configurable: true } - }); - ctorRegistry[interfaceName] = File; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: File - }); -}; - -const Impl = require("../file-api/File-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FileList.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FileList.js deleted file mode 100644 index d79702b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FileList.js +++ /dev/null @@ -1,298 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "FileList"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'FileList'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["FileList"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class FileList { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'item' called on an object that is not a valid instance of FileList."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'FileList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'FileList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get length' called on an object that is not a valid instance of FileList."); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(FileList.prototype, { - item: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "FileList", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = FileList; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: FileList - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../file-api/FileList-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FilePropertyBag.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FilePropertyBag.js deleted file mode 100644 index 42e0cc6..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FilePropertyBag.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const BlobPropertyBag = require("./BlobPropertyBag.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - BlobPropertyBag._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "lastModified"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long long"](value, { - context: context + " has member 'lastModified' that", - globals: globalObject - }); - - ret[key] = value; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FileReader.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FileReader.js deleted file mode 100644 index b8986be..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FileReader.js +++ /dev/null @@ -1,468 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Blob = require("./Blob.js"); -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const EventTarget = require("./EventTarget.js"); - -const interfaceName = "FileReader"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'FileReader'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["FileReader"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - EventTarget._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class FileReader extends globalObject.EventTarget { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - readAsArrayBuffer(blob) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'readAsArrayBuffer' called on an object that is not a valid instance of FileReader." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'readAsArrayBuffer' on 'FileReader': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Blob.convert(globalObject, curArg, { - context: "Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].readAsArrayBuffer(...args); - } - - readAsBinaryString(blob) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'readAsBinaryString' called on an object that is not a valid instance of FileReader." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'readAsBinaryString' on 'FileReader': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Blob.convert(globalObject, curArg, { - context: "Failed to execute 'readAsBinaryString' on 'FileReader': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].readAsBinaryString(...args); - } - - readAsText(blob) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'readAsText' called on an object that is not a valid instance of FileReader." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'readAsText' on 'FileReader': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Blob.convert(globalObject, curArg, { - context: "Failed to execute 'readAsText' on 'FileReader': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'readAsText' on 'FileReader': parameter 2", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].readAsText(...args); - } - - readAsDataURL(blob) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'readAsDataURL' called on an object that is not a valid instance of FileReader." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'readAsDataURL' on 'FileReader': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Blob.convert(globalObject, curArg, { - context: "Failed to execute 'readAsDataURL' on 'FileReader': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].readAsDataURL(...args); - } - - abort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'abort' called on an object that is not a valid instance of FileReader."); - } - - return esValue[implSymbol].abort(); - } - - get readyState() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get readyState' called on an object that is not a valid instance of FileReader." - ); - } - - return esValue[implSymbol]["readyState"]; - } - - get result() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get result' called on an object that is not a valid instance of FileReader." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["result"]); - } - - get error() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get error' called on an object that is not a valid instance of FileReader."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["error"]); - } - - get onloadstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadstart' called on an object that is not a valid instance of FileReader." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadstart"]); - } - - set onloadstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadstart' called on an object that is not a valid instance of FileReader." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadstart' property on 'FileReader': The provided value" - }); - } - esValue[implSymbol]["onloadstart"] = V; - } - - get onprogress() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onprogress' called on an object that is not a valid instance of FileReader." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onprogress"]); - } - - set onprogress(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onprogress' called on an object that is not a valid instance of FileReader." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onprogress' property on 'FileReader': The provided value" - }); - } - esValue[implSymbol]["onprogress"] = V; - } - - get onload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onload' called on an object that is not a valid instance of FileReader." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onload"]); - } - - set onload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onload' called on an object that is not a valid instance of FileReader." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onload' property on 'FileReader': The provided value" - }); - } - esValue[implSymbol]["onload"] = V; - } - - get onabort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onabort' called on an object that is not a valid instance of FileReader." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onabort"]); - } - - set onabort(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onabort' called on an object that is not a valid instance of FileReader." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onabort' property on 'FileReader': The provided value" - }); - } - esValue[implSymbol]["onabort"] = V; - } - - get onerror() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onerror' called on an object that is not a valid instance of FileReader." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onerror"]); - } - - set onerror(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onerror' called on an object that is not a valid instance of FileReader." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onerror' property on 'FileReader': The provided value" - }); - } - esValue[implSymbol]["onerror"] = V; - } - - get onloadend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadend' called on an object that is not a valid instance of FileReader." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadend"]); - } - - set onloadend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadend' called on an object that is not a valid instance of FileReader." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadend' property on 'FileReader': The provided value" - }); - } - esValue[implSymbol]["onloadend"] = V; - } - } - Object.defineProperties(FileReader.prototype, { - readAsArrayBuffer: { enumerable: true }, - readAsBinaryString: { enumerable: true }, - readAsText: { enumerable: true }, - readAsDataURL: { enumerable: true }, - abort: { enumerable: true }, - readyState: { enumerable: true }, - result: { enumerable: true }, - error: { enumerable: true }, - onloadstart: { enumerable: true }, - onprogress: { enumerable: true }, - onload: { enumerable: true }, - onabort: { enumerable: true }, - onerror: { enumerable: true }, - onloadend: { enumerable: true }, - [Symbol.toStringTag]: { value: "FileReader", configurable: true }, - EMPTY: { value: 0, enumerable: true }, - LOADING: { value: 1, enumerable: true }, - DONE: { value: 2, enumerable: true } - }); - Object.defineProperties(FileReader, { - EMPTY: { value: 0, enumerable: true }, - LOADING: { value: 1, enumerable: true }, - DONE: { value: 2, enumerable: true } - }); - ctorRegistry[interfaceName] = FileReader; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: FileReader - }); -}; - -const Impl = require("../file-api/FileReader-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FocusEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FocusEvent.js deleted file mode 100644 index 7f2efa2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FocusEvent.js +++ /dev/null @@ -1,144 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const FocusEventInit = require("./FocusEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const UIEvent = require("./UIEvent.js"); - -const interfaceName = "FocusEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'FocusEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["FocusEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - UIEvent._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class FocusEvent extends globalObject.UIEvent { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'FocusEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'FocusEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = FocusEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'FocusEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get relatedTarget() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get relatedTarget' called on an object that is not a valid instance of FocusEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["relatedTarget"]); - } - } - Object.defineProperties(FocusEvent.prototype, { - relatedTarget: { enumerable: true }, - [Symbol.toStringTag]: { value: "FocusEvent", configurable: true } - }); - ctorRegistry[interfaceName] = FocusEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: FocusEvent - }); -}; - -const Impl = require("../events/FocusEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FocusEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FocusEventInit.js deleted file mode 100644 index 9fcc3d4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FocusEventInit.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventTarget = require("./EventTarget.js"); -const UIEventInit = require("./UIEventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - UIEventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "relatedTarget"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = EventTarget.convert(globalObject, value, { context: context + " has member 'relatedTarget' that" }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FormData.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FormData.js deleted file mode 100644 index 97524f5..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/FormData.js +++ /dev/null @@ -1,468 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLFormElement = require("./HTMLFormElement.js"); -const HTMLElement = require("./HTMLElement.js"); -const Blob = require("./Blob.js"); -const Function = require("./Function.js"); -const newObjectInRealm = utils.newObjectInRealm; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "FormData"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'FormData'.`); -}; - -exports.createDefaultIterator = (globalObject, target, kind) => { - const ctorRegistry = globalObject[ctorRegistrySymbol]; - const iteratorPrototype = ctorRegistry["FormData Iterator"]; - const iterator = Object.create(iteratorPrototype); - Object.defineProperty(iterator, utils.iterInternalSymbol, { - value: { target, kind, index: 0 }, - configurable: true - }); - return iterator; -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["FormData"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class FormData { - constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = HTMLFormElement.convert(globalObject, curArg, { - context: "Failed to construct 'FormData': parameter 1" - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = HTMLElement.convert(globalObject, curArg, { - context: "Failed to construct 'FormData': parameter 2" - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - append(name, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'append' called on an object that is not a valid instance of FormData."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'append' on 'FormData': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - switch (arguments.length) { - case 2: - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'append' on 'FormData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (Blob.is(curArg)) { - { - let curArg = arguments[1]; - curArg = Blob.convert(globalObject, curArg, { - context: "Failed to execute 'append' on 'FormData': parameter 2" - }); - args.push(curArg); - } - } else { - { - let curArg = arguments[1]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'append' on 'FormData': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - } - } - break; - default: - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'append' on 'FormData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = Blob.convert(globalObject, curArg, { - context: "Failed to execute 'append' on 'FormData': parameter 2" - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'append' on 'FormData': parameter 3", - globals: globalObject - }); - } - args.push(curArg); - } - } - return esValue[implSymbol].append(...args); - } - - delete(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'delete' called on an object that is not a valid instance of FormData."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'delete' on 'FormData': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'delete' on 'FormData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].delete(...args); - } - - get(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get' called on an object that is not a valid instance of FormData."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'get' on 'FormData': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'get' on 'FormData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].get(...args)); - } - - getAll(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'getAll' called on an object that is not a valid instance of FormData."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getAll' on 'FormData': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'getAll' on 'FormData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getAll(...args)); - } - - has(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'has' called on an object that is not a valid instance of FormData."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'has' on 'FormData': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'has' on 'FormData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].has(...args); - } - - set(name, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set' called on an object that is not a valid instance of FormData."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'set' on 'FormData': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - switch (arguments.length) { - case 2: - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'set' on 'FormData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (Blob.is(curArg)) { - { - let curArg = arguments[1]; - curArg = Blob.convert(globalObject, curArg, { - context: "Failed to execute 'set' on 'FormData': parameter 2" - }); - args.push(curArg); - } - } else { - { - let curArg = arguments[1]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'set' on 'FormData': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - } - } - break; - default: - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'set' on 'FormData': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = Blob.convert(globalObject, curArg, { - context: "Failed to execute 'set' on 'FormData': parameter 2" - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'set' on 'FormData': parameter 3", - globals: globalObject - }); - } - args.push(curArg); - } - } - return esValue[implSymbol].set(...args); - } - - keys() { - if (!exports.is(this)) { - throw new globalObject.TypeError("'keys' called on an object that is not a valid instance of FormData."); - } - return exports.createDefaultIterator(globalObject, this, "key"); - } - - values() { - if (!exports.is(this)) { - throw new globalObject.TypeError("'values' called on an object that is not a valid instance of FormData."); - } - return exports.createDefaultIterator(globalObject, this, "value"); - } - - entries() { - if (!exports.is(this)) { - throw new globalObject.TypeError("'entries' called on an object that is not a valid instance of FormData."); - } - return exports.createDefaultIterator(globalObject, this, "key+value"); - } - - forEach(callback) { - if (!exports.is(this)) { - throw new globalObject.TypeError("'forEach' called on an object that is not a valid instance of FormData."); - } - if (arguments.length < 1) { - throw new globalObject.TypeError( - "Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present." - ); - } - callback = Function.convert(globalObject, callback, { - context: "Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1" - }); - const thisArg = arguments[1]; - let pairs = Array.from(this[implSymbol]); - let i = 0; - while (i < pairs.length) { - const [key, value] = pairs[i].map(utils.tryWrapperForImpl); - callback.call(thisArg, value, key, this); - pairs = Array.from(this[implSymbol]); - i++; - } - } - } - Object.defineProperties(FormData.prototype, { - append: { enumerable: true }, - delete: { enumerable: true }, - get: { enumerable: true }, - getAll: { enumerable: true }, - has: { enumerable: true }, - set: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true }, - forEach: { enumerable: true }, - [Symbol.toStringTag]: { value: "FormData", configurable: true }, - [Symbol.iterator]: { value: FormData.prototype.entries, configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = FormData; - - ctorRegistry["FormData Iterator"] = Object.create(ctorRegistry["%IteratorPrototype%"], { - [Symbol.toStringTag]: { - configurable: true, - value: "FormData Iterator" - } - }); - utils.define(ctorRegistry["FormData Iterator"], { - next() { - const internal = this && this[utils.iterInternalSymbol]; - if (!internal) { - throw new globalObject.TypeError("next() called on a value that is not a FormData iterator object"); - } - - const { target, kind, index } = internal; - const values = Array.from(target[implSymbol]); - const len = values.length; - if (index >= len) { - return newObjectInRealm(globalObject, { value: undefined, done: true }); - } - - const pair = values[index]; - internal.index = index + 1; - return newObjectInRealm(globalObject, utils.iteratorResult(pair.map(utils.tryWrapperForImpl), kind)); - } - }); - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: FormData - }); -}; - -const Impl = require("../xhr/FormData-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Function.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Function.js deleted file mode 100644 index ea8712f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Function.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (typeof value !== "function") { - throw new globalObject.TypeError(context + " is not a function"); - } - - function invokeTheCallbackFunction(...args) { - const thisArg = utils.tryWrapperForImpl(this); - let callResult; - - for (let i = 0; i < args.length; i++) { - args[i] = utils.tryWrapperForImpl(args[i]); - } - - callResult = Reflect.apply(value, thisArg, args); - - callResult = conversions["any"](callResult, { context: context, globals: globalObject }); - - return callResult; - } - - invokeTheCallbackFunction.construct = (...args) => { - for (let i = 0; i < args.length; i++) { - args[i] = utils.tryWrapperForImpl(args[i]); - } - - let callResult = Reflect.construct(value, args); - - callResult = conversions["any"](callResult, { context: context, globals: globalObject }); - - return callResult; - }; - - invokeTheCallbackFunction[utils.wrapperSymbol] = value; - invokeTheCallbackFunction.objectReference = value; - - return invokeTheCallbackFunction; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/GetRootNodeOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/GetRootNodeOptions.js deleted file mode 100644 index 524a522..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/GetRootNodeOptions.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "composed"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'composed' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLAnchorElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLAnchorElement.js deleted file mode 100644 index fc72b9e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLAnchorElement.js +++ /dev/null @@ -1,1023 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLAnchorElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLAnchorElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLAnchorElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLAnchorElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get target() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get target' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("target"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set target(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set target' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'target' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("target", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get download() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get download' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("download"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set download(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set download' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'download' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("download", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rel' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("rel"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set rel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set rel' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'rel' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("rel", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get relList() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get relList' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - return utils.getSameObject(this, "relList", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["relList"]); - }); - } - - set relList(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set relList' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - const Q = esValue["relList"]; - if (!utils.isObject(Q)) { - throw new globalObject.TypeError("Property 'relList' is not an object"); - } - Reflect.set(Q, "value", V); - } - - get hreflang() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hreflang' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("hreflang"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hreflang(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hreflang' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'hreflang' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("hreflang", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get text() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get text' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["text"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set text(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set text' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'text' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["text"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get coords() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get coords' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("coords"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set coords(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set coords' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'coords' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("coords", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get charset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get charset' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("charset"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set charset(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set charset' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'charset' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("charset", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rev() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rev' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("rev"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set rev(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set rev' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'rev' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("rev", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get shape() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get shape' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("shape"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set shape(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set shape' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'shape' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("shape", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get href() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get href' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["href"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set href(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set href' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'href' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["href"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - toString() { - const esValue = this; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'toString' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["href"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get origin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get origin' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - return esValue[implSymbol]["origin"]; - } - - get protocol() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get protocol' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["protocol"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set protocol(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set protocol' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'protocol' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["protocol"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get username() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get username' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["username"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set username(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set username' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'username' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["username"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get password() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get password' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["password"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set password(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set password' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'password' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["password"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get host() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get host' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["host"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set host(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set host' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'host' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["host"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get hostname() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hostname' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["hostname"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hostname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hostname' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'hostname' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["hostname"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get port() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get port' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["port"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set port(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set port' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'port' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["port"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get pathname() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pathname' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["pathname"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set pathname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set pathname' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'pathname' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["pathname"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get search() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get search' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["search"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set search(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set search' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'search' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["search"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get hash() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hash' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["hash"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hash(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hash' called on an object that is not a valid instance of HTMLAnchorElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'hash' property on 'HTMLAnchorElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["hash"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLAnchorElement.prototype, { - target: { enumerable: true }, - download: { enumerable: true }, - rel: { enumerable: true }, - relList: { enumerable: true }, - hreflang: { enumerable: true }, - type: { enumerable: true }, - text: { enumerable: true }, - coords: { enumerable: true }, - charset: { enumerable: true }, - name: { enumerable: true }, - rev: { enumerable: true }, - shape: { enumerable: true }, - href: { enumerable: true }, - toString: { enumerable: true }, - origin: { enumerable: true }, - protocol: { enumerable: true }, - username: { enumerable: true }, - password: { enumerable: true }, - host: { enumerable: true }, - hostname: { enumerable: true }, - port: { enumerable: true }, - pathname: { enumerable: true }, - search: { enumerable: true }, - hash: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLAnchorElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLAnchorElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLAnchorElement - }); -}; - -const Impl = require("../nodes/HTMLAnchorElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLAreaElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLAreaElement.js deleted file mode 100644 index 8168ba9..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLAreaElement.js +++ /dev/null @@ -1,822 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLAreaElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLAreaElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLAreaElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLAreaElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get alt() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get alt' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("alt"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set alt(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set alt' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'alt' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("alt", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get coords() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get coords' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("coords"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set coords(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set coords' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'coords' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("coords", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get shape() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get shape' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("shape"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set shape(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set shape' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'shape' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("shape", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get target() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get target' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("target"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set target(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set target' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'target' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("target", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rel' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("rel"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set rel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set rel' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'rel' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("rel", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get relList() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get relList' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - return utils.getSameObject(this, "relList", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["relList"]); - }); - } - - set relList(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set relList' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - const Q = esValue["relList"]; - if (!utils.isObject(Q)) { - throw new globalObject.TypeError("Property 'relList' is not an object"); - } - Reflect.set(Q, "value", V); - } - - get noHref() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get noHref' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("nohref") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set noHref(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set noHref' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'noHref' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("nohref", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("nohref"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get href() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get href' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["href"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set href(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set href' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'href' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["href"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - toString() { - const esValue = this; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'toString' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["href"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get origin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get origin' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - return esValue[implSymbol]["origin"]; - } - - get protocol() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get protocol' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["protocol"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set protocol(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set protocol' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'protocol' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["protocol"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get username() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get username' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["username"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set username(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set username' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'username' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["username"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get password() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get password' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["password"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set password(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set password' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'password' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["password"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get host() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get host' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["host"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set host(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set host' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'host' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["host"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get hostname() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hostname' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["hostname"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hostname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hostname' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'hostname' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["hostname"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get port() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get port' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["port"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set port(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set port' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'port' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["port"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get pathname() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pathname' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["pathname"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set pathname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set pathname' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'pathname' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["pathname"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get search() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get search' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["search"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set search(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set search' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'search' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["search"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get hash() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hash' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["hash"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hash(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hash' called on an object that is not a valid instance of HTMLAreaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'hash' property on 'HTMLAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["hash"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLAreaElement.prototype, { - alt: { enumerable: true }, - coords: { enumerable: true }, - shape: { enumerable: true }, - target: { enumerable: true }, - rel: { enumerable: true }, - relList: { enumerable: true }, - noHref: { enumerable: true }, - href: { enumerable: true }, - toString: { enumerable: true }, - origin: { enumerable: true }, - protocol: { enumerable: true }, - username: { enumerable: true }, - password: { enumerable: true }, - host: { enumerable: true }, - hostname: { enumerable: true }, - port: { enumerable: true }, - pathname: { enumerable: true }, - search: { enumerable: true }, - hash: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLAreaElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLAreaElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLAreaElement - }); -}; - -const Impl = require("../nodes/HTMLAreaElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLAudioElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLAudioElement.js deleted file mode 100644 index 501242c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLAudioElement.js +++ /dev/null @@ -1,110 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLMediaElement = require("./HTMLMediaElement.js"); - -const interfaceName = "HTMLAudioElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLAudioElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLAudioElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLMediaElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLAudioElement extends globalObject.HTMLMediaElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - } - Object.defineProperties(HTMLAudioElement.prototype, { - [Symbol.toStringTag]: { value: "HTMLAudioElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLAudioElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLAudioElement - }); -}; - -const Impl = require("../nodes/HTMLAudioElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLBRElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLBRElement.js deleted file mode 100644 index a1675ca..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLBRElement.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLBRElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLBRElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLBRElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLBRElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get clear() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get clear' called on an object that is not a valid instance of HTMLBRElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("clear"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set clear(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set clear' called on an object that is not a valid instance of HTMLBRElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'clear' property on 'HTMLBRElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("clear", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLBRElement.prototype, { - clear: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLBRElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLBRElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLBRElement - }); -}; - -const Impl = require("../nodes/HTMLBRElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLBaseElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLBaseElement.js deleted file mode 100644 index 2cdb490..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLBaseElement.js +++ /dev/null @@ -1,193 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLBaseElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLBaseElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLBaseElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLBaseElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get href() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get href' called on an object that is not a valid instance of HTMLBaseElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["href"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set href(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set href' called on an object that is not a valid instance of HTMLBaseElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'href' property on 'HTMLBaseElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["href"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get target() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get target' called on an object that is not a valid instance of HTMLBaseElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("target"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set target(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set target' called on an object that is not a valid instance of HTMLBaseElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'target' property on 'HTMLBaseElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("target", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLBaseElement.prototype, { - href: { enumerable: true }, - target: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLBaseElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLBaseElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLBaseElement - }); -}; - -const Impl = require("../nodes/HTMLBaseElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLBodyElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLBodyElement.js deleted file mode 100644 index ebb0958..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLBodyElement.js +++ /dev/null @@ -1,877 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const OnBeforeUnloadEventHandlerNonNull = require("./OnBeforeUnloadEventHandlerNonNull.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLBodyElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLBodyElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLBodyElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLBodyElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get text() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get text' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("text"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set text(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set text' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'text' property on 'HTMLBodyElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("text", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get link() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get link' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("link"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set link(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set link' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'link' property on 'HTMLBodyElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("link", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get vLink() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get vLink' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("vlink"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set vLink(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set vLink' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'vLink' property on 'HTMLBodyElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("vlink", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get aLink() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get aLink' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("alink"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set aLink(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set aLink' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'aLink' property on 'HTMLBodyElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("alink", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get bgColor() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get bgColor' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("bgcolor"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set bgColor(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set bgColor' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'bgColor' property on 'HTMLBodyElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("bgcolor", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get background() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get background' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("background"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set background(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set background' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'background' property on 'HTMLBodyElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("background", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get onafterprint() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onafterprint' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onafterprint"]); - } - - set onafterprint(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onafterprint' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onafterprint' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onafterprint"] = V; - } - - get onbeforeprint() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforeprint' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforeprint"]); - } - - set onbeforeprint(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforeprint' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforeprint' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onbeforeprint"] = V; - } - - get onbeforeunload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforeunload' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforeunload"]); - } - - set onbeforeunload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforeunload' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = OnBeforeUnloadEventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforeunload' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onbeforeunload"] = V; - } - - get onhashchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onhashchange' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onhashchange"]); - } - - set onhashchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onhashchange' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onhashchange' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onhashchange"] = V; - } - - get onlanguagechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onlanguagechange' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onlanguagechange"]); - } - - set onlanguagechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onlanguagechange' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onlanguagechange' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onlanguagechange"] = V; - } - - get onmessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmessage' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmessage"]); - } - - set onmessage(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmessage' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmessage' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onmessage"] = V; - } - - get onmessageerror() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmessageerror' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmessageerror"]); - } - - set onmessageerror(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmessageerror' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmessageerror' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onmessageerror"] = V; - } - - get onoffline() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onoffline' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onoffline"]); - } - - set onoffline(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onoffline' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onoffline' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onoffline"] = V; - } - - get ononline() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ononline' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ononline"]); - } - - set ononline(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ononline' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ononline' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["ononline"] = V; - } - - get onpagehide() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpagehide' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpagehide"]); - } - - set onpagehide(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpagehide' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpagehide' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onpagehide"] = V; - } - - get onpageshow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpageshow' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpageshow"]); - } - - set onpageshow(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpageshow' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpageshow' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onpageshow"] = V; - } - - get onpopstate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpopstate' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpopstate"]); - } - - set onpopstate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpopstate' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpopstate' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onpopstate"] = V; - } - - get onrejectionhandled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onrejectionhandled' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onrejectionhandled"]); - } - - set onrejectionhandled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onrejectionhandled' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onrejectionhandled' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onrejectionhandled"] = V; - } - - get onstorage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onstorage' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onstorage"]); - } - - set onstorage(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onstorage' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onstorage' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onstorage"] = V; - } - - get onunhandledrejection() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onunhandledrejection' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onunhandledrejection"]); - } - - set onunhandledrejection(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onunhandledrejection' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onunhandledrejection' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onunhandledrejection"] = V; - } - - get onunload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onunload' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onunload"]); - } - - set onunload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onunload' called on an object that is not a valid instance of HTMLBodyElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onunload' property on 'HTMLBodyElement': The provided value" - }); - } - esValue[implSymbol]["onunload"] = V; - } - } - Object.defineProperties(HTMLBodyElement.prototype, { - text: { enumerable: true }, - link: { enumerable: true }, - vLink: { enumerable: true }, - aLink: { enumerable: true }, - bgColor: { enumerable: true }, - background: { enumerable: true }, - onafterprint: { enumerable: true }, - onbeforeprint: { enumerable: true }, - onbeforeunload: { enumerable: true }, - onhashchange: { enumerable: true }, - onlanguagechange: { enumerable: true }, - onmessage: { enumerable: true }, - onmessageerror: { enumerable: true }, - onoffline: { enumerable: true }, - ononline: { enumerable: true }, - onpagehide: { enumerable: true }, - onpageshow: { enumerable: true }, - onpopstate: { enumerable: true }, - onrejectionhandled: { enumerable: true }, - onstorage: { enumerable: true }, - onunhandledrejection: { enumerable: true }, - onunload: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLBodyElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLBodyElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLBodyElement - }); -}; - -const Impl = require("../nodes/HTMLBodyElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLButtonElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLButtonElement.js deleted file mode 100644 index 5cbb7ee..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLButtonElement.js +++ /dev/null @@ -1,522 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLButtonElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLButtonElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLButtonElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLButtonElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - checkValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'checkValidity' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - return esValue[implSymbol].checkValidity(); - } - - reportValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'reportValidity' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - return esValue[implSymbol].reportValidity(); - } - - setCustomValidity(error) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setCustomValidity' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setCustomValidity' on 'HTMLButtonElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setCustomValidity' on 'HTMLButtonElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setCustomValidity(...args); - } - - get autofocus() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get autofocus' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("autofocus") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set autofocus(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set autofocus' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'autofocus' property on 'HTMLButtonElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("autofocus", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("autofocus"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get disabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get disabled' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("disabled") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set disabled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set disabled' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'disabled' property on 'HTMLButtonElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("disabled", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("disabled"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get formNoValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get formNoValidate' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("formnovalidate") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set formNoValidate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set formNoValidate' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'formNoValidate' property on 'HTMLButtonElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("formnovalidate", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("formnovalidate"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get formTarget() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get formTarget' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("formtarget"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set formTarget(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set formTarget' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'formTarget' property on 'HTMLButtonElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("formtarget", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLButtonElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["type"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLButtonElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["type"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("value"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'HTMLButtonElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("value", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get willValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get willValidate' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - return esValue[implSymbol]["willValidate"]; - } - - get validity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validity' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["validity"]); - } - - get validationMessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validationMessage' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - return esValue[implSymbol]["validationMessage"]; - } - - get labels() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get labels' called on an object that is not a valid instance of HTMLButtonElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]); - } - } - Object.defineProperties(HTMLButtonElement.prototype, { - checkValidity: { enumerable: true }, - reportValidity: { enumerable: true }, - setCustomValidity: { enumerable: true }, - autofocus: { enumerable: true }, - disabled: { enumerable: true }, - form: { enumerable: true }, - formNoValidate: { enumerable: true }, - formTarget: { enumerable: true }, - name: { enumerable: true }, - type: { enumerable: true }, - value: { enumerable: true }, - willValidate: { enumerable: true }, - validity: { enumerable: true }, - validationMessage: { enumerable: true }, - labels: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLButtonElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLButtonElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLButtonElement - }); -}; - -const Impl = require("../nodes/HTMLButtonElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js deleted file mode 100644 index 59ed75e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js +++ /dev/null @@ -1,304 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const BlobCallback = require("./BlobCallback.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLCanvasElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLCanvasElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLCanvasElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLCanvasElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - getContext(contextId) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getContext' called on an object that is not a valid instance of HTMLCanvasElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getContext' on 'HTMLCanvasElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getContext' on 'HTMLCanvasElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - for (let i = 1; i < arguments.length; i++) { - let curArg = arguments[i]; - curArg = conversions["any"](curArg, { - context: "Failed to execute 'getContext' on 'HTMLCanvasElement': parameter " + (i + 1), - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getContext(...args)); - } - - toDataURL() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'toDataURL' called on an object that is not a valid instance of HTMLCanvasElement." - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'toDataURL' on 'HTMLCanvasElement': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["any"](curArg, { - context: "Failed to execute 'toDataURL' on 'HTMLCanvasElement': parameter 2", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].toDataURL(...args); - } - - toBlob(callback) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'toBlob' called on an object that is not a valid instance of HTMLCanvasElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'toBlob' on 'HTMLCanvasElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = BlobCallback.convert(globalObject, curArg, { - context: "Failed to execute 'toBlob' on 'HTMLCanvasElement': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'toBlob' on 'HTMLCanvasElement': parameter 2", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["any"](curArg, { - context: "Failed to execute 'toBlob' on 'HTMLCanvasElement': parameter 3", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].toBlob(...args); - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLCanvasElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["width"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLCanvasElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'width' property on 'HTMLCanvasElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["width"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of HTMLCanvasElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["height"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set height' called on an object that is not a valid instance of HTMLCanvasElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'height' property on 'HTMLCanvasElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["height"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLCanvasElement.prototype, { - getContext: { enumerable: true }, - toDataURL: { enumerable: true }, - toBlob: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLCanvasElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLCanvasElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLCanvasElement - }); -}; - -const Impl = require("../nodes/HTMLCanvasElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLCollection.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLCollection.js deleted file mode 100644 index 724fe7b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLCollection.js +++ /dev/null @@ -1,352 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "HTMLCollection"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLCollection'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLCollection"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLCollection { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'item' called on an object that is not a valid instance of HTMLCollection."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'HTMLCollection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'HTMLCollection': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); - } - - namedItem(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'namedItem' called on an object that is not a valid instance of HTMLCollection." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'namedItem' on 'HTMLCollection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'namedItem' on 'HTMLCollection': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].namedItem(...args)); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of HTMLCollection." - ); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(HTMLCollection.prototype, { - item: { enumerable: true }, - namedItem: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLCollection", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = HTMLCollection; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLCollection - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(`${key}`); - } - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - const namedValue = target[implSymbol].namedItem(P); - - if (namedValue !== null && !(P in target) && !ignoreNamedProps) { - return { - writable: false, - enumerable: false, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - if (!Object.hasOwn(target, P)) { - const creating = !(target[implSymbol].namedItem(P) !== null); - if (!creating) { - return false; - } - } - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - if (target[implSymbol].namedItem(P) !== null && !(P in target)) { - return false; - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../nodes/HTMLCollection-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDListElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDListElement.js deleted file mode 100644 index ac38c04..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDListElement.js +++ /dev/null @@ -1,156 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLDListElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLDListElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLDListElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLDListElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get compact() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get compact' called on an object that is not a valid instance of HTMLDListElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("compact") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set compact(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set compact' called on an object that is not a valid instance of HTMLDListElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'compact' property on 'HTMLDListElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("compact", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("compact"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLDListElement.prototype, { - compact: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLDListElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLDListElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLDListElement - }); -}; - -const Impl = require("../nodes/HTMLDListElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDataElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDataElement.js deleted file mode 100644 index 9efe5b7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDataElement.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLDataElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLDataElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLDataElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLDataElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLDataElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("value"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLDataElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'HTMLDataElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("value", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLDataElement.prototype, { - value: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLDataElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLDataElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLDataElement - }); -}; - -const Impl = require("../nodes/HTMLDataElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDataListElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDataListElement.js deleted file mode 100644 index d65156f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDataListElement.js +++ /dev/null @@ -1,125 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLDataListElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLDataListElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLDataListElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLDataListElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get options() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get options' called on an object that is not a valid instance of HTMLDataListElement." - ); - } - - return utils.getSameObject(this, "options", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["options"]); - }); - } - } - Object.defineProperties(HTMLDataListElement.prototype, { - options: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLDataListElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLDataListElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLDataListElement - }); -}; - -const Impl = require("../nodes/HTMLDataListElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDetailsElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDetailsElement.js deleted file mode 100644 index d15510b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDetailsElement.js +++ /dev/null @@ -1,156 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLDetailsElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLDetailsElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLDetailsElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLDetailsElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get open() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get open' called on an object that is not a valid instance of HTMLDetailsElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("open") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set open(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set open' called on an object that is not a valid instance of HTMLDetailsElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'open' property on 'HTMLDetailsElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("open", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("open"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLDetailsElement.prototype, { - open: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLDetailsElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLDetailsElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLDetailsElement - }); -}; - -const Impl = require("../nodes/HTMLDetailsElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDialogElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDialogElement.js deleted file mode 100644 index 564a670..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDialogElement.js +++ /dev/null @@ -1,156 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLDialogElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLDialogElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLDialogElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLDialogElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get open() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get open' called on an object that is not a valid instance of HTMLDialogElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("open") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set open(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set open' called on an object that is not a valid instance of HTMLDialogElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'open' property on 'HTMLDialogElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("open", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("open"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLDialogElement.prototype, { - open: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLDialogElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLDialogElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLDialogElement - }); -}; - -const Impl = require("../nodes/HTMLDialogElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDirectoryElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDirectoryElement.js deleted file mode 100644 index ffaa2d8..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDirectoryElement.js +++ /dev/null @@ -1,156 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLDirectoryElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLDirectoryElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLDirectoryElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLDirectoryElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get compact() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get compact' called on an object that is not a valid instance of HTMLDirectoryElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("compact") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set compact(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set compact' called on an object that is not a valid instance of HTMLDirectoryElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'compact' property on 'HTMLDirectoryElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("compact", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("compact"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLDirectoryElement.prototype, { - compact: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLDirectoryElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLDirectoryElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLDirectoryElement - }); -}; - -const Impl = require("../nodes/HTMLDirectoryElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDivElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDivElement.js deleted file mode 100644 index ae60542..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLDivElement.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLDivElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLDivElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLDivElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLDivElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLDivElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLDivElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLDivElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLDivElement.prototype, { - align: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLDivElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLDivElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLDivElement - }); -}; - -const Impl = require("../nodes/HTMLDivElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLElement.js deleted file mode 100644 index 2d221cf..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLElement.js +++ /dev/null @@ -1,3489 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const OnErrorEventHandlerNonNull = require("./OnErrorEventHandlerNonNull.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Element = require("./Element.js"); - -const interfaceName = "HTMLElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Element._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLElement extends globalObject.Element { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - click() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'click' called on an object that is not a valid instance of HTMLElement."); - } - - return esValue[implSymbol].click(); - } - - attachInternals() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'attachInternals' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].attachInternals()); - } - - focus() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'focus' called on an object that is not a valid instance of HTMLElement."); - } - - return esValue[implSymbol].focus(); - } - - blur() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'blur' called on an object that is not a valid instance of HTMLElement."); - } - - return esValue[implSymbol].blur(); - } - - get title() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get title' called on an object that is not a valid instance of HTMLElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("title"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set title(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set title' called on an object that is not a valid instance of HTMLElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'title' property on 'HTMLElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("title", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get lang() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get lang' called on an object that is not a valid instance of HTMLElement."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("lang"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set lang(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set lang' called on an object that is not a valid instance of HTMLElement."); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'lang' property on 'HTMLElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("lang", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get translate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get translate' called on an object that is not a valid instance of HTMLElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["translate"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set translate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set translate' called on an object that is not a valid instance of HTMLElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'translate' property on 'HTMLElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["translate"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get dir() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get dir' called on an object that is not a valid instance of HTMLElement."); - } - - 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 globalObject.TypeError("'set dir' called on an object that is not a valid instance of HTMLElement."); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'dir' property on 'HTMLElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["dir"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get hidden() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hidden' called on an object that is not a valid instance of HTMLElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("hidden") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hidden(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hidden' called on an object that is not a valid instance of HTMLElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'hidden' property on 'HTMLElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("hidden", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("hidden"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get accessKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get accessKey' called on an object that is not a valid instance of HTMLElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("accesskey"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set accessKey(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set accessKey' called on an object that is not a valid instance of HTMLElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'accessKey' property on 'HTMLElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("accesskey", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get draggable() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get draggable' called on an object that is not a valid instance of HTMLElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["draggable"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set draggable(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set draggable' called on an object that is not a valid instance of HTMLElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'draggable' property on 'HTMLElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["draggable"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get offsetParent() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get offsetParent' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["offsetParent"]); - } - - get offsetTop() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get offsetTop' called on an object that is not a valid instance of HTMLElement." - ); - } - - return esValue[implSymbol]["offsetTop"]; - } - - get offsetLeft() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get offsetLeft' called on an object that is not a valid instance of HTMLElement." - ); - } - - return esValue[implSymbol]["offsetLeft"]; - } - - get offsetWidth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get offsetWidth' called on an object that is not a valid instance of HTMLElement." - ); - } - - return esValue[implSymbol]["offsetWidth"]; - } - - get offsetHeight() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get offsetHeight' called on an object that is not a valid instance of HTMLElement." - ); - } - - return esValue[implSymbol]["offsetHeight"]; - } - - get style() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get style' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.getSameObject(this, "style", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["style"]); - }); - } - - set style(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set style' called on an object that is not a valid instance of HTMLElement." - ); - } - - const Q = esValue["style"]; - if (!utils.isObject(Q)) { - throw new globalObject.TypeError("Property 'style' is not an object"); - } - Reflect.set(Q, "cssText", V); - } - - get onabort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onabort' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onabort"]); - } - - set onabort(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onabort' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onabort' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onabort"] = V; - } - - get onauxclick() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onauxclick' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onauxclick"]); - } - - set onauxclick(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onauxclick' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onauxclick' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onauxclick"] = V; - } - - get onbeforeinput() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforeinput' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforeinput"]); - } - - set onbeforeinput(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforeinput' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforeinput' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onbeforeinput"] = V; - } - - get onbeforematch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforematch' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforematch"]); - } - - set onbeforematch(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforematch' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforematch' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onbeforematch"] = V; - } - - get onbeforetoggle() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforetoggle' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforetoggle"]); - } - - set onbeforetoggle(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforetoggle' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforetoggle' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onbeforetoggle"] = V; - } - - get onblur() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onblur' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onblur"]); - } - - set onblur(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onblur' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onblur' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onblur"] = V; - } - - get oncancel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncancel' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncancel"]); - } - - set oncancel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncancel' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncancel' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oncancel"] = V; - } - - get oncanplay() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncanplay' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncanplay"]); - } - - set oncanplay(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncanplay' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncanplay' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oncanplay"] = V; - } - - get oncanplaythrough() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncanplaythrough' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncanplaythrough"]); - } - - set oncanplaythrough(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncanplaythrough' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncanplaythrough' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oncanplaythrough"] = V; - } - - get onchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onchange' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onchange"]); - } - - set onchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onchange' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onchange' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onchange"] = V; - } - - get onclick() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onclick' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onclick"]); - } - - set onclick(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onclick' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onclick' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onclick"] = V; - } - - get onclose() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onclose' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onclose"]); - } - - set onclose(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onclose' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onclose' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onclose"] = V; - } - - get oncontextlost() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncontextlost' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextlost"]); - } - - set oncontextlost(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncontextlost' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncontextlost' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oncontextlost"] = V; - } - - get oncontextmenu() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncontextmenu' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextmenu"]); - } - - set oncontextmenu(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncontextmenu' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncontextmenu' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oncontextmenu"] = V; - } - - get oncontextrestored() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncontextrestored' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextrestored"]); - } - - set oncontextrestored(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncontextrestored' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncontextrestored' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oncontextrestored"] = V; - } - - get oncopy() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncopy' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncopy"]); - } - - set oncopy(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncopy' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncopy' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oncopy"] = V; - } - - get oncuechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncuechange' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncuechange"]); - } - - set oncuechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncuechange' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncuechange' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oncuechange"] = V; - } - - get oncut() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncut' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncut"]); - } - - set oncut(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncut' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncut' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oncut"] = V; - } - - get ondblclick() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondblclick' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondblclick"]); - } - - set ondblclick(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondblclick' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondblclick' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ondblclick"] = V; - } - - get ondrag() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondrag' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondrag"]); - } - - set ondrag(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondrag' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondrag' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ondrag"] = V; - } - - get ondragend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragend' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragend"]); - } - - set ondragend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragend' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragend' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ondragend"] = V; - } - - get ondragenter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragenter' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragenter"]); - } - - set ondragenter(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragenter' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragenter' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ondragenter"] = V; - } - - get ondragleave() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragleave' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragleave"]); - } - - set ondragleave(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragleave' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragleave' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ondragleave"] = V; - } - - get ondragover() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragover' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragover"]); - } - - set ondragover(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragover' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragover' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ondragover"] = V; - } - - get ondragstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragstart' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragstart"]); - } - - set ondragstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragstart' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragstart' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ondragstart"] = V; - } - - get ondrop() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondrop' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondrop"]); - } - - set ondrop(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondrop' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondrop' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ondrop"] = V; - } - - get ondurationchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondurationchange' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondurationchange"]); - } - - set ondurationchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondurationchange' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondurationchange' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ondurationchange"] = V; - } - - get onemptied() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onemptied' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onemptied"]); - } - - set onemptied(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onemptied' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onemptied' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onemptied"] = V; - } - - get onended() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onended' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onended"]); - } - - set onended(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onended' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onended' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onended"] = V; - } - - get onerror() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onerror' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onerror"]); - } - - set onerror(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onerror' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = OnErrorEventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onerror' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onerror"] = V; - } - - get onfocus() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onfocus' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onfocus"]); - } - - set onfocus(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onfocus' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onfocus' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onfocus"] = V; - } - - get onformdata() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onformdata' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onformdata"]); - } - - set onformdata(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onformdata' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onformdata' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onformdata"] = V; - } - - get oninput() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oninput' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oninput"]); - } - - set oninput(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oninput' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oninput' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oninput"] = V; - } - - get oninvalid() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oninvalid' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oninvalid"]); - } - - set oninvalid(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oninvalid' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oninvalid' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["oninvalid"] = V; - } - - get onkeydown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onkeydown' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onkeydown"]); - } - - set onkeydown(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onkeydown' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onkeydown' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onkeydown"] = V; - } - - get onkeypress() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onkeypress' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onkeypress"]); - } - - set onkeypress(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onkeypress' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onkeypress' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onkeypress"] = V; - } - - get onkeyup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onkeyup' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onkeyup"]); - } - - set onkeyup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onkeyup' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onkeyup' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onkeyup"] = V; - } - - get onload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onload' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onload"]); - } - - set onload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onload' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onload' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onload"] = V; - } - - get onloadeddata() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadeddata' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadeddata"]); - } - - set onloadeddata(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadeddata' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadeddata' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onloadeddata"] = V; - } - - get onloadedmetadata() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadedmetadata' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadedmetadata"]); - } - - set onloadedmetadata(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadedmetadata' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadedmetadata' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onloadedmetadata"] = V; - } - - get onloadstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadstart' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadstart"]); - } - - set onloadstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadstart' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadstart' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onloadstart"] = V; - } - - get onmousedown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmousedown' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmousedown"]); - } - - set onmousedown(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmousedown' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmousedown' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onmousedown"] = V; - } - - get onmouseenter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseenter"]); - } - - set onmouseenter(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseenter' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onmouseenter"] = V; - } - - get onmouseleave() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseleave"]); - } - - set onmouseleave(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseleave' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onmouseleave"] = V; - } - - get onmousemove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmousemove' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmousemove"]); - } - - set onmousemove(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmousemove' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmousemove' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onmousemove"] = V; - } - - get onmouseout() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmouseout' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseout"]); - } - - set onmouseout(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmouseout' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseout' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onmouseout"] = V; - } - - get onmouseover() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmouseover' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseover"]); - } - - set onmouseover(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmouseover' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseover' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onmouseover"] = V; - } - - get onmouseup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmouseup' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseup"]); - } - - set onmouseup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmouseup' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseup' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onmouseup"] = V; - } - - get onpaste() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpaste' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpaste"]); - } - - set onpaste(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpaste' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpaste' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpaste"] = V; - } - - get onpause() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpause' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpause"]); - } - - set onpause(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpause' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpause' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpause"] = V; - } - - get onplay() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onplay' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onplay"]); - } - - set onplay(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onplay' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onplay' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onplay"] = V; - } - - get onplaying() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onplaying' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onplaying"]); - } - - set onplaying(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onplaying' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onplaying' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onplaying"] = V; - } - - get onprogress() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onprogress' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onprogress"]); - } - - set onprogress(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onprogress' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onprogress' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onprogress"] = V; - } - - get onratechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onratechange' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onratechange"]); - } - - set onratechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onratechange' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onratechange' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onratechange"] = V; - } - - get onreset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onreset' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onreset"]); - } - - set onreset(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onreset' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onreset' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onreset"] = V; - } - - get onresize() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onresize' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onresize"]); - } - - set onresize(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onresize' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onresize' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onresize"] = V; - } - - get onscroll() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onscroll' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onscroll"]); - } - - set onscroll(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onscroll' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onscroll' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onscroll"] = V; - } - - get onscrollend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onscrollend' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onscrollend"]); - } - - set onscrollend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onscrollend' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onscrollend' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onscrollend"] = V; - } - - get onsecuritypolicyviolation() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onsecuritypolicyviolation' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onsecuritypolicyviolation"]); - } - - set onsecuritypolicyviolation(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onsecuritypolicyviolation' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onsecuritypolicyviolation' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onsecuritypolicyviolation"] = V; - } - - get onseeked() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onseeked' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onseeked"]); - } - - set onseeked(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onseeked' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onseeked' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onseeked"] = V; - } - - get onseeking() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onseeking' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onseeking"]); - } - - set onseeking(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onseeking' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onseeking' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onseeking"] = V; - } - - get onselect() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onselect' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onselect"]); - } - - set onselect(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onselect' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onselect' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onselect"] = V; - } - - get onslotchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onslotchange' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onslotchange"]); - } - - set onslotchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onslotchange' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onslotchange' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onslotchange"] = V; - } - - get onstalled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onstalled' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onstalled"]); - } - - set onstalled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onstalled' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onstalled' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onstalled"] = V; - } - - get onsubmit() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onsubmit' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onsubmit"]); - } - - set onsubmit(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onsubmit' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onsubmit' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onsubmit"] = V; - } - - get onsuspend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onsuspend' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onsuspend"]); - } - - set onsuspend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onsuspend' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onsuspend' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onsuspend"] = V; - } - - get ontimeupdate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontimeupdate' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontimeupdate"]); - } - - set ontimeupdate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontimeupdate' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontimeupdate' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ontimeupdate"] = V; - } - - get ontoggle() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontoggle' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontoggle"]); - } - - set ontoggle(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontoggle' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontoggle' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ontoggle"] = V; - } - - get onvolumechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onvolumechange' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onvolumechange"]); - } - - set onvolumechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onvolumechange' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onvolumechange' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onvolumechange"] = V; - } - - get onwaiting() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwaiting' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwaiting"]); - } - - set onwaiting(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwaiting' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwaiting' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onwaiting"] = V; - } - - get onwebkitanimationend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkitanimationend' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkitanimationend"]); - } - - set onwebkitanimationend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkitanimationend' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkitanimationend' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onwebkitanimationend"] = V; - } - - get onwebkitanimationiteration() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkitanimationiteration' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkitanimationiteration"]); - } - - set onwebkitanimationiteration(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkitanimationiteration' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkitanimationiteration' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onwebkitanimationiteration"] = V; - } - - get onwebkitanimationstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkitanimationstart' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkitanimationstart"]); - } - - set onwebkitanimationstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkitanimationstart' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkitanimationstart' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onwebkitanimationstart"] = V; - } - - get onwebkittransitionend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkittransitionend' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkittransitionend"]); - } - - set onwebkittransitionend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkittransitionend' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkittransitionend' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onwebkittransitionend"] = V; - } - - get onwheel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwheel' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwheel"]); - } - - set onwheel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwheel' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwheel' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onwheel"] = V; - } - - get ontouchstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchstart' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchstart"]); - } - - set ontouchstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchstart' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchstart' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ontouchstart"] = V; - } - - get ontouchend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchend' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchend"]); - } - - set ontouchend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchend' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchend' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ontouchend"] = V; - } - - get ontouchmove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchmove' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchmove"]); - } - - set ontouchmove(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchmove' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchmove' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ontouchmove"] = V; - } - - get ontouchcancel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchcancel' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchcancel"]); - } - - set ontouchcancel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchcancel' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchcancel' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ontouchcancel"] = V; - } - - get onpointerover() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerover' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerover"]); - } - - set onpointerover(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerover' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerover' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpointerover"] = V; - } - - get onpointerenter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerenter' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerenter"]); - } - - set onpointerenter(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerenter' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerenter' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpointerenter"] = V; - } - - get onpointerdown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerdown' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerdown"]); - } - - set onpointerdown(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerdown' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerdown' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpointerdown"] = V; - } - - get onpointermove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointermove' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointermove"]); - } - - set onpointermove(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointermove' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointermove' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpointermove"] = V; - } - - get onpointerrawupdate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerrawupdate' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerrawupdate"]); - } - - set onpointerrawupdate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerrawupdate' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerrawupdate' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpointerrawupdate"] = V; - } - - get onpointerup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerup' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerup"]); - } - - set onpointerup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerup' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerup' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpointerup"] = V; - } - - get onpointercancel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointercancel' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointercancel"]); - } - - set onpointercancel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointercancel' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointercancel' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpointercancel"] = V; - } - - get onpointerout() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerout' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerout"]); - } - - set onpointerout(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerout' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerout' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpointerout"] = V; - } - - get onpointerleave() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerleave' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerleave"]); - } - - set onpointerleave(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerleave' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerleave' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onpointerleave"] = V; - } - - get ongotpointercapture() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ongotpointercapture' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ongotpointercapture"]); - } - - set ongotpointercapture(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ongotpointercapture' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ongotpointercapture' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["ongotpointercapture"] = V; - } - - get onlostpointercapture() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onlostpointercapture' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onlostpointercapture"]); - } - - set onlostpointercapture(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onlostpointercapture' called on an object that is not a valid instance of HTMLElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onlostpointercapture' property on 'HTMLElement': The provided value" - }); - } - esValue[implSymbol]["onlostpointercapture"] = V; - } - - get dataset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get dataset' called on an object that is not a valid instance of HTMLElement." - ); - } - - return utils.getSameObject(this, "dataset", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["dataset"]); - }); - } - - get nonce() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get nonce' called on an object that is not a valid instance of HTMLElement." - ); - } - - const value = esValue[implSymbol]._reflectGetTheContentAttribute("nonce"); - return value === null ? "" : value; - } - - set nonce(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set nonce' called on an object that is not a valid instance of HTMLElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'nonce' property on 'HTMLElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]._reflectSetTheContentAttribute("nonce", V); - } - - get tabIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tabIndex' called on an object that is not a valid instance of HTMLElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["tabIndex"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set tabIndex(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set tabIndex' called on an object that is not a valid instance of HTMLElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'tabIndex' property on 'HTMLElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["tabIndex"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLElement.prototype, { - click: { enumerable: true }, - attachInternals: { enumerable: true }, - focus: { enumerable: true }, - blur: { enumerable: true }, - title: { enumerable: true }, - lang: { enumerable: true }, - translate: { enumerable: true }, - dir: { enumerable: true }, - hidden: { enumerable: true }, - accessKey: { enumerable: true }, - draggable: { enumerable: true }, - offsetParent: { enumerable: true }, - offsetTop: { enumerable: true }, - offsetLeft: { enumerable: true }, - offsetWidth: { enumerable: true }, - offsetHeight: { enumerable: true }, - style: { enumerable: true }, - onabort: { enumerable: true }, - onauxclick: { enumerable: true }, - onbeforeinput: { enumerable: true }, - onbeforematch: { enumerable: true }, - onbeforetoggle: { enumerable: true }, - onblur: { enumerable: true }, - oncancel: { enumerable: true }, - oncanplay: { enumerable: true }, - oncanplaythrough: { enumerable: true }, - onchange: { enumerable: true }, - onclick: { enumerable: true }, - onclose: { enumerable: true }, - oncontextlost: { enumerable: true }, - oncontextmenu: { enumerable: true }, - oncontextrestored: { enumerable: true }, - oncopy: { enumerable: true }, - oncuechange: { enumerable: true }, - oncut: { enumerable: true }, - ondblclick: { enumerable: true }, - ondrag: { enumerable: true }, - ondragend: { enumerable: true }, - ondragenter: { enumerable: true }, - ondragleave: { enumerable: true }, - ondragover: { enumerable: true }, - ondragstart: { enumerable: true }, - ondrop: { enumerable: true }, - ondurationchange: { enumerable: true }, - onemptied: { enumerable: true }, - onended: { enumerable: true }, - onerror: { enumerable: true }, - onfocus: { enumerable: true }, - onformdata: { enumerable: true }, - oninput: { enumerable: true }, - oninvalid: { enumerable: true }, - onkeydown: { enumerable: true }, - onkeypress: { enumerable: true }, - onkeyup: { enumerable: true }, - onload: { enumerable: true }, - onloadeddata: { enumerable: true }, - onloadedmetadata: { enumerable: true }, - onloadstart: { enumerable: true }, - onmousedown: { enumerable: true }, - onmouseenter: { enumerable: true }, - onmouseleave: { enumerable: true }, - onmousemove: { enumerable: true }, - onmouseout: { enumerable: true }, - onmouseover: { enumerable: true }, - onmouseup: { enumerable: true }, - onpaste: { enumerable: true }, - onpause: { enumerable: true }, - onplay: { enumerable: true }, - onplaying: { enumerable: true }, - onprogress: { enumerable: true }, - onratechange: { enumerable: true }, - onreset: { enumerable: true }, - onresize: { enumerable: true }, - onscroll: { enumerable: true }, - onscrollend: { enumerable: true }, - onsecuritypolicyviolation: { enumerable: true }, - onseeked: { enumerable: true }, - onseeking: { enumerable: true }, - onselect: { enumerable: true }, - onslotchange: { enumerable: true }, - onstalled: { enumerable: true }, - onsubmit: { enumerable: true }, - onsuspend: { enumerable: true }, - ontimeupdate: { enumerable: true }, - ontoggle: { enumerable: true }, - onvolumechange: { enumerable: true }, - onwaiting: { enumerable: true }, - onwebkitanimationend: { enumerable: true }, - onwebkitanimationiteration: { enumerable: true }, - onwebkitanimationstart: { enumerable: true }, - onwebkittransitionend: { enumerable: true }, - onwheel: { enumerable: true }, - ontouchstart: { enumerable: true }, - ontouchend: { enumerable: true }, - ontouchmove: { enumerable: true }, - ontouchcancel: { enumerable: true }, - onpointerover: { enumerable: true }, - onpointerenter: { enumerable: true }, - onpointerdown: { enumerable: true }, - onpointermove: { enumerable: true }, - onpointerrawupdate: { enumerable: true }, - onpointerup: { enumerable: true }, - onpointercancel: { enumerable: true }, - onpointerout: { enumerable: true }, - onpointerleave: { enumerable: true }, - ongotpointercapture: { enumerable: true }, - onlostpointercapture: { enumerable: true }, - dataset: { enumerable: true }, - nonce: { enumerable: true }, - tabIndex: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLElement - }); -}; - -const Impl = require("../nodes/HTMLElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLEmbedElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLEmbedElement.js deleted file mode 100644 index e6782ed..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLEmbedElement.js +++ /dev/null @@ -1,378 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLEmbedElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLEmbedElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLEmbedElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLEmbedElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get src() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get src' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("src"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._srcURLCache; - } - - this._srcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._srcURLCache = serializeURLwhatwg_url(urlRecord); - return this._srcURLCache; - } - this._srcURLCache = conversions.USVString(value); - return this._srcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set src(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set src' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'src' property on 'HTMLEmbedElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("src", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLEmbedElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'width' property on 'HTMLEmbedElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("width", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("height"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set height' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'height' property on 'HTMLEmbedElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("height", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLEmbedElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLEmbedElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLEmbedElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLEmbedElement.prototype, { - src: { enumerable: true }, - type: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - align: { enumerable: true }, - name: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLEmbedElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLEmbedElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLEmbedElement - }); -}; - -const Impl = require("../nodes/HTMLEmbedElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFieldSetElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFieldSetElement.js deleted file mode 100644 index 03deb52..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFieldSetElement.js +++ /dev/null @@ -1,329 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLFieldSetElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLFieldSetElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLFieldSetElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLFieldSetElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - checkValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'checkValidity' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - return esValue[implSymbol].checkValidity(); - } - - reportValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'reportValidity' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - return esValue[implSymbol].reportValidity(); - } - - setCustomValidity(error) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setCustomValidity' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setCustomValidity' on 'HTMLFieldSetElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setCustomValidity' on 'HTMLFieldSetElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setCustomValidity(...args); - } - - get disabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get disabled' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("disabled") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set disabled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set disabled' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'disabled' property on 'HTMLFieldSetElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("disabled", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("disabled"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLFieldSetElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - return esValue[implSymbol]["type"]; - } - - get elements() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get elements' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - return utils.getSameObject(this, "elements", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["elements"]); - }); - } - - get willValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get willValidate' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - return esValue[implSymbol]["willValidate"]; - } - - get validity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validity' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - return utils.getSameObject(this, "validity", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["validity"]); - }); - } - - get validationMessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validationMessage' called on an object that is not a valid instance of HTMLFieldSetElement." - ); - } - - return esValue[implSymbol]["validationMessage"]; - } - } - Object.defineProperties(HTMLFieldSetElement.prototype, { - checkValidity: { enumerable: true }, - reportValidity: { enumerable: true }, - setCustomValidity: { enumerable: true }, - disabled: { enumerable: true }, - form: { enumerable: true }, - name: { enumerable: true }, - type: { enumerable: true }, - elements: { enumerable: true }, - willValidate: { enumerable: true }, - validity: { enumerable: true }, - validationMessage: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLFieldSetElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLFieldSetElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLFieldSetElement - }); -}; - -const Impl = require("../nodes/HTMLFieldSetElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFontElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFontElement.js deleted file mode 100644 index 0adb620..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFontElement.js +++ /dev/null @@ -1,236 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLFontElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLFontElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLFontElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLFontElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get color() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get color' called on an object that is not a valid instance of HTMLFontElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("color"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set color(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set color' called on an object that is not a valid instance of HTMLFontElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'color' property on 'HTMLFontElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("color", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get face() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get face' called on an object that is not a valid instance of HTMLFontElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("face"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set face(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set face' called on an object that is not a valid instance of HTMLFontElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'face' property on 'HTMLFontElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("face", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get size() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get size' called on an object that is not a valid instance of HTMLFontElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("size"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set size(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set size' called on an object that is not a valid instance of HTMLFontElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'size' property on 'HTMLFontElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("size", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLFontElement.prototype, { - color: { enumerable: true }, - face: { enumerable: true }, - size: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLFontElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLFontElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLFontElement - }); -}; - -const Impl = require("../nodes/HTMLFontElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFormControlsCollection.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFormControlsCollection.js deleted file mode 100644 index bd83242..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFormControlsCollection.js +++ /dev/null @@ -1,318 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLCollection = require("./HTMLCollection.js"); - -const interfaceName = "HTMLFormControlsCollection"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLFormControlsCollection'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLFormControlsCollection"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLCollection._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLFormControlsCollection extends globalObject.HTMLCollection { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - namedItem(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'namedItem' called on an object that is not a valid instance of HTMLFormControlsCollection." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'namedItem' on 'HTMLFormControlsCollection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'namedItem' on 'HTMLFormControlsCollection': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].namedItem(...args)); - } - } - Object.defineProperties(HTMLFormControlsCollection.prototype, { - namedItem: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLFormControlsCollection", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = HTMLFormControlsCollection; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLFormControlsCollection - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(`${key}`); - } - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - const namedValue = target[implSymbol].namedItem(P); - - if (namedValue !== null && !(P in target) && !ignoreNamedProps) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - if (!Object.hasOwn(target, P)) { - const creating = !(target[implSymbol].namedItem(P) !== null); - if (!creating) { - return false; - } - } - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - if (target[implSymbol].namedItem(P) !== null && !(P in target)) { - return false; - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../nodes/HTMLFormControlsCollection-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFormElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFormElement.js deleted file mode 100644 index 845c9f2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFormElement.js +++ /dev/null @@ -1,658 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const HTMLElement = require("./HTMLElement.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "HTMLFormElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLFormElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLFormElement"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLFormElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - submit() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'submit' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - return esValue[implSymbol].submit(); - } - - requestSubmit() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'requestSubmit' called on an object that is not a valid instance of HTMLFormElement." - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = HTMLElement.convert(globalObject, curArg, { - context: "Failed to execute 'requestSubmit' on 'HTMLFormElement': parameter 1" - }); - } - args.push(curArg); - } - return esValue[implSymbol].requestSubmit(...args); - } - - reset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'reset' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].reset(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - checkValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'checkValidity' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - return esValue[implSymbol].checkValidity(); - } - - reportValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'reportValidity' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - return esValue[implSymbol].reportValidity(); - } - - get acceptCharset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get acceptCharset' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("accept-charset"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set acceptCharset(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set acceptCharset' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'acceptCharset' property on 'HTMLFormElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("accept-charset", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get action() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get action' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["action"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set action(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set action' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'action' property on 'HTMLFormElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["action"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get enctype() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get enctype' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["enctype"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set enctype(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set enctype' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'enctype' property on 'HTMLFormElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["enctype"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get method() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get method' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["method"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set method(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set method' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'method' property on 'HTMLFormElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["method"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLFormElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get noValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get noValidate' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("novalidate") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set noValidate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set noValidate' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'noValidate' property on 'HTMLFormElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("novalidate", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("novalidate"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get target() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get target' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("target"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set target(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set target' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'target' property on 'HTMLFormElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("target", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get elements() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get elements' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - return utils.getSameObject(this, "elements", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["elements"]); - }); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of HTMLFormElement." - ); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(HTMLFormElement.prototype, { - submit: { enumerable: true }, - requestSubmit: { enumerable: true }, - reset: { enumerable: true }, - checkValidity: { enumerable: true }, - reportValidity: { enumerable: true }, - acceptCharset: { enumerable: true }, - action: { enumerable: true }, - enctype: { enumerable: true }, - method: { enumerable: true }, - name: { enumerable: true }, - noValidate: { enumerable: true }, - target: { enumerable: true }, - elements: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLFormElement", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = HTMLFormElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLFormElement - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol][utils.indexedGet](index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol][utils.indexedGet](index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol][utils.indexedGet](index) !== null); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../nodes/HTMLFormElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFrameElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFrameElement.js deleted file mode 100644 index 4cfcc7b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFrameElement.js +++ /dev/null @@ -1,510 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLFrameElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLFrameElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLFrameElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLFrameElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get scrolling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scrolling' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("scrolling"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set scrolling(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set scrolling' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'scrolling' property on 'HTMLFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("scrolling", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get src() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get src' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("src"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._srcURLCache; - } - - this._srcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._srcURLCache = serializeURLwhatwg_url(urlRecord); - return this._srcURLCache; - } - this._srcURLCache = conversions.USVString(value); - return this._srcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set src(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set src' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'src' property on 'HTMLFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("src", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get frameBorder() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get frameBorder' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("frameborder"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set frameBorder(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set frameBorder' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'frameBorder' property on 'HTMLFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("frameborder", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get longDesc() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get longDesc' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("longdesc"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._longdescURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._longdescURLCache; - } - - this._longdescURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._longdescURLCache = serializeURLwhatwg_url(urlRecord); - return this._longdescURLCache; - } - this._longdescURLCache = conversions.USVString(value); - return this._longdescURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set longDesc(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set longDesc' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'longDesc' property on 'HTMLFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("longdesc", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get noResize() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get noResize' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("noresize") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set noResize(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set noResize' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'noResize' property on 'HTMLFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("noresize", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("noresize"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get contentDocument() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get contentDocument' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["contentDocument"]); - } - - get contentWindow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get contentWindow' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["contentWindow"]); - } - - get marginHeight() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get marginHeight' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("marginheight"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set marginHeight(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set marginHeight' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'marginHeight' property on 'HTMLFrameElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("marginheight", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get marginWidth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get marginWidth' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("marginwidth"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set marginWidth(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set marginWidth' called on an object that is not a valid instance of HTMLFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'marginWidth' property on 'HTMLFrameElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("marginwidth", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLFrameElement.prototype, { - name: { enumerable: true }, - scrolling: { enumerable: true }, - src: { enumerable: true }, - frameBorder: { enumerable: true }, - longDesc: { enumerable: true }, - noResize: { enumerable: true }, - contentDocument: { enumerable: true }, - contentWindow: { enumerable: true }, - marginHeight: { enumerable: true }, - marginWidth: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLFrameElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLFrameElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLFrameElement - }); -}; - -const Impl = require("../nodes/HTMLFrameElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFrameSetElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFrameSetElement.js deleted file mode 100644 index e93a3e3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLFrameSetElement.js +++ /dev/null @@ -1,708 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const OnBeforeUnloadEventHandlerNonNull = require("./OnBeforeUnloadEventHandlerNonNull.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLFrameSetElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLFrameSetElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLFrameSetElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLFrameSetElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get cols() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cols' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("cols"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set cols(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set cols' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'cols' property on 'HTMLFrameSetElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("cols", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rows() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rows' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("rows"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set rows(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set rows' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'rows' property on 'HTMLFrameSetElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("rows", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get onafterprint() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onafterprint' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onafterprint"]); - } - - set onafterprint(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onafterprint' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onafterprint' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onafterprint"] = V; - } - - get onbeforeprint() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforeprint' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforeprint"]); - } - - set onbeforeprint(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforeprint' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforeprint' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onbeforeprint"] = V; - } - - get onbeforeunload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforeunload' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforeunload"]); - } - - set onbeforeunload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforeunload' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = OnBeforeUnloadEventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforeunload' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onbeforeunload"] = V; - } - - get onhashchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onhashchange' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onhashchange"]); - } - - set onhashchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onhashchange' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onhashchange' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onhashchange"] = V; - } - - get onlanguagechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onlanguagechange' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onlanguagechange"]); - } - - set onlanguagechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onlanguagechange' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onlanguagechange' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onlanguagechange"] = V; - } - - get onmessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmessage' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmessage"]); - } - - set onmessage(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmessage' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmessage' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onmessage"] = V; - } - - get onmessageerror() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmessageerror' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmessageerror"]); - } - - set onmessageerror(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmessageerror' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmessageerror' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onmessageerror"] = V; - } - - get onoffline() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onoffline' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onoffline"]); - } - - set onoffline(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onoffline' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onoffline' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onoffline"] = V; - } - - get ononline() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ononline' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ononline"]); - } - - set ononline(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ononline' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ononline' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["ononline"] = V; - } - - get onpagehide() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpagehide' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpagehide"]); - } - - set onpagehide(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpagehide' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpagehide' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onpagehide"] = V; - } - - get onpageshow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpageshow' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpageshow"]); - } - - set onpageshow(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpageshow' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpageshow' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onpageshow"] = V; - } - - get onpopstate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpopstate' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpopstate"]); - } - - set onpopstate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpopstate' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpopstate' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onpopstate"] = V; - } - - get onrejectionhandled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onrejectionhandled' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onrejectionhandled"]); - } - - set onrejectionhandled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onrejectionhandled' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onrejectionhandled' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onrejectionhandled"] = V; - } - - get onstorage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onstorage' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onstorage"]); - } - - set onstorage(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onstorage' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onstorage' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onstorage"] = V; - } - - get onunhandledrejection() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onunhandledrejection' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onunhandledrejection"]); - } - - set onunhandledrejection(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onunhandledrejection' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onunhandledrejection' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onunhandledrejection"] = V; - } - - get onunload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onunload' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onunload"]); - } - - set onunload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onunload' called on an object that is not a valid instance of HTMLFrameSetElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onunload' property on 'HTMLFrameSetElement': The provided value" - }); - } - esValue[implSymbol]["onunload"] = V; - } - } - Object.defineProperties(HTMLFrameSetElement.prototype, { - cols: { enumerable: true }, - rows: { enumerable: true }, - onafterprint: { enumerable: true }, - onbeforeprint: { enumerable: true }, - onbeforeunload: { enumerable: true }, - onhashchange: { enumerable: true }, - onlanguagechange: { enumerable: true }, - onmessage: { enumerable: true }, - onmessageerror: { enumerable: true }, - onoffline: { enumerable: true }, - ononline: { enumerable: true }, - onpagehide: { enumerable: true }, - onpageshow: { enumerable: true }, - onpopstate: { enumerable: true }, - onrejectionhandled: { enumerable: true }, - onstorage: { enumerable: true }, - onunhandledrejection: { enumerable: true }, - onunload: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLFrameSetElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLFrameSetElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLFrameSetElement - }); -}; - -const Impl = require("../nodes/HTMLFrameSetElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHRElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHRElement.js deleted file mode 100644 index 311493e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHRElement.js +++ /dev/null @@ -1,320 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLHRElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLHRElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLHRElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLHRElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLHRElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get color() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get color' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("color"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set color(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set color' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'color' property on 'HTMLHRElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("color", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get noShade() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get noShade' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("noshade") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set noShade(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set noShade' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'noShade' property on 'HTMLHRElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("noshade", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("noshade"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get size() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get size' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("size"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set size(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set size' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'size' property on 'HTMLHRElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("size", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLHRElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'width' property on 'HTMLHRElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("width", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLHRElement.prototype, { - align: { enumerable: true }, - color: { enumerable: true }, - noShade: { enumerable: true }, - size: { enumerable: true }, - width: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLHRElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLHRElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLHRElement - }); -}; - -const Impl = require("../nodes/HTMLHRElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHeadElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHeadElement.js deleted file mode 100644 index f338881..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHeadElement.js +++ /dev/null @@ -1,110 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLHeadElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLHeadElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLHeadElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLHeadElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - } - Object.defineProperties(HTMLHeadElement.prototype, { - [Symbol.toStringTag]: { value: "HTMLHeadElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLHeadElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLHeadElement - }); -}; - -const Impl = require("../nodes/HTMLHeadElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHeadingElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHeadingElement.js deleted file mode 100644 index 8efee4a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHeadingElement.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLHeadingElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLHeadingElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLHeadingElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLHeadingElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLHeadingElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLHeadingElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLHeadingElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLHeadingElement.prototype, { - align: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLHeadingElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLHeadingElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLHeadingElement - }); -}; - -const Impl = require("../nodes/HTMLHeadingElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHtmlElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHtmlElement.js deleted file mode 100644 index c1f0c87..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLHtmlElement.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLHtmlElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLHtmlElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLHtmlElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLHtmlElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get version() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get version' called on an object that is not a valid instance of HTMLHtmlElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("version"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set version(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set version' called on an object that is not a valid instance of HTMLHtmlElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'version' property on 'HTMLHtmlElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("version", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLHtmlElement.prototype, { - version: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLHtmlElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLHtmlElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLHtmlElement - }); -}; - -const Impl = require("../nodes/HTMLHtmlElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLIFrameElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLIFrameElement.js deleted file mode 100644 index 5190283..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLIFrameElement.js +++ /dev/null @@ -1,686 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLIFrameElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLIFrameElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLIFrameElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLIFrameElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - getSVGDocument() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getSVGDocument' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].getSVGDocument()); - } - - get src() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get src' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("src"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._srcURLCache; - } - - this._srcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._srcURLCache = serializeURLwhatwg_url(urlRecord); - return this._srcURLCache; - } - this._srcURLCache = conversions.USVString(value); - return this._srcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set src(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set src' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'src' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("src", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get srcdoc() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get srcdoc' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("srcdoc"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set srcdoc(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set srcdoc' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'srcdoc' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("srcdoc", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get allowFullscreen() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get allowFullscreen' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("allowfullscreen") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set allowFullscreen(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set allowFullscreen' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'allowFullscreen' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("allowfullscreen", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("allowfullscreen"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'width' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("width", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("height"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set height' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'height' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("height", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get contentDocument() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get contentDocument' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["contentDocument"]); - } - - get contentWindow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get contentWindow' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["contentWindow"]); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get scrolling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scrolling' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("scrolling"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set scrolling(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set scrolling' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'scrolling' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("scrolling", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get frameBorder() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get frameBorder' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("frameborder"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set frameBorder(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set frameBorder' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'frameBorder' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("frameborder", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get longDesc() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get longDesc' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("longdesc"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._longdescURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._longdescURLCache; - } - - this._longdescURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._longdescURLCache = serializeURLwhatwg_url(urlRecord); - return this._longdescURLCache; - } - this._longdescURLCache = conversions.USVString(value); - return this._longdescURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set longDesc(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set longDesc' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'longDesc' property on 'HTMLIFrameElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("longdesc", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get marginHeight() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get marginHeight' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("marginheight"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set marginHeight(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set marginHeight' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'marginHeight' property on 'HTMLIFrameElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("marginheight", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get marginWidth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get marginWidth' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("marginwidth"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set marginWidth(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set marginWidth' called on an object that is not a valid instance of HTMLIFrameElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'marginWidth' property on 'HTMLIFrameElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("marginwidth", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLIFrameElement.prototype, { - getSVGDocument: { enumerable: true }, - src: { enumerable: true }, - srcdoc: { enumerable: true }, - name: { enumerable: true }, - allowFullscreen: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - contentDocument: { enumerable: true }, - contentWindow: { enumerable: true }, - align: { enumerable: true }, - scrolling: { enumerable: true }, - frameBorder: { enumerable: true }, - longDesc: { enumerable: true }, - marginHeight: { enumerable: true }, - marginWidth: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLIFrameElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLIFrameElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLIFrameElement - }); -}; - -const Impl = require("../nodes/HTMLIFrameElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLImageElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLImageElement.js deleted file mode 100644 index e607cfd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLImageElement.js +++ /dev/null @@ -1,902 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLImageElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLImageElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLImageElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLImageElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get alt() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get alt' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("alt"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set alt(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set alt' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'alt' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("alt", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get src() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get src' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("src"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._srcURLCache; - } - - this._srcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._srcURLCache = serializeURLwhatwg_url(urlRecord); - return this._srcURLCache; - } - this._srcURLCache = conversions.USVString(value); - return this._srcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set src(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set src' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'src' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("src", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get srcset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get srcset' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("srcset"); - return value === null ? "" : conversions.USVString(value); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set srcset(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set srcset' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'srcset' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("srcset", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get sizes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get sizes' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("sizes"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set sizes(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set sizes' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'sizes' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("sizes", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get crossOrigin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get crossOrigin' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("crossorigin"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set crossOrigin(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set crossOrigin' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'crossOrigin' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("crossorigin"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("crossorigin", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get useMap() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get useMap' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("usemap"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set useMap(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set useMap' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'useMap' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("usemap", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get isMap() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get isMap' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("ismap") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set isMap(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set isMap' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'isMap' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("ismap", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("ismap"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["width"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'width' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["width"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["height"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set height' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'height' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["height"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get naturalWidth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get naturalWidth' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - return esValue[implSymbol]["naturalWidth"]; - } - - get naturalHeight() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get naturalHeight' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - return esValue[implSymbol]["naturalHeight"]; - } - - get complete() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get complete' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - return esValue[implSymbol]["complete"]; - } - - get currentSrc() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get currentSrc' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - return esValue[implSymbol]["currentSrc"]; - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get lowsrc() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get lowsrc' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("lowsrc"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._lowsrcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._lowsrcURLCache; - } - - this._lowsrcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._lowsrcURLCache = serializeURLwhatwg_url(urlRecord); - return this._lowsrcURLCache; - } - this._lowsrcURLCache = conversions.USVString(value); - return this._lowsrcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set lowsrc(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set lowsrc' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'lowsrc' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("lowsrc", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get hspace() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hspace' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("hspace"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hspace(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hspace' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'hspace' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get vspace() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get vspace' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("vspace"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set vspace(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set vspace' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'vspace' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get longDesc() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get longDesc' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("longdesc"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._longdescURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._longdescURLCache; - } - - this._longdescURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._longdescURLCache = serializeURLwhatwg_url(urlRecord); - return this._longdescURLCache; - } - this._longdescURLCache = conversions.USVString(value); - return this._longdescURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set longDesc(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set longDesc' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'longDesc' property on 'HTMLImageElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("longdesc", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get border() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get border' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("border"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set border(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set border' called on an object that is not a valid instance of HTMLImageElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'border' property on 'HTMLImageElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("border", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLImageElement.prototype, { - alt: { enumerable: true }, - src: { enumerable: true }, - srcset: { enumerable: true }, - sizes: { enumerable: true }, - crossOrigin: { enumerable: true }, - useMap: { enumerable: true }, - isMap: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - naturalWidth: { enumerable: true }, - naturalHeight: { enumerable: true }, - complete: { enumerable: true }, - currentSrc: { enumerable: true }, - name: { enumerable: true }, - lowsrc: { enumerable: true }, - align: { enumerable: true }, - hspace: { enumerable: true }, - vspace: { enumerable: true }, - longDesc: { enumerable: true }, - border: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLImageElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLImageElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLImageElement - }); -}; - -const Impl = require("../nodes/HTMLImageElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLInputElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLInputElement.js deleted file mode 100644 index 5abc198..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLInputElement.js +++ /dev/null @@ -1,1927 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const SelectionMode = require("./SelectionMode.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const FileList = require("./FileList.js"); -const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; -const create_DOMException = require("./DOMException.js").create; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLInputElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLInputElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLInputElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLInputElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - stepUp() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'stepUp' called on an object that is not a valid instance of HTMLInputElement." - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'stepUp' on 'HTMLInputElement': parameter 1", - globals: globalObject - }); - } else { - curArg = 1; - } - args.push(curArg); - } - return esValue[implSymbol].stepUp(...args); - } - - stepDown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'stepDown' called on an object that is not a valid instance of HTMLInputElement." - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'stepDown' on 'HTMLInputElement': parameter 1", - globals: globalObject - }); - } else { - curArg = 1; - } - args.push(curArg); - } - return esValue[implSymbol].stepDown(...args); - } - - checkValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'checkValidity' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol].checkValidity(); - } - - reportValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'reportValidity' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol].reportValidity(); - } - - setCustomValidity(error) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setCustomValidity' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setCustomValidity' on 'HTMLInputElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setCustomValidity' on 'HTMLInputElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setCustomValidity(...args); - } - - select() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'select' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol].select(); - } - - setRangeText(replacement) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setRangeText' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setRangeText' on 'HTMLInputElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - switch (arguments.length) { - case 1: - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - break; - case 2: - throw new globalObject.TypeError( - `Failed to execute 'setRangeText' on 'HTMLInputElement': only ${arguments.length} arguments present.` - ); - break; - case 3: - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - break; - default: - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - curArg = SelectionMode.convert(globalObject, curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 4" - }); - } else { - curArg = "preserve"; - } - args.push(curArg); - } - } - return esValue[implSymbol].setRangeText(...args); - } - - setSelectionRange(start, end) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setSelectionRange' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'setSelectionRange' on 'HTMLInputElement': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setSelectionRange' on 'HTMLInputElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setSelectionRange' on 'HTMLInputElement': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setSelectionRange' on 'HTMLInputElement': parameter 3", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].setSelectionRange(...args); - } - - get accept() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get accept' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("accept"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set accept(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set accept' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'accept' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("accept", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get alt() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get alt' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("alt"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set alt(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set alt' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'alt' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("alt", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get autocomplete() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get autocomplete' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("autocomplete"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set autocomplete(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set autocomplete' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'autocomplete' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("autocomplete", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get autofocus() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get autofocus' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("autofocus") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set autofocus(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set autofocus' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'autofocus' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("autofocus", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("autofocus"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get defaultChecked() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defaultChecked' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("checked") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set defaultChecked(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set defaultChecked' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'defaultChecked' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("checked", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("checked"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get checked() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get checked' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol]["checked"]; - } - - set checked(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set checked' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'checked' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["checked"] = V; - } - - get dirName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get dirName' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("dirname"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set dirName(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set dirName' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'dirName' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("dirname", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get disabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get disabled' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("disabled") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set disabled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set disabled' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'disabled' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("disabled", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("disabled"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get files() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get files' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["files"]); - } - - set files(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set files' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = FileList.convert(globalObject, V, { - context: "Failed to set the 'files' property on 'HTMLInputElement': The provided value" - }); - } - esValue[implSymbol]["files"] = V; - } - - get formNoValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get formNoValidate' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("formnovalidate") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set formNoValidate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set formNoValidate' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'formNoValidate' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("formnovalidate", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("formnovalidate"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get formTarget() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get formTarget' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("formtarget"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set formTarget(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set formTarget' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'formTarget' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("formtarget", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get indeterminate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get indeterminate' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol]["indeterminate"]; - } - - set indeterminate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set indeterminate' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'indeterminate' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["indeterminate"] = V; - } - - get inputMode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get inputMode' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("inputmode"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set inputMode(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set inputMode' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'inputMode' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("inputmode", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get list() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get list' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["list"]); - } - - get max() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get max' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("max"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set max(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set max' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'max' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("max", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get maxLength() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get maxLength' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("maxlength"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && conversions.long(value) === value) { - return value; - } - } - return -1; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set maxLength(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set maxLength' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'maxLength' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V < 0) { - throw create_DOMException(globalObject, [ - `The negative value ${V} cannot be set for the maxLength property.`, - "IndexSizeError" - ]); - } - - esValue[implSymbol]._reflectSetTheContentAttribute("maxlength", String(V)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get min() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get min' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("min"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set min(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set min' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'min' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("min", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get minLength() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get minLength' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("minlength"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && conversions.long(value) === value) { - return value; - } - } - return -1; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set minLength(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set minLength' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'minLength' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V < 0) { - throw create_DOMException(globalObject, [ - `The negative value ${V} cannot be set for the minLength property.`, - "IndexSizeError" - ]); - } - - esValue[implSymbol]._reflectSetTheContentAttribute("minlength", String(V)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get multiple() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get multiple' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("multiple") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set multiple(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set multiple' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'multiple' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("multiple", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("multiple"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get pattern() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pattern' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("pattern"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set pattern(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set pattern' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'pattern' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("pattern", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get placeholder() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get placeholder' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("placeholder"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set placeholder(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set placeholder' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'placeholder' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("placeholder", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get readOnly() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get readOnly' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("readonly") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set readOnly(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set readOnly' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'readOnly' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("readonly", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("readonly"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get required() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get required' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("required") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set required(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set required' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'required' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("required", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("required"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get size() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get size' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("size"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 1 && value <= 2147483647) { - return value; - } - } - return 20; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set size(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set size' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'size' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === 0) { - throw create_DOMException(globalObject, [ - `The value ${V} cannot be set for the size property.`, - "IndexSizeError" - ]); - } - - const newValue = V <= 2147483647 && V >= 1 ? V : 20; - esValue[implSymbol]._reflectSetTheContentAttribute("size", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get src() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get src' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("src"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._srcURLCache; - } - - this._srcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._srcURLCache = serializeURLwhatwg_url(urlRecord); - return this._srcURLCache; - } - this._srcURLCache = conversions.USVString(value); - return this._srcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set src(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set src' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'src' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("src", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get step() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get step' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("step"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set step(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set step' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'step' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("step", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["type"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["type"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get defaultValue() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defaultValue' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("value"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set defaultValue(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set defaultValue' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'defaultValue' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("value", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["value"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'HTMLInputElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["value"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get valueAsDate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get valueAsDate' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol]["valueAsDate"]; - } - - set valueAsDate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set valueAsDate' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["object"](V, { - context: "Failed to set the 'valueAsDate' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - } - esValue[implSymbol]["valueAsDate"] = V; - } - - get valueAsNumber() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get valueAsNumber' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol]["valueAsNumber"]; - } - - set valueAsNumber(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set valueAsNumber' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["unrestricted double"](V, { - context: "Failed to set the 'valueAsNumber' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["valueAsNumber"] = V; - } - - get willValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get willValidate' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol]["willValidate"]; - } - - get validity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validity' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["validity"]); - } - - get validationMessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validationMessage' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol]["validationMessage"]; - } - - get labels() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get labels' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]); - } - - get selectionStart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selectionStart' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol]["selectionStart"]; - } - - set selectionStart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set selectionStart' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["unsigned long"](V, { - context: "Failed to set the 'selectionStart' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - } - esValue[implSymbol]["selectionStart"] = V; - } - - get selectionEnd() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selectionEnd' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol]["selectionEnd"]; - } - - set selectionEnd(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set selectionEnd' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["unsigned long"](V, { - context: "Failed to set the 'selectionEnd' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - } - esValue[implSymbol]["selectionEnd"] = V; - } - - get selectionDirection() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selectionDirection' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - return esValue[implSymbol]["selectionDirection"]; - } - - set selectionDirection(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set selectionDirection' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'selectionDirection' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - } - esValue[implSymbol]["selectionDirection"] = V; - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get useMap() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get useMap' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("usemap"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set useMap(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set useMap' called on an object that is not a valid instance of HTMLInputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'useMap' property on 'HTMLInputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("usemap", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLInputElement.prototype, { - stepUp: { enumerable: true }, - stepDown: { enumerable: true }, - checkValidity: { enumerable: true }, - reportValidity: { enumerable: true }, - setCustomValidity: { enumerable: true }, - select: { enumerable: true }, - setRangeText: { enumerable: true }, - setSelectionRange: { enumerable: true }, - accept: { enumerable: true }, - alt: { enumerable: true }, - autocomplete: { enumerable: true }, - autofocus: { enumerable: true }, - defaultChecked: { enumerable: true }, - checked: { enumerable: true }, - dirName: { enumerable: true }, - disabled: { enumerable: true }, - form: { enumerable: true }, - files: { enumerable: true }, - formNoValidate: { enumerable: true }, - formTarget: { enumerable: true }, - indeterminate: { enumerable: true }, - inputMode: { enumerable: true }, - list: { enumerable: true }, - max: { enumerable: true }, - maxLength: { enumerable: true }, - min: { enumerable: true }, - minLength: { enumerable: true }, - multiple: { enumerable: true }, - name: { enumerable: true }, - pattern: { enumerable: true }, - placeholder: { enumerable: true }, - readOnly: { enumerable: true }, - required: { enumerable: true }, - size: { enumerable: true }, - src: { enumerable: true }, - step: { enumerable: true }, - type: { enumerable: true }, - defaultValue: { enumerable: true }, - value: { enumerable: true }, - valueAsDate: { enumerable: true }, - valueAsNumber: { enumerable: true }, - willValidate: { enumerable: true }, - validity: { enumerable: true }, - validationMessage: { enumerable: true }, - labels: { enumerable: true }, - selectionStart: { enumerable: true }, - selectionEnd: { enumerable: true }, - selectionDirection: { enumerable: true }, - align: { enumerable: true }, - useMap: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLInputElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLInputElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLInputElement - }); -}; - -const Impl = require("../nodes/HTMLInputElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLIElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLIElement.js deleted file mode 100644 index 4e572b7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLIElement.js +++ /dev/null @@ -1,201 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const parseInteger_helpers_strings = require("../helpers/strings.js").parseInteger; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLLIElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLLIElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLLIElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLLIElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLLIElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("value"); - if (value !== null) { - value = parseInteger_helpers_strings(value); - if (value !== null && conversions.long(value) === value) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLLIElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'value' property on 'HTMLLIElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("value", String(V)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLLIElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLLIElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLLIElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLLIElement.prototype, { - value: { enumerable: true }, - type: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLLIElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLLIElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLLIElement - }); -}; - -const Impl = require("../nodes/HTMLLIElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLabelElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLabelElement.js deleted file mode 100644 index 4f38c5e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLabelElement.js +++ /dev/null @@ -1,179 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLLabelElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLLabelElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLLabelElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLLabelElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLLabelElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get htmlFor() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get htmlFor' called on an object that is not a valid instance of HTMLLabelElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("for"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set htmlFor(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set htmlFor' called on an object that is not a valid instance of HTMLLabelElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'htmlFor' property on 'HTMLLabelElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("for", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get control() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get control' called on an object that is not a valid instance of HTMLLabelElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["control"]); - } - } - Object.defineProperties(HTMLLabelElement.prototype, { - form: { enumerable: true }, - htmlFor: { enumerable: true }, - control: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLLabelElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLLabelElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLLabelElement - }); -}; - -const Impl = require("../nodes/HTMLLabelElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLegendElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLegendElement.js deleted file mode 100644 index a67e6cc..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLegendElement.js +++ /dev/null @@ -1,166 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLLegendElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLLegendElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLLegendElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLLegendElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLLegendElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLLegendElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLLegendElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLLegendElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLLegendElement.prototype, { - form: { enumerable: true }, - align: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLLegendElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLLegendElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLLegendElement - }); -}; - -const Impl = require("../nodes/HTMLLegendElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLinkElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLinkElement.js deleted file mode 100644 index 85e806e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLLinkElement.js +++ /dev/null @@ -1,552 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLLinkElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLLinkElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLLinkElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLLinkElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get href() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get href' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("href"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._hrefURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._hrefURLCache; - } - - this._hrefURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._hrefURLCache = serializeURLwhatwg_url(urlRecord); - return this._hrefURLCache; - } - this._hrefURLCache = conversions.USVString(value); - return this._hrefURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set href(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set href' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'href' property on 'HTMLLinkElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("href", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get crossOrigin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get crossOrigin' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("crossorigin"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set crossOrigin(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set crossOrigin' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'crossOrigin' property on 'HTMLLinkElement': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("crossorigin"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("crossorigin", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rel' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("rel"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set rel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set rel' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'rel' property on 'HTMLLinkElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("rel", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get relList() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get relList' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - return utils.getSameObject(this, "relList", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["relList"]); - }); - } - - set relList(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set relList' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - const Q = esValue["relList"]; - if (!utils.isObject(Q)) { - throw new globalObject.TypeError("Property 'relList' is not an object"); - } - Reflect.set(Q, "value", V); - } - - get media() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get media' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("media"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set media(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set media' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'media' property on 'HTMLLinkElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("media", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get hreflang() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hreflang' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("hreflang"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hreflang(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hreflang' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'hreflang' property on 'HTMLLinkElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("hreflang", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLLinkElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get charset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get charset' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("charset"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set charset(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set charset' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'charset' property on 'HTMLLinkElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("charset", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rev() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rev' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("rev"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set rev(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set rev' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'rev' property on 'HTMLLinkElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("rev", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get target() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get target' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("target"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set target(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set target' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'target' property on 'HTMLLinkElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("target", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get sheet() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get sheet' called on an object that is not a valid instance of HTMLLinkElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["sheet"]); - } - } - Object.defineProperties(HTMLLinkElement.prototype, { - href: { enumerable: true }, - crossOrigin: { enumerable: true }, - rel: { enumerable: true }, - relList: { enumerable: true }, - media: { enumerable: true }, - hreflang: { enumerable: true }, - type: { enumerable: true }, - charset: { enumerable: true }, - rev: { enumerable: true }, - target: { enumerable: true }, - sheet: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLLinkElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLLinkElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLLinkElement - }); -}; - -const Impl = require("../nodes/HTMLLinkElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMapElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMapElement.js deleted file mode 100644 index 0c0f02f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMapElement.js +++ /dev/null @@ -1,168 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLMapElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLMapElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLMapElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLMapElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLMapElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLMapElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLMapElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get areas() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get areas' called on an object that is not a valid instance of HTMLMapElement." - ); - } - - return utils.getSameObject(this, "areas", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["areas"]); - }); - } - } - Object.defineProperties(HTMLMapElement.prototype, { - name: { enumerable: true }, - areas: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLMapElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLMapElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLMapElement - }); -}; - -const Impl = require("../nodes/HTMLMapElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMarqueeElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMarqueeElement.js deleted file mode 100644 index 1550031..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMarqueeElement.js +++ /dev/null @@ -1,554 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLMarqueeElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLMarqueeElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLMarqueeElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLMarqueeElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get behavior() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get behavior' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("behavior"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set behavior(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set behavior' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'behavior' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("behavior", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get bgColor() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get bgColor' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("bgcolor"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set bgColor(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set bgColor' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'bgColor' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("bgcolor", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get direction() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get direction' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("direction"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set direction(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set direction' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'direction' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("direction", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("height"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set height' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'height' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("height", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get hspace() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hspace' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("hspace"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hspace(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hspace' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'hspace' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get scrollAmount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scrollAmount' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("scrollamount"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set scrollAmount(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set scrollAmount' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'scrollAmount' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("scrollamount", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get scrollDelay() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scrollDelay' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("scrolldelay"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set scrollDelay(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set scrollDelay' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'scrollDelay' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("scrolldelay", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get trueSpeed() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get trueSpeed' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("truespeed") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set trueSpeed(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set trueSpeed' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'trueSpeed' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("truespeed", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("truespeed"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get vspace() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get vspace' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("vspace"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set vspace(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set vspace' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'vspace' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLMarqueeElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'width' property on 'HTMLMarqueeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("width", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLMarqueeElement.prototype, { - behavior: { enumerable: true }, - bgColor: { enumerable: true }, - direction: { enumerable: true }, - height: { enumerable: true }, - hspace: { enumerable: true }, - scrollAmount: { enumerable: true }, - scrollDelay: { enumerable: true }, - trueSpeed: { enumerable: true }, - vspace: { enumerable: true }, - width: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLMarqueeElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLMarqueeElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLMarqueeElement - }); -}; - -const Impl = require("../nodes/HTMLMarqueeElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMediaElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMediaElement.js deleted file mode 100644 index 894a70f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMediaElement.js +++ /dev/null @@ -1,898 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const TextTrackKind = require("./TextTrackKind.js"); -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLMediaElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLMediaElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLMediaElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLMediaElement extends globalObject.HTMLElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - load() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'load' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol].load(); - } - - canPlayType(type) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'canPlayType' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'canPlayType' on 'HTMLMediaElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'canPlayType' on 'HTMLMediaElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].canPlayType(...args)); - } - - play() { - try { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'play' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].play()); - } catch (e) { - return globalObject.Promise.reject(e); - } - } - - pause() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'pause' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol].pause(); - } - - addTextTrack(kind) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'addTextTrack' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'addTextTrack' on 'HTMLMediaElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = TextTrackKind.convert(globalObject, curArg, { - context: "Failed to execute 'addTextTrack' on 'HTMLMediaElement': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'addTextTrack' on 'HTMLMediaElement': parameter 2", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'addTextTrack' on 'HTMLMediaElement': parameter 3", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].addTextTrack(...args)); - } - - get src() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get src' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("src"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._srcURLCache; - } - - this._srcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._srcURLCache = serializeURLwhatwg_url(urlRecord); - return this._srcURLCache; - } - this._srcURLCache = conversions.USVString(value); - return this._srcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set src(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set src' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'src' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("src", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get currentSrc() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get currentSrc' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["currentSrc"]; - } - - get crossOrigin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get crossOrigin' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("crossorigin"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set crossOrigin(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set crossOrigin' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'crossOrigin' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("crossorigin"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("crossorigin", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get networkState() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get networkState' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["networkState"]; - } - - get preload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get preload' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("preload"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set preload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set preload' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'preload' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("preload", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get buffered() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get buffered' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["buffered"]); - } - - get readyState() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get readyState' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["readyState"]; - } - - get seeking() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get seeking' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["seeking"]; - } - - get currentTime() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get currentTime' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["currentTime"]; - } - - set currentTime(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set currentTime' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'currentTime' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["currentTime"] = V; - } - - get duration() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get duration' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["duration"]; - } - - get paused() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get paused' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["paused"]; - } - - get defaultPlaybackRate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defaultPlaybackRate' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["defaultPlaybackRate"]; - } - - set defaultPlaybackRate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set defaultPlaybackRate' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'defaultPlaybackRate' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["defaultPlaybackRate"] = V; - } - - get playbackRate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get playbackRate' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["playbackRate"]; - } - - set playbackRate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set playbackRate' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'playbackRate' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["playbackRate"] = V; - } - - get played() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get played' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["played"]); - } - - get seekable() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get seekable' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["seekable"]); - } - - get ended() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ended' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["ended"]; - } - - get autoplay() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get autoplay' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("autoplay") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set autoplay(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set autoplay' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'autoplay' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("autoplay", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("autoplay"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get loop() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get loop' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("loop") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set loop(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set loop' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'loop' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("loop", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("loop"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get controls() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get controls' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("controls") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set controls(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set controls' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'controls' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("controls", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("controls"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get volume() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get volume' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["volume"]; - } - - set volume(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set volume' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'volume' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["volume"] = V; - } - - get muted() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get muted' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return esValue[implSymbol]["muted"]; - } - - set muted(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set muted' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'muted' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["muted"] = V; - } - - get defaultMuted() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defaultMuted' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("muted") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set defaultMuted(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set defaultMuted' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'defaultMuted' property on 'HTMLMediaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("muted", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("muted"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get audioTracks() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get audioTracks' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return utils.getSameObject(this, "audioTracks", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["audioTracks"]); - }); - } - - get videoTracks() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get videoTracks' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return utils.getSameObject(this, "videoTracks", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["videoTracks"]); - }); - } - - get textTracks() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get textTracks' called on an object that is not a valid instance of HTMLMediaElement." - ); - } - - return utils.getSameObject(this, "textTracks", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["textTracks"]); - }); - } - } - Object.defineProperties(HTMLMediaElement.prototype, { - load: { enumerable: true }, - canPlayType: { enumerable: true }, - play: { enumerable: true }, - pause: { enumerable: true }, - addTextTrack: { enumerable: true }, - src: { enumerable: true }, - currentSrc: { enumerable: true }, - crossOrigin: { enumerable: true }, - networkState: { enumerable: true }, - preload: { enumerable: true }, - buffered: { enumerable: true }, - readyState: { enumerable: true }, - seeking: { enumerable: true }, - currentTime: { enumerable: true }, - duration: { enumerable: true }, - paused: { enumerable: true }, - defaultPlaybackRate: { enumerable: true }, - playbackRate: { enumerable: true }, - played: { enumerable: true }, - seekable: { enumerable: true }, - ended: { enumerable: true }, - autoplay: { enumerable: true }, - loop: { enumerable: true }, - controls: { enumerable: true }, - volume: { enumerable: true }, - muted: { enumerable: true }, - defaultMuted: { enumerable: true }, - audioTracks: { enumerable: true }, - videoTracks: { enumerable: true }, - textTracks: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLMediaElement", configurable: true }, - NETWORK_EMPTY: { value: 0, enumerable: true }, - NETWORK_IDLE: { value: 1, enumerable: true }, - NETWORK_LOADING: { value: 2, enumerable: true }, - NETWORK_NO_SOURCE: { value: 3, enumerable: true }, - HAVE_NOTHING: { value: 0, enumerable: true }, - HAVE_METADATA: { value: 1, enumerable: true }, - HAVE_CURRENT_DATA: { value: 2, enumerable: true }, - HAVE_FUTURE_DATA: { value: 3, enumerable: true }, - HAVE_ENOUGH_DATA: { value: 4, enumerable: true } - }); - Object.defineProperties(HTMLMediaElement, { - NETWORK_EMPTY: { value: 0, enumerable: true }, - NETWORK_IDLE: { value: 1, enumerable: true }, - NETWORK_LOADING: { value: 2, enumerable: true }, - NETWORK_NO_SOURCE: { value: 3, enumerable: true }, - HAVE_NOTHING: { value: 0, enumerable: true }, - HAVE_METADATA: { value: 1, enumerable: true }, - HAVE_CURRENT_DATA: { value: 2, enumerable: true }, - HAVE_FUTURE_DATA: { value: 3, enumerable: true }, - HAVE_ENOUGH_DATA: { value: 4, enumerable: true } - }); - ctorRegistry[interfaceName] = HTMLMediaElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLMediaElement - }); -}; - -const Impl = require("../nodes/HTMLMediaElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMenuElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMenuElement.js deleted file mode 100644 index d23cf80..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMenuElement.js +++ /dev/null @@ -1,156 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLMenuElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLMenuElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLMenuElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLMenuElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get compact() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get compact' called on an object that is not a valid instance of HTMLMenuElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("compact") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set compact(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set compact' called on an object that is not a valid instance of HTMLMenuElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'compact' property on 'HTMLMenuElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("compact", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("compact"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLMenuElement.prototype, { - compact: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLMenuElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLMenuElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLMenuElement - }); -}; - -const Impl = require("../nodes/HTMLMenuElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMetaElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMetaElement.js deleted file mode 100644 index 01c6db6..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMetaElement.js +++ /dev/null @@ -1,276 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLMetaElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLMetaElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLMetaElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLMetaElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLMetaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLMetaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLMetaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get httpEquiv() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get httpEquiv' called on an object that is not a valid instance of HTMLMetaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("http-equiv"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set httpEquiv(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set httpEquiv' called on an object that is not a valid instance of HTMLMetaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'httpEquiv' property on 'HTMLMetaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("http-equiv", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get content() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get content' called on an object that is not a valid instance of HTMLMetaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("content"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set content(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set content' called on an object that is not a valid instance of HTMLMetaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'content' property on 'HTMLMetaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("content", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get scheme() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scheme' called on an object that is not a valid instance of HTMLMetaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("scheme"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set scheme(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set scheme' called on an object that is not a valid instance of HTMLMetaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'scheme' property on 'HTMLMetaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("scheme", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLMetaElement.prototype, { - name: { enumerable: true }, - httpEquiv: { enumerable: true }, - content: { enumerable: true }, - scheme: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLMetaElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLMetaElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLMetaElement - }); -}; - -const Impl = require("../nodes/HTMLMetaElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMeterElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMeterElement.js deleted file mode 100644 index 029fdef..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLMeterElement.js +++ /dev/null @@ -1,365 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLMeterElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLMeterElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLMeterElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLMeterElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["value"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'value' property on 'HTMLMeterElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["value"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get min() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get min' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["min"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set min(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set min' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'min' property on 'HTMLMeterElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["min"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get max() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get max' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["max"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set max(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set max' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'max' property on 'HTMLMeterElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["max"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get low() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get low' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["low"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set low(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set low' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'low' property on 'HTMLMeterElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["low"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get high() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get high' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["high"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set high(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set high' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'high' property on 'HTMLMeterElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["high"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get optimum() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get optimum' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["optimum"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set optimum(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set optimum' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'optimum' property on 'HTMLMeterElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["optimum"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get labels() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get labels' called on an object that is not a valid instance of HTMLMeterElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]); - } - } - Object.defineProperties(HTMLMeterElement.prototype, { - value: { enumerable: true }, - min: { enumerable: true }, - max: { enumerable: true }, - low: { enumerable: true }, - high: { enumerable: true }, - optimum: { enumerable: true }, - labels: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLMeterElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLMeterElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLMeterElement - }); -}; - -const Impl = require("../nodes/HTMLMeterElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLModElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLModElement.js deleted file mode 100644 index 94f6318..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLModElement.js +++ /dev/null @@ -1,214 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLModElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLModElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLModElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLModElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get cite() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cite' called on an object that is not a valid instance of HTMLModElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("cite"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._citeURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._citeURLCache; - } - - this._citeURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._citeURLCache = serializeURLwhatwg_url(urlRecord); - return this._citeURLCache; - } - this._citeURLCache = conversions.USVString(value); - return this._citeURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set cite(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set cite' called on an object that is not a valid instance of HTMLModElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'cite' property on 'HTMLModElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("cite", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get dateTime() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get dateTime' called on an object that is not a valid instance of HTMLModElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("datetime"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set dateTime(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set dateTime' called on an object that is not a valid instance of HTMLModElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'dateTime' property on 'HTMLModElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("datetime", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLModElement.prototype, { - cite: { enumerable: true }, - dateTime: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLModElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLModElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLModElement - }); -}; - -const Impl = require("../nodes/HTMLModElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOListElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOListElement.js deleted file mode 100644 index 00ccf37..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOListElement.js +++ /dev/null @@ -1,281 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLOListElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLOListElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLOListElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLOListElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get reversed() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get reversed' called on an object that is not a valid instance of HTMLOListElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("reversed") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set reversed(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set reversed' called on an object that is not a valid instance of HTMLOListElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'reversed' property on 'HTMLOListElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("reversed", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("reversed"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get start() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get start' called on an object that is not a valid instance of HTMLOListElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["start"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set start(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set start' called on an object that is not a valid instance of HTMLOListElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'start' property on 'HTMLOListElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["start"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLOListElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLOListElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLOListElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get compact() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get compact' called on an object that is not a valid instance of HTMLOListElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("compact") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set compact(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set compact' called on an object that is not a valid instance of HTMLOListElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'compact' property on 'HTMLOListElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("compact", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("compact"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLOListElement.prototype, { - reversed: { enumerable: true }, - start: { enumerable: true }, - type: { enumerable: true }, - compact: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLOListElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLOListElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLOListElement - }); -}; - -const Impl = require("../nodes/HTMLOListElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLObjectElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLObjectElement.js deleted file mode 100644 index 554ca94..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLObjectElement.js +++ /dev/null @@ -1,941 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLObjectElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLObjectElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLObjectElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLObjectElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - checkValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'checkValidity' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - return esValue[implSymbol].checkValidity(); - } - - reportValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'reportValidity' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - return esValue[implSymbol].reportValidity(); - } - - setCustomValidity(error) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setCustomValidity' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setCustomValidity' on 'HTMLObjectElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setCustomValidity' on 'HTMLObjectElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setCustomValidity(...args); - } - - get data() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get data' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("data"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._dataURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._dataURLCache; - } - - this._dataURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._dataURLCache = serializeURLwhatwg_url(urlRecord); - return this._dataURLCache; - } - this._dataURLCache = conversions.USVString(value); - return this._dataURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set data(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set data' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'data' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("data", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get useMap() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get useMap' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("usemap"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set useMap(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set useMap' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'useMap' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("usemap", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'width' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("width", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("height"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set height' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'height' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("height", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get contentDocument() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get contentDocument' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["contentDocument"]); - } - - get willValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get willValidate' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - return esValue[implSymbol]["willValidate"]; - } - - get validity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validity' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["validity"]); - } - - get validationMessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validationMessage' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - return esValue[implSymbol]["validationMessage"]; - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get archive() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get archive' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("archive"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set archive(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set archive' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'archive' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("archive", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get code() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get code' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("code"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set code(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set code' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'code' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("code", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get declare() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get declare' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("declare") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set declare(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set declare' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'declare' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("declare", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("declare"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get hspace() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hspace' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("hspace"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set hspace(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hspace' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'hspace' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get standby() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get standby' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("standby"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set standby(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set standby' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'standby' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("standby", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get vspace() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get vspace' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("vspace"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set vspace(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set vspace' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'vspace' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get codeBase() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get codeBase' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("codebase"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._codebaseURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._codebaseURLCache; - } - - this._codebaseURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._codebaseURLCache = serializeURLwhatwg_url(urlRecord); - return this._codebaseURLCache; - } - this._codebaseURLCache = conversions.USVString(value); - return this._codebaseURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set codeBase(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set codeBase' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'codeBase' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("codebase", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get codeType() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get codeType' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("codetype"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set codeType(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set codeType' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'codeType' property on 'HTMLObjectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("codetype", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get border() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get border' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("border"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set border(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set border' called on an object that is not a valid instance of HTMLObjectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'border' property on 'HTMLObjectElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("border", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLObjectElement.prototype, { - checkValidity: { enumerable: true }, - reportValidity: { enumerable: true }, - setCustomValidity: { enumerable: true }, - data: { enumerable: true }, - type: { enumerable: true }, - name: { enumerable: true }, - useMap: { enumerable: true }, - form: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - contentDocument: { enumerable: true }, - willValidate: { enumerable: true }, - validity: { enumerable: true }, - validationMessage: { enumerable: true }, - align: { enumerable: true }, - archive: { enumerable: true }, - code: { enumerable: true }, - declare: { enumerable: true }, - hspace: { enumerable: true }, - standby: { enumerable: true }, - vspace: { enumerable: true }, - codeBase: { enumerable: true }, - codeType: { enumerable: true }, - border: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLObjectElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLObjectElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLObjectElement - }); -}; - -const Impl = require("../nodes/HTMLObjectElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptGroupElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptGroupElement.js deleted file mode 100644 index 641b5cb..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptGroupElement.js +++ /dev/null @@ -1,197 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLOptGroupElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLOptGroupElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLOptGroupElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLOptGroupElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get disabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get disabled' called on an object that is not a valid instance of HTMLOptGroupElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("disabled") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set disabled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set disabled' called on an object that is not a valid instance of HTMLOptGroupElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'disabled' property on 'HTMLOptGroupElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("disabled", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("disabled"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get label() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get label' called on an object that is not a valid instance of HTMLOptGroupElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("label"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set label(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set label' called on an object that is not a valid instance of HTMLOptGroupElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'label' property on 'HTMLOptGroupElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("label", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLOptGroupElement.prototype, { - disabled: { enumerable: true }, - label: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLOptGroupElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLOptGroupElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLOptGroupElement - }); -}; - -const Impl = require("../nodes/HTMLOptGroupElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptionElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptionElement.js deleted file mode 100644 index 3309f66..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptionElement.js +++ /dev/null @@ -1,376 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLOptionElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLOptionElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLOptionElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLOptionElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get disabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get disabled' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("disabled") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set disabled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set disabled' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'disabled' property on 'HTMLOptionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("disabled", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("disabled"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get label() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get label' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["label"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set label(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set label' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'label' property on 'HTMLOptionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["label"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get defaultSelected() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defaultSelected' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("selected") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set defaultSelected(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set defaultSelected' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'defaultSelected' property on 'HTMLOptionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("selected", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("selected"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get selected() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selected' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - return esValue[implSymbol]["selected"]; - } - - set selected(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set selected' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'selected' property on 'HTMLOptionElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["selected"] = V; - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["value"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'HTMLOptionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["value"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get text() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get text' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["text"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set text(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set text' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'text' property on 'HTMLOptionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["text"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get index() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get index' called on an object that is not a valid instance of HTMLOptionElement." - ); - } - - return esValue[implSymbol]["index"]; - } - } - Object.defineProperties(HTMLOptionElement.prototype, { - disabled: { enumerable: true }, - form: { enumerable: true }, - label: { enumerable: true }, - defaultSelected: { enumerable: true }, - selected: { enumerable: true }, - value: { enumerable: true }, - text: { enumerable: true }, - index: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLOptionElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLOptionElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLOptionElement - }); -}; - -const Impl = require("../nodes/HTMLOptionElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptionsCollection.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptionsCollection.js deleted file mode 100644 index 90ace6d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptionsCollection.js +++ /dev/null @@ -1,511 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLOptionElement = require("./HTMLOptionElement.js"); -const HTMLOptGroupElement = require("./HTMLOptGroupElement.js"); -const HTMLElement = require("./HTMLElement.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLCollection = require("./HTMLCollection.js"); - -const interfaceName = "HTMLOptionsCollection"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLOptionsCollection'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLOptionsCollection"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLCollection._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLOptionsCollection extends globalObject.HTMLCollection { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - add(element) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'add' called on an object that is not a valid instance of HTMLOptionsCollection." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'add' on 'HTMLOptionsCollection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (HTMLOptionElement.is(curArg) || HTMLOptGroupElement.is(curArg)) { - curArg = utils.implForWrapper(curArg); - } else { - throw new globalObject.TypeError( - "Failed to execute 'add' on 'HTMLOptionsCollection': parameter 1" + " is not of any supported type." - ); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - if (HTMLElement.is(curArg)) { - curArg = utils.implForWrapper(curArg); - } else if (typeof curArg === "number") { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'add' on 'HTMLOptionsCollection': parameter 2", - globals: globalObject - }); - } else { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'add' on 'HTMLOptionsCollection': parameter 2", - globals: globalObject - }); - } - } - } else { - curArg = null; - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].add(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - remove(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'remove' called on an object that is not a valid instance of HTMLOptionsCollection." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'remove' on 'HTMLOptionsCollection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["long"](curArg, { - context: "Failed to execute 'remove' on 'HTMLOptionsCollection': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].remove(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of HTMLOptionsCollection." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["length"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set length(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set length' called on an object that is not a valid instance of HTMLOptionsCollection." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'length' property on 'HTMLOptionsCollection': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["length"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get selectedIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selectedIndex' called on an object that is not a valid instance of HTMLOptionsCollection." - ); - } - - return esValue[implSymbol]["selectedIndex"]; - } - - set selectedIndex(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set selectedIndex' called on an object that is not a valid instance of HTMLOptionsCollection." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'selectedIndex' property on 'HTMLOptionsCollection': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["selectedIndex"] = V; - } - } - Object.defineProperties(HTMLOptionsCollection.prototype, { - add: { enumerable: true }, - remove: { enumerable: true }, - length: { enumerable: true }, - selectedIndex: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLOptionsCollection", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = HTMLOptionsCollection; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLOptionsCollection - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(`${key}`); - } - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - const namedValue = target[implSymbol].namedItem(P); - - if (namedValue !== null && !(P in target) && !ignoreNamedProps) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - let indexedValue = V; - - if (indexedValue === null || indexedValue === undefined) { - indexedValue = null; - } else { - indexedValue = HTMLOptionElement.convert(globalObject, indexedValue, { - context: "Failed to set the " + index + " property on 'HTMLOptionsCollection': The provided value" - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const creating = !(target[implSymbol].item(index) !== null); - if (creating) { - target[implSymbol][utils.indexedSetNew](index, indexedValue); - } else { - target[implSymbol][utils.indexedSetExisting](index, indexedValue); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - - return true; - } - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - if (desc.get || desc.set) { - return false; - } - - const index = P >>> 0; - let indexedValue = desc.value; - - if (indexedValue === null || indexedValue === undefined) { - indexedValue = null; - } else { - indexedValue = HTMLOptionElement.convert(globalObject, indexedValue, { - context: "Failed to set the " + index + " property on 'HTMLOptionsCollection': The provided value" - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const creating = !(target[implSymbol].item(index) !== null); - if (creating) { - target[implSymbol][utils.indexedSetNew](index, indexedValue); - } else { - target[implSymbol][utils.indexedSetExisting](index, indexedValue); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - - return true; - } - if (!Object.hasOwn(target, P)) { - const creating = !(target[implSymbol].namedItem(P) !== null); - if (!creating) { - return false; - } - } - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - if (target[implSymbol].namedItem(P) !== null && !(P in target)) { - return false; - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../nodes/HTMLOptionsCollection-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOutputElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOutputElement.js deleted file mode 100644 index 00f3055..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLOutputElement.js +++ /dev/null @@ -1,392 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLOutputElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLOutputElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLOutputElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLOutputElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - checkValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'checkValidity' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - return esValue[implSymbol].checkValidity(); - } - - reportValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'reportValidity' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - return esValue[implSymbol].reportValidity(); - } - - setCustomValidity(error) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setCustomValidity' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setCustomValidity' on 'HTMLOutputElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setCustomValidity' on 'HTMLOutputElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setCustomValidity(...args); - } - - get htmlFor() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get htmlFor' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - return utils.getSameObject(this, "htmlFor", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["htmlFor"]); - }); - } - - set htmlFor(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set htmlFor' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - const Q = esValue["htmlFor"]; - if (!utils.isObject(Q)) { - throw new globalObject.TypeError("Property 'htmlFor' is not an object"); - } - Reflect.set(Q, "value", V); - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLOutputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - return esValue[implSymbol]["type"]; - } - - get defaultValue() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defaultValue' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["defaultValue"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set defaultValue(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set defaultValue' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'defaultValue' property on 'HTMLOutputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["defaultValue"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["value"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'HTMLOutputElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["value"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get willValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get willValidate' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - return esValue[implSymbol]["willValidate"]; - } - - get validity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validity' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["validity"]); - } - - get validationMessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validationMessage' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - return esValue[implSymbol]["validationMessage"]; - } - - get labels() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get labels' called on an object that is not a valid instance of HTMLOutputElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]); - } - } - Object.defineProperties(HTMLOutputElement.prototype, { - checkValidity: { enumerable: true }, - reportValidity: { enumerable: true }, - setCustomValidity: { enumerable: true }, - htmlFor: { enumerable: true }, - form: { enumerable: true }, - name: { enumerable: true }, - type: { enumerable: true }, - defaultValue: { enumerable: true }, - value: { enumerable: true }, - willValidate: { enumerable: true }, - validity: { enumerable: true }, - validationMessage: { enumerable: true }, - labels: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLOutputElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLOutputElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLOutputElement - }); -}; - -const Impl = require("../nodes/HTMLOutputElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLParagraphElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLParagraphElement.js deleted file mode 100644 index f68be7b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLParagraphElement.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLParagraphElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLParagraphElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLParagraphElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLParagraphElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLParagraphElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLParagraphElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLParagraphElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLParagraphElement.prototype, { - align: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLParagraphElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLParagraphElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLParagraphElement - }); -}; - -const Impl = require("../nodes/HTMLParagraphElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLParamElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLParamElement.js deleted file mode 100644 index 7eb04a9..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLParamElement.js +++ /dev/null @@ -1,276 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLParamElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLParamElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLParamElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLParamElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLParamElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLParamElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLParamElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLParamElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("value"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLParamElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'HTMLParamElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("value", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLParamElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLParamElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLParamElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get valueType() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get valueType' called on an object that is not a valid instance of HTMLParamElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("valuetype"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set valueType(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set valueType' called on an object that is not a valid instance of HTMLParamElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'valueType' property on 'HTMLParamElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("valuetype", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLParamElement.prototype, { - name: { enumerable: true }, - value: { enumerable: true }, - type: { enumerable: true }, - valueType: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLParamElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLParamElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLParamElement - }); -}; - -const Impl = require("../nodes/HTMLParamElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLPictureElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLPictureElement.js deleted file mode 100644 index 852d41e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLPictureElement.js +++ /dev/null @@ -1,110 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLPictureElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLPictureElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLPictureElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLPictureElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - } - Object.defineProperties(HTMLPictureElement.prototype, { - [Symbol.toStringTag]: { value: "HTMLPictureElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLPictureElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLPictureElement - }); -}; - -const Impl = require("../nodes/HTMLPictureElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLPreElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLPreElement.js deleted file mode 100644 index 784138f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLPreElement.js +++ /dev/null @@ -1,160 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const parseInteger_helpers_strings = require("../helpers/strings.js").parseInteger; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLPreElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLPreElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLPreElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLPreElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLPreElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - if (value !== null) { - value = parseInteger_helpers_strings(value); - if (value !== null && conversions.long(value) === value) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLPreElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'width' property on 'HTMLPreElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("width", String(V)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLPreElement.prototype, { - width: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLPreElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLPreElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLPreElement - }); -}; - -const Impl = require("../nodes/HTMLPreElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLProgressElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLProgressElement.js deleted file mode 100644 index b91b39f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLProgressElement.js +++ /dev/null @@ -1,228 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const parseFloatingPointNumber_helpers_strings = require("../helpers/strings.js").parseFloatingPointNumber; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLProgressElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLProgressElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLProgressElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLProgressElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLProgressElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["value"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLProgressElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'value' property on 'HTMLProgressElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["value"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get max() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get max' called on an object that is not a valid instance of HTMLProgressElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("max"); - if (value !== null) { - value = parseFloatingPointNumber_helpers_strings(value); - if (value !== null && value > 0) { - return value; - } - } - return 1; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set max(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set max' called on an object that is not a valid instance of HTMLProgressElement." - ); - } - - V = conversions["double"](V, { - context: "Failed to set the 'max' property on 'HTMLProgressElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V > 0) { - esValue[implSymbol]._reflectSetTheContentAttribute("max", String(V)); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get position() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get position' called on an object that is not a valid instance of HTMLProgressElement." - ); - } - - return esValue[implSymbol]["position"]; - } - - get labels() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get labels' called on an object that is not a valid instance of HTMLProgressElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]); - } - } - Object.defineProperties(HTMLProgressElement.prototype, { - value: { enumerable: true }, - max: { enumerable: true }, - position: { enumerable: true }, - labels: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLProgressElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLProgressElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLProgressElement - }); -}; - -const Impl = require("../nodes/HTMLProgressElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLQuoteElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLQuoteElement.js deleted file mode 100644 index 4ce1a72..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLQuoteElement.js +++ /dev/null @@ -1,173 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLQuoteElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLQuoteElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLQuoteElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLQuoteElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get cite() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cite' called on an object that is not a valid instance of HTMLQuoteElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("cite"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._citeURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._citeURLCache; - } - - this._citeURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._citeURLCache = serializeURLwhatwg_url(urlRecord); - return this._citeURLCache; - } - this._citeURLCache = conversions.USVString(value); - return this._citeURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set cite(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set cite' called on an object that is not a valid instance of HTMLQuoteElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'cite' property on 'HTMLQuoteElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("cite", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLQuoteElement.prototype, { - cite: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLQuoteElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLQuoteElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLQuoteElement - }); -}; - -const Impl = require("../nodes/HTMLQuoteElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLScriptElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLScriptElement.js deleted file mode 100644 index 76d8f7c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLScriptElement.js +++ /dev/null @@ -1,469 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLScriptElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLScriptElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLScriptElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLScriptElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get src() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get src' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("src"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._srcURLCache; - } - - this._srcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._srcURLCache = serializeURLwhatwg_url(urlRecord); - return this._srcURLCache; - } - this._srcURLCache = conversions.USVString(value); - return this._srcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set src(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set src' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'src' property on 'HTMLScriptElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("src", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLScriptElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get defer() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defer' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("defer") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set defer(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set defer' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'defer' property on 'HTMLScriptElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("defer", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("defer"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get crossOrigin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get crossOrigin' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("crossorigin"); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set crossOrigin(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set crossOrigin' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'crossOrigin' property on 'HTMLScriptElement': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V === null) { - esValue[implSymbol]._reflectDeleteTheContentAttribute("crossorigin"); - } else { - esValue[implSymbol]._reflectSetTheContentAttribute("crossorigin", V); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get text() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get text' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["text"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set text(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set text' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'text' property on 'HTMLScriptElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["text"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get charset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get charset' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("charset"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set charset(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set charset' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'charset' property on 'HTMLScriptElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("charset", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get event() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get event' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("event"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set event(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set event' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'event' property on 'HTMLScriptElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("event", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get htmlFor() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get htmlFor' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("for"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set htmlFor(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set htmlFor' called on an object that is not a valid instance of HTMLScriptElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'htmlFor' property on 'HTMLScriptElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("for", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLScriptElement.prototype, { - src: { enumerable: true }, - type: { enumerable: true }, - defer: { enumerable: true }, - crossOrigin: { enumerable: true }, - text: { enumerable: true }, - charset: { enumerable: true }, - event: { enumerable: true }, - htmlFor: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLScriptElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLScriptElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLScriptElement - }); -}; - -const Impl = require("../nodes/HTMLScriptElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSelectElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSelectElement.js deleted file mode 100644 index 1504b2f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSelectElement.js +++ /dev/null @@ -1,989 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const HTMLOptionElement = require("./HTMLOptionElement.js"); -const HTMLOptGroupElement = require("./HTMLOptGroupElement.js"); -const HTMLElement = require("./HTMLElement.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "HTMLSelectElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLSelectElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLSelectElement"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLSelectElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'item' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'HTMLSelectElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'HTMLSelectElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); - } - - namedItem(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'namedItem' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'namedItem' on 'HTMLSelectElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'namedItem' on 'HTMLSelectElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].namedItem(...args)); - } - - add(element) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'add' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'add' on 'HTMLSelectElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (HTMLOptionElement.is(curArg) || HTMLOptGroupElement.is(curArg)) { - curArg = utils.implForWrapper(curArg); - } else { - throw new globalObject.TypeError( - "Failed to execute 'add' on 'HTMLSelectElement': parameter 1" + " is not of any supported type." - ); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - if (HTMLElement.is(curArg)) { - curArg = utils.implForWrapper(curArg); - } else if (typeof curArg === "number") { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'add' on 'HTMLSelectElement': parameter 2", - globals: globalObject - }); - } else { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'add' on 'HTMLSelectElement': parameter 2", - globals: globalObject - }); - } - } - } else { - curArg = null; - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].add(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - remove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'remove' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - const args = []; - switch (arguments.length) { - case 0: - break; - default: { - let curArg = arguments[0]; - curArg = conversions["long"](curArg, { - context: "Failed to execute 'remove' on 'HTMLSelectElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].remove(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - checkValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'checkValidity' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return esValue[implSymbol].checkValidity(); - } - - reportValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'reportValidity' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return esValue[implSymbol].reportValidity(); - } - - setCustomValidity(error) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setCustomValidity' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setCustomValidity' on 'HTMLSelectElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setCustomValidity' on 'HTMLSelectElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setCustomValidity(...args); - } - - get autofocus() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get autofocus' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("autofocus") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set autofocus(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set autofocus' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'autofocus' property on 'HTMLSelectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("autofocus", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("autofocus"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get disabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get disabled' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("disabled") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set disabled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set disabled' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'disabled' property on 'HTMLSelectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("disabled", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("disabled"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get multiple() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get multiple' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("multiple") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set multiple(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set multiple' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'multiple' property on 'HTMLSelectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("multiple", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("multiple"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLSelectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get required() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get required' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("required") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set required(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set required' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'required' property on 'HTMLSelectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("required", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("required"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get size() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get size' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("size"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set size(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set size' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'size' property on 'HTMLSelectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("size", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return esValue[implSymbol]["type"]; - } - - get options() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get options' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return utils.getSameObject(this, "options", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["options"]); - }); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["length"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set length(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set length' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'length' property on 'HTMLSelectElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["length"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get selectedOptions() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selectedOptions' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return utils.getSameObject(this, "selectedOptions", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["selectedOptions"]); - }); - } - - get selectedIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selectedIndex' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return esValue[implSymbol]["selectedIndex"]; - } - - set selectedIndex(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set selectedIndex' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'selectedIndex' property on 'HTMLSelectElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["selectedIndex"] = V; - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return esValue[implSymbol]["value"]; - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'HTMLSelectElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["value"] = V; - } - - get willValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get willValidate' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return esValue[implSymbol]["willValidate"]; - } - - get validity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validity' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["validity"]); - } - - get validationMessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validationMessage' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return esValue[implSymbol]["validationMessage"]; - } - - get labels() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get labels' called on an object that is not a valid instance of HTMLSelectElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]); - } - } - Object.defineProperties(HTMLSelectElement.prototype, { - item: { enumerable: true }, - namedItem: { enumerable: true }, - add: { enumerable: true }, - remove: { enumerable: true }, - checkValidity: { enumerable: true }, - reportValidity: { enumerable: true }, - setCustomValidity: { enumerable: true }, - autofocus: { enumerable: true }, - disabled: { enumerable: true }, - form: { enumerable: true }, - multiple: { enumerable: true }, - name: { enumerable: true }, - required: { enumerable: true }, - size: { enumerable: true }, - type: { enumerable: true }, - options: { enumerable: true }, - length: { enumerable: true }, - selectedOptions: { enumerable: true }, - selectedIndex: { enumerable: true }, - value: { enumerable: true }, - willValidate: { enumerable: true }, - validity: { enumerable: true }, - validationMessage: { enumerable: true }, - labels: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLSelectElement", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = HTMLSelectElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLSelectElement - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - let indexedValue = V; - - if (indexedValue === null || indexedValue === undefined) { - indexedValue = null; - } else { - indexedValue = HTMLOptionElement.convert(globalObject, indexedValue, { - context: "Failed to set the " + index + " property on 'HTMLSelectElement': The provided value" - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const creating = !(target[implSymbol].item(index) !== null); - if (creating) { - target[implSymbol][utils.indexedSetNew](index, indexedValue); - } else { - target[implSymbol][utils.indexedSetExisting](index, indexedValue); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - - return true; - } - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - if (desc.get || desc.set) { - return false; - } - - const index = P >>> 0; - let indexedValue = desc.value; - - if (indexedValue === null || indexedValue === undefined) { - indexedValue = null; - } else { - indexedValue = HTMLOptionElement.convert(globalObject, indexedValue, { - context: "Failed to set the " + index + " property on 'HTMLSelectElement': The provided value" - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const creating = !(target[implSymbol].item(index) !== null); - if (creating) { - target[implSymbol][utils.indexedSetNew](index, indexedValue); - } else { - target[implSymbol][utils.indexedSetExisting](index, indexedValue); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - - return true; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../nodes/HTMLSelectElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSlotElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSlotElement.js deleted file mode 100644 index 5dbf55f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSlotElement.js +++ /dev/null @@ -1,192 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const AssignedNodesOptions = require("./AssignedNodesOptions.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLSlotElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLSlotElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLSlotElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLSlotElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - assignedNodes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'assignedNodes' called on an object that is not a valid instance of HTMLSlotElement." - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = AssignedNodesOptions.convert(globalObject, curArg, { - context: "Failed to execute 'assignedNodes' on 'HTMLSlotElement': parameter 1" - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].assignedNodes(...args)); - } - - assignedElements() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'assignedElements' called on an object that is not a valid instance of HTMLSlotElement." - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = AssignedNodesOptions.convert(globalObject, curArg, { - context: "Failed to execute 'assignedElements' on 'HTMLSlotElement': parameter 1" - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].assignedElements(...args)); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLSlotElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLSlotElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLSlotElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLSlotElement.prototype, { - assignedNodes: { enumerable: true }, - assignedElements: { enumerable: true }, - name: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLSlotElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLSlotElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLSlotElement - }); -}; - -const Impl = require("../nodes/HTMLSlotElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSourceElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSourceElement.js deleted file mode 100644 index 9752486..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSourceElement.js +++ /dev/null @@ -1,337 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLSourceElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLSourceElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLSourceElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLSourceElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get src() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get src' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("src"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._srcURLCache; - } - - this._srcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._srcURLCache = serializeURLwhatwg_url(urlRecord); - return this._srcURLCache; - } - this._srcURLCache = conversions.USVString(value); - return this._srcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set src(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set src' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'src' property on 'HTMLSourceElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("src", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLSourceElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get srcset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get srcset' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("srcset"); - return value === null ? "" : conversions.USVString(value); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set srcset(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set srcset' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'srcset' property on 'HTMLSourceElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("srcset", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get sizes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get sizes' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("sizes"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set sizes(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set sizes' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'sizes' property on 'HTMLSourceElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("sizes", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get media() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get media' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("media"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set media(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set media' called on an object that is not a valid instance of HTMLSourceElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'media' property on 'HTMLSourceElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("media", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLSourceElement.prototype, { - src: { enumerable: true }, - type: { enumerable: true }, - srcset: { enumerable: true }, - sizes: { enumerable: true }, - media: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLSourceElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLSourceElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLSourceElement - }); -}; - -const Impl = require("../nodes/HTMLSourceElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSpanElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSpanElement.js deleted file mode 100644 index db00caa..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLSpanElement.js +++ /dev/null @@ -1,110 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLSpanElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLSpanElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLSpanElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLSpanElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - } - Object.defineProperties(HTMLSpanElement.prototype, { - [Symbol.toStringTag]: { value: "HTMLSpanElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLSpanElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLSpanElement - }); -}; - -const Impl = require("../nodes/HTMLSpanElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLStyleElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLStyleElement.js deleted file mode 100644 index 77ea37d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLStyleElement.js +++ /dev/null @@ -1,207 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLStyleElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLStyleElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLStyleElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLStyleElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get media() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get media' called on an object that is not a valid instance of HTMLStyleElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("media"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set media(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set media' called on an object that is not a valid instance of HTMLStyleElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'media' property on 'HTMLStyleElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("media", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLStyleElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLStyleElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLStyleElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get sheet() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get sheet' called on an object that is not a valid instance of HTMLStyleElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["sheet"]); - } - } - Object.defineProperties(HTMLStyleElement.prototype, { - media: { enumerable: true }, - type: { enumerable: true }, - sheet: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLStyleElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLStyleElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLStyleElement - }); -}; - -const Impl = require("../nodes/HTMLStyleElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableCaptionElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableCaptionElement.js deleted file mode 100644 index c3f7ac5..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableCaptionElement.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTableCaptionElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTableCaptionElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTableCaptionElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTableCaptionElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLTableCaptionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLTableCaptionElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLTableCaptionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLTableCaptionElement.prototype, { - align: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTableCaptionElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTableCaptionElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTableCaptionElement - }); -}; - -const Impl = require("../nodes/HTMLTableCaptionElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableCellElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableCellElement.js deleted file mode 100644 index f3eea94..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableCellElement.js +++ /dev/null @@ -1,729 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTableCellElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTableCellElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTableCellElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTableCellElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get colSpan() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get colSpan' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("colspan"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null) { - if (value < 1) { - return 1; - } else if (value >= 1 && value <= 1000) { - return value; - } else { - return 1000; - } - } - } - return 1; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set colSpan(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set colSpan' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'colSpan' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 1; - esValue[implSymbol]._reflectSetTheContentAttribute("colspan", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rowSpan() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rowSpan' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("rowspan"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null) { - if (value < 0) { - return 0; - } else if (value >= 0 && value <= 65534) { - return value; - } else { - return 65534; - } - } - } - return 1; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set rowSpan(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set rowSpan' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'rowSpan' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 1; - esValue[implSymbol]._reflectSetTheContentAttribute("rowspan", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get headers() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get headers' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("headers"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set headers(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set headers' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'headers' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("headers", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get cellIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cellIndex' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - return esValue[implSymbol]["cellIndex"]; - } - - get scope() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get scope' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["scope"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set scope(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set scope' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'scope' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["scope"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get abbr() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get abbr' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("abbr"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set abbr(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set abbr' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'abbr' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("abbr", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get axis() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get axis' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("axis"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set axis(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set axis' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'axis' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("axis", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("height"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set height' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'height' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("height", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'width' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("width", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ch' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("char"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ch(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ch' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'ch' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("char", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get chOff() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get chOff' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("charoff"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set chOff(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set chOff' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'chOff' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("charoff", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get noWrap() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get noWrap' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("nowrap") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set noWrap(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set noWrap' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'noWrap' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("nowrap", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("nowrap"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get vAlign() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get vAlign' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("valign"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set vAlign(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set vAlign' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'vAlign' property on 'HTMLTableCellElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("valign", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get bgColor() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get bgColor' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("bgcolor"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set bgColor(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set bgColor' called on an object that is not a valid instance of HTMLTableCellElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'bgColor' property on 'HTMLTableCellElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("bgcolor", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLTableCellElement.prototype, { - colSpan: { enumerable: true }, - rowSpan: { enumerable: true }, - headers: { enumerable: true }, - cellIndex: { enumerable: true }, - scope: { enumerable: true }, - abbr: { enumerable: true }, - align: { enumerable: true }, - axis: { enumerable: true }, - height: { enumerable: true }, - width: { enumerable: true }, - ch: { enumerable: true }, - chOff: { enumerable: true }, - noWrap: { enumerable: true }, - vAlign: { enumerable: true }, - bgColor: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTableCellElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTableCellElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTableCellElement - }); -}; - -const Impl = require("../nodes/HTMLTableCellElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableColElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableColElement.js deleted file mode 100644 index 3652625..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableColElement.js +++ /dev/null @@ -1,372 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTableColElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTableColElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTableColElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTableColElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get span() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get span' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("span"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null) { - if (value < 1) { - return 1; - } else if (value >= 1 && value <= 1000) { - return value; - } else { - return 1000; - } - } - } - return 1; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set span(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set span' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'span' property on 'HTMLTableColElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 1; - esValue[implSymbol]._reflectSetTheContentAttribute("span", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLTableColElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ch' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("char"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ch(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ch' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'ch' property on 'HTMLTableColElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("char", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get chOff() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get chOff' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("charoff"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set chOff(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set chOff' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'chOff' property on 'HTMLTableColElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("charoff", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get vAlign() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get vAlign' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("valign"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set vAlign(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set vAlign' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'vAlign' property on 'HTMLTableColElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("valign", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLTableColElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'width' property on 'HTMLTableColElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("width", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLTableColElement.prototype, { - span: { enumerable: true }, - align: { enumerable: true }, - ch: { enumerable: true }, - chOff: { enumerable: true }, - vAlign: { enumerable: true }, - width: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTableColElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTableColElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTableColElement - }); -}; - -const Impl = require("../nodes/HTMLTableColElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableElement.js deleted file mode 100644 index d9ff73b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableElement.js +++ /dev/null @@ -1,799 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const HTMLTableCaptionElement = require("./HTMLTableCaptionElement.js"); -const HTMLTableSectionElement = require("./HTMLTableSectionElement.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTableElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTableElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTableElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTableElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - createCaption() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createCaption' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].createCaption()); - } - - deleteCaption() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'deleteCaption' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].deleteCaption(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - createTHead() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createTHead' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].createTHead()); - } - - deleteTHead() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'deleteTHead' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].deleteTHead(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - createTFoot() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createTFoot' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].createTFoot()); - } - - deleteTFoot() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'deleteTFoot' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].deleteTFoot(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - createTBody() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createTBody' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].createTBody()); - } - - insertRow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'insertRow' called on an object that is not a valid instance of HTMLTableElement." - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'insertRow' on 'HTMLTableElement': parameter 1", - globals: globalObject - }); - } else { - curArg = -1; - } - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].insertRow(...args)); - } - - deleteRow(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'deleteRow' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'deleteRow' on 'HTMLTableElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["long"](curArg, { - context: "Failed to execute 'deleteRow' on 'HTMLTableElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].deleteRow(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get caption() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get caption' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol]["caption"]); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set caption(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set caption' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = HTMLTableCaptionElement.convert(globalObject, V, { - context: "Failed to set the 'caption' property on 'HTMLTableElement': The provided value" - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["caption"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get tHead() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tHead' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol]["tHead"]); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set tHead(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set tHead' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = HTMLTableSectionElement.convert(globalObject, V, { - context: "Failed to set the 'tHead' property on 'HTMLTableElement': The provided value" - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["tHead"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get tFoot() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tFoot' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol]["tFoot"]); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set tFoot(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set tFoot' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = HTMLTableSectionElement.convert(globalObject, V, { - context: "Failed to set the 'tFoot' property on 'HTMLTableElement': The provided value" - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["tFoot"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get tBodies() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tBodies' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - return utils.getSameObject(this, "tBodies", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["tBodies"]); - }); - } - - get rows() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rows' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - return utils.getSameObject(this, "rows", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["rows"]); - }); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLTableElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get border() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get border' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("border"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set border(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set border' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'border' property on 'HTMLTableElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("border", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get frame() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get frame' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("frame"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set frame(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set frame' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'frame' property on 'HTMLTableElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("frame", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rules() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rules' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("rules"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set rules(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set rules' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'rules' property on 'HTMLTableElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("rules", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get summary() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get summary' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("summary"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set summary(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set summary' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'summary' property on 'HTMLTableElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("summary", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'width' property on 'HTMLTableElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("width", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get bgColor() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get bgColor' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("bgcolor"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set bgColor(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set bgColor' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'bgColor' property on 'HTMLTableElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("bgcolor", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get cellPadding() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cellPadding' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("cellpadding"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set cellPadding(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set cellPadding' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'cellPadding' property on 'HTMLTableElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("cellpadding", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get cellSpacing() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cellSpacing' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("cellspacing"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set cellSpacing(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set cellSpacing' called on an object that is not a valid instance of HTMLTableElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'cellSpacing' property on 'HTMLTableElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("cellspacing", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLTableElement.prototype, { - createCaption: { enumerable: true }, - deleteCaption: { enumerable: true }, - createTHead: { enumerable: true }, - deleteTHead: { enumerable: true }, - createTFoot: { enumerable: true }, - deleteTFoot: { enumerable: true }, - createTBody: { enumerable: true }, - insertRow: { enumerable: true }, - deleteRow: { enumerable: true }, - caption: { enumerable: true }, - tHead: { enumerable: true }, - tFoot: { enumerable: true }, - tBodies: { enumerable: true }, - rows: { enumerable: true }, - align: { enumerable: true }, - border: { enumerable: true }, - frame: { enumerable: true }, - rules: { enumerable: true }, - summary: { enumerable: true }, - width: { enumerable: true }, - bgColor: { enumerable: true }, - cellPadding: { enumerable: true }, - cellSpacing: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTableElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTableElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTableElement - }); -}; - -const Impl = require("../nodes/HTMLTableElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableRowElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableRowElement.js deleted file mode 100644 index 888c00c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableRowElement.js +++ /dev/null @@ -1,414 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTableRowElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTableRowElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTableRowElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTableRowElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - insertCell() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'insertCell' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'insertCell' on 'HTMLTableRowElement': parameter 1", - globals: globalObject - }); - } else { - curArg = -1; - } - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].insertCell(...args)); - } - - deleteCell(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'deleteCell' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'deleteCell' on 'HTMLTableRowElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["long"](curArg, { - context: "Failed to execute 'deleteCell' on 'HTMLTableRowElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].deleteCell(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rowIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rowIndex' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - return esValue[implSymbol]["rowIndex"]; - } - - get sectionRowIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get sectionRowIndex' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - return esValue[implSymbol]["sectionRowIndex"]; - } - - get cells() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cells' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - return utils.getSameObject(this, "cells", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["cells"]); - }); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLTableRowElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ch' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("char"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ch(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ch' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'ch' property on 'HTMLTableRowElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("char", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get chOff() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get chOff' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("charoff"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set chOff(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set chOff' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'chOff' property on 'HTMLTableRowElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("charoff", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get vAlign() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get vAlign' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("valign"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set vAlign(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set vAlign' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'vAlign' property on 'HTMLTableRowElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("valign", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get bgColor() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get bgColor' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("bgcolor"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set bgColor(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set bgColor' called on an object that is not a valid instance of HTMLTableRowElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'bgColor' property on 'HTMLTableRowElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("bgcolor", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLTableRowElement.prototype, { - insertCell: { enumerable: true }, - deleteCell: { enumerable: true }, - rowIndex: { enumerable: true }, - sectionRowIndex: { enumerable: true }, - cells: { enumerable: true }, - align: { enumerable: true }, - ch: { enumerable: true }, - chOff: { enumerable: true }, - vAlign: { enumerable: true }, - bgColor: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTableRowElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTableRowElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTableRowElement - }); -}; - -const Impl = require("../nodes/HTMLTableRowElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableSectionElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableSectionElement.js deleted file mode 100644 index 2a454d9..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableSectionElement.js +++ /dev/null @@ -1,346 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTableSectionElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTableSectionElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTableSectionElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTableSectionElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - insertRow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'insertRow' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'insertRow' on 'HTMLTableSectionElement': parameter 1", - globals: globalObject - }); - } else { - curArg = -1; - } - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].insertRow(...args)); - } - - deleteRow(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'deleteRow' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'deleteRow' on 'HTMLTableSectionElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["long"](curArg, { - context: "Failed to execute 'deleteRow' on 'HTMLTableSectionElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].deleteRow(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rows() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rows' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - return utils.getSameObject(this, "rows", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["rows"]); - }); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("align"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'align' property on 'HTMLTableSectionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("align", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get ch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ch' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("char"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set ch(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ch' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'ch' property on 'HTMLTableSectionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("char", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get chOff() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get chOff' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("charoff"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set chOff(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set chOff' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'chOff' property on 'HTMLTableSectionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("charoff", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get vAlign() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get vAlign' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("valign"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set vAlign(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set vAlign' called on an object that is not a valid instance of HTMLTableSectionElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'vAlign' property on 'HTMLTableSectionElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("valign", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLTableSectionElement.prototype, { - insertRow: { enumerable: true }, - deleteRow: { enumerable: true }, - rows: { enumerable: true }, - align: { enumerable: true }, - ch: { enumerable: true }, - chOff: { enumerable: true }, - vAlign: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTableSectionElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTableSectionElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTableSectionElement - }); -}; - -const Impl = require("../nodes/HTMLTableSectionElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTemplateElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTemplateElement.js deleted file mode 100644 index e77280c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTemplateElement.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTemplateElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTemplateElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTemplateElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTemplateElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get content() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get content' called on an object that is not a valid instance of HTMLTemplateElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["content"]); - } - } - Object.defineProperties(HTMLTemplateElement.prototype, { - content: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTemplateElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTemplateElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTemplateElement - }); -}; - -const Impl = require("../nodes/HTMLTemplateElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTextAreaElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTextAreaElement.js deleted file mode 100644 index cd72c7b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTextAreaElement.js +++ /dev/null @@ -1,1206 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const SelectionMode = require("./SelectionMode.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; -const create_DOMException = require("./DOMException.js").create; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTextAreaElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTextAreaElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTextAreaElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTextAreaElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - checkValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'checkValidity' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol].checkValidity(); - } - - reportValidity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'reportValidity' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol].reportValidity(); - } - - setCustomValidity(error) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setCustomValidity' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setCustomValidity' on 'HTMLTextAreaElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setCustomValidity' on 'HTMLTextAreaElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setCustomValidity(...args); - } - - select() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'select' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol].select(); - } - - setRangeText(replacement) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setRangeText' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setRangeText' on 'HTMLTextAreaElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - switch (arguments.length) { - case 1: - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - break; - case 2: - throw new globalObject.TypeError( - `Failed to execute 'setRangeText' on 'HTMLTextAreaElement': only ${arguments.length} arguments present.` - ); - break; - case 3: - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - break; - default: - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - curArg = SelectionMode.convert(globalObject, curArg, { - context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 4" - }); - } else { - curArg = "preserve"; - } - args.push(curArg); - } - } - return esValue[implSymbol].setRangeText(...args); - } - - setSelectionRange(start, end) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setSelectionRange' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': parameter 3", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].setSelectionRange(...args); - } - - get autocomplete() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get autocomplete' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("autocomplete"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set autocomplete(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set autocomplete' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'autocomplete' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("autocomplete", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get autofocus() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get autofocus' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("autofocus") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set autofocus(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set autofocus' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'autofocus' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("autofocus", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("autofocus"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get cols() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cols' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("cols"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 1 && value <= 2147483647) { - return value; - } - } - return 20; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set cols(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set cols' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'cols' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 1 ? V : 20; - esValue[implSymbol]._reflectSetTheContentAttribute("cols", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get dirName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get dirName' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("dirname"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set dirName(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set dirName' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'dirName' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("dirname", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get disabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get disabled' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("disabled") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set disabled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set disabled' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'disabled' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("disabled", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("disabled"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get form() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get form' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["form"]); - } - - get inputMode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get inputMode' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("inputmode"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set inputMode(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set inputMode' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'inputMode' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("inputmode", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get maxLength() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get maxLength' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("maxlength"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && conversions.long(value) === value) { - return value; - } - } - return -1; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set maxLength(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set maxLength' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'maxLength' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V < 0) { - throw create_DOMException(globalObject, [ - `The negative value ${V} cannot be set for the maxLength property.`, - "IndexSizeError" - ]); - } - - esValue[implSymbol]._reflectSetTheContentAttribute("maxlength", String(V)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get minLength() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get minLength' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("minlength"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && conversions.long(value) === value) { - return value; - } - } - return -1; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set minLength(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set minLength' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'minLength' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V < 0) { - throw create_DOMException(globalObject, [ - `The negative value ${V} cannot be set for the minLength property.`, - "IndexSizeError" - ]); - } - - esValue[implSymbol]._reflectSetTheContentAttribute("minlength", String(V)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get name' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("name"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set name(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set name' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'name' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("name", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get placeholder() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get placeholder' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("placeholder"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set placeholder(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set placeholder' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'placeholder' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("placeholder", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get readOnly() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get readOnly' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("readonly") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set readOnly(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set readOnly' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'readOnly' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("readonly", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("readonly"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get required() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get required' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("required") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set required(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set required' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'required' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("required", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("required"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get rows() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rows' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("rows"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 1 && value <= 2147483647) { - return value; - } - } - return 2; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set rows(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set rows' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'rows' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 1 ? V : 2; - esValue[implSymbol]._reflectSetTheContentAttribute("rows", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get wrap() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get wrap' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("wrap"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set wrap(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set wrap' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'wrap' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("wrap", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol]["type"]; - } - - get defaultValue() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get defaultValue' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["defaultValue"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set defaultValue(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set defaultValue' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'defaultValue' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["defaultValue"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["value"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["value"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get textLength() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get textLength' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol]["textLength"]; - } - - get willValidate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get willValidate' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol]["willValidate"]; - } - - get validity() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validity' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["validity"]); - } - - get validationMessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get validationMessage' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol]["validationMessage"]; - } - - get labels() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get labels' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]); - } - - get selectionStart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selectionStart' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol]["selectionStart"]; - } - - set selectionStart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set selectionStart' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'selectionStart' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["selectionStart"] = V; - } - - get selectionEnd() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selectionEnd' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol]["selectionEnd"]; - } - - set selectionEnd(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set selectionEnd' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'selectionEnd' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["selectionEnd"] = V; - } - - get selectionDirection() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get selectionDirection' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - return esValue[implSymbol]["selectionDirection"]; - } - - set selectionDirection(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set selectionDirection' called on an object that is not a valid instance of HTMLTextAreaElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'selectionDirection' property on 'HTMLTextAreaElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["selectionDirection"] = V; - } - } - Object.defineProperties(HTMLTextAreaElement.prototype, { - checkValidity: { enumerable: true }, - reportValidity: { enumerable: true }, - setCustomValidity: { enumerable: true }, - select: { enumerable: true }, - setRangeText: { enumerable: true }, - setSelectionRange: { enumerable: true }, - autocomplete: { enumerable: true }, - autofocus: { enumerable: true }, - cols: { enumerable: true }, - dirName: { enumerable: true }, - disabled: { enumerable: true }, - form: { enumerable: true }, - inputMode: { enumerable: true }, - maxLength: { enumerable: true }, - minLength: { enumerable: true }, - name: { enumerable: true }, - placeholder: { enumerable: true }, - readOnly: { enumerable: true }, - required: { enumerable: true }, - rows: { enumerable: true }, - wrap: { enumerable: true }, - type: { enumerable: true }, - defaultValue: { enumerable: true }, - value: { enumerable: true }, - textLength: { enumerable: true }, - willValidate: { enumerable: true }, - validity: { enumerable: true }, - validationMessage: { enumerable: true }, - labels: { enumerable: true }, - selectionStart: { enumerable: true }, - selectionEnd: { enumerable: true }, - selectionDirection: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTextAreaElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTextAreaElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTextAreaElement - }); -}; - -const Impl = require("../nodes/HTMLTextAreaElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTimeElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTimeElement.js deleted file mode 100644 index add13b0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTimeElement.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTimeElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTimeElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTimeElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTimeElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get dateTime() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get dateTime' called on an object that is not a valid instance of HTMLTimeElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("datetime"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set dateTime(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set dateTime' called on an object that is not a valid instance of HTMLTimeElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'dateTime' property on 'HTMLTimeElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("datetime", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLTimeElement.prototype, { - dateTime: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTimeElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTimeElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTimeElement - }); -}; - -const Impl = require("../nodes/HTMLTimeElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTitleElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTitleElement.js deleted file mode 100644 index 372965b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTitleElement.js +++ /dev/null @@ -1,152 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTitleElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTitleElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTitleElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTitleElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get text() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get text' called on an object that is not a valid instance of HTMLTitleElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["text"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set text(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set text' called on an object that is not a valid instance of HTMLTitleElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'text' property on 'HTMLTitleElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["text"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLTitleElement.prototype, { - text: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTitleElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLTitleElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTitleElement - }); -}; - -const Impl = require("../nodes/HTMLTitleElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTrackElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTrackElement.js deleted file mode 100644 index 9c81fec..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLTrackElement.js +++ /dev/null @@ -1,363 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLTrackElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLTrackElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLTrackElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLTrackElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get kind() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get kind' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("kind"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set kind(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set kind' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'kind' property on 'HTMLTrackElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("kind", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get src() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get src' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("src"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._srcURLCache; - } - - this._srcURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._srcURLCache = serializeURLwhatwg_url(urlRecord); - return this._srcURLCache; - } - this._srcURLCache = conversions.USVString(value); - return this._srcURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set src(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set src' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'src' property on 'HTMLTrackElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("src", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get srclang() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get srclang' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("srclang"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set srclang(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set srclang' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'srclang' property on 'HTMLTrackElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("srclang", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get label() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get label' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("label"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set label(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set label' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'label' property on 'HTMLTrackElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("label", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get default() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get default' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("default") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set default(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set default' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'default' property on 'HTMLTrackElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("default", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("default"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get readyState() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get readyState' called on an object that is not a valid instance of HTMLTrackElement." - ); - } - - return esValue[implSymbol]["readyState"]; - } - } - Object.defineProperties(HTMLTrackElement.prototype, { - kind: { enumerable: true }, - src: { enumerable: true }, - srclang: { enumerable: true }, - label: { enumerable: true }, - default: { enumerable: true }, - readyState: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLTrackElement", configurable: true }, - NONE: { value: 0, enumerable: true }, - LOADING: { value: 1, enumerable: true }, - LOADED: { value: 2, enumerable: true }, - ERROR: { value: 3, enumerable: true } - }); - Object.defineProperties(HTMLTrackElement, { - NONE: { value: 0, enumerable: true }, - LOADING: { value: 1, enumerable: true }, - LOADED: { value: 2, enumerable: true }, - ERROR: { value: 3, enumerable: true } - }); - ctorRegistry[interfaceName] = HTMLTrackElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLTrackElement - }); -}; - -const Impl = require("../nodes/HTMLTrackElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLUListElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLUListElement.js deleted file mode 100644 index 2375c4c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLUListElement.js +++ /dev/null @@ -1,197 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLUListElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLUListElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLUListElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLUListElement extends globalObject.HTMLElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get compact() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get compact' called on an object that is not a valid instance of HTMLUListElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("compact") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set compact(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set compact' called on an object that is not a valid instance of HTMLUListElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'compact' property on 'HTMLUListElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("compact", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("compact"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of HTMLUListElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const value = esValue[implSymbol]._reflectGetTheContentAttribute("type"); - return value === null ? "" : value; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set type(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set type' called on an object that is not a valid instance of HTMLUListElement." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'type' property on 'HTMLUListElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("type", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLUListElement.prototype, { - compact: { enumerable: true }, - type: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLUListElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLUListElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLUListElement - }); -}; - -const Impl = require("../nodes/HTMLUListElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLUnknownElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLUnknownElement.js deleted file mode 100644 index fb56afe..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLUnknownElement.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLElement = require("./HTMLElement.js"); - -const interfaceName = "HTMLUnknownElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLUnknownElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLUnknownElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLUnknownElement extends globalObject.HTMLElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(HTMLUnknownElement.prototype, { - [Symbol.toStringTag]: { value: "HTMLUnknownElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLUnknownElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLUnknownElement - }); -}; - -const Impl = require("../nodes/HTMLUnknownElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLVideoElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLVideoElement.js deleted file mode 100644 index bb95807..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HTMLVideoElement.js +++ /dev/null @@ -1,340 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; -const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const serializeURLwhatwg_url = require("whatwg-url").serializeURL; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const HTMLMediaElement = require("./HTMLMediaElement.js"); - -const interfaceName = "HTMLVideoElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HTMLVideoElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HTMLVideoElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - HTMLMediaElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HTMLVideoElement extends globalObject.HTMLMediaElement { - constructor() { - return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set width' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'width' property on 'HTMLVideoElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("width", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - let value = esValue[implSymbol]._reflectGetTheContentAttribute("height"); - if (value !== null) { - value = parseNonNegativeInteger_helpers_strings(value); - if (value !== null && value >= 0 && value <= 2147483647) { - return value; - } - } - return 0; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set height' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'height' property on 'HTMLVideoElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const newValue = V <= 2147483647 && V >= 0 ? V : 0; - esValue[implSymbol]._reflectSetTheContentAttribute("height", String(newValue)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get videoWidth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get videoWidth' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - return esValue[implSymbol]["videoWidth"]; - } - - get videoHeight() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get videoHeight' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - return esValue[implSymbol]["videoHeight"]; - } - - get poster() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get poster' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - const impl = esValue[implSymbol]; - const value = impl._reflectGetTheContentAttribute("poster"); - if (value === null) { - return ""; - } - - const document = impl._ownerDocument; - if (this._posterURLCacheKey === value && this._baseURLCache === document._baseURLCache) { - return this._posterURLCache; - } - - this._posterURLCacheKey = value; - this._baseURLCache = document._baseURLCache; - - const urlRecord = document.encodingParseAURL(value); - if (urlRecord !== null) { - this._posterURLCache = serializeURLwhatwg_url(urlRecord); - return this._posterURLCache; - } - this._posterURLCache = conversions.USVString(value); - return this._posterURLCache; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set poster(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set poster' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'poster' property on 'HTMLVideoElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]._reflectSetTheContentAttribute("poster", V); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get playsInline() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get playsInline' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]._reflectGetTheContentAttribute("playsinline") !== null; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set playsInline(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set playsInline' called on an object that is not a valid instance of HTMLVideoElement." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'playsInline' property on 'HTMLVideoElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - if (V) { - esValue[implSymbol]._reflectSetTheContentAttribute("playsinline", ""); - } else { - esValue[implSymbol]._reflectDeleteTheContentAttribute("playsinline"); - } - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(HTMLVideoElement.prototype, { - width: { enumerable: true }, - height: { enumerable: true }, - videoWidth: { enumerable: true }, - videoHeight: { enumerable: true }, - poster: { enumerable: true }, - playsInline: { enumerable: true }, - [Symbol.toStringTag]: { value: "HTMLVideoElement", configurable: true } - }); - ctorRegistry[interfaceName] = HTMLVideoElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HTMLVideoElement - }); -}; - -const Impl = require("../nodes/HTMLVideoElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HashChangeEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HashChangeEvent.js deleted file mode 100644 index cb31e42..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HashChangeEvent.js +++ /dev/null @@ -1,157 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HashChangeEventInit = require("./HashChangeEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "HashChangeEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'HashChangeEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["HashChangeEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class HashChangeEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'HashChangeEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'HashChangeEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = HashChangeEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'HashChangeEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get oldURL() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oldURL' called on an object that is not a valid instance of HashChangeEvent." - ); - } - - return esValue[implSymbol]["oldURL"]; - } - - get newURL() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get newURL' called on an object that is not a valid instance of HashChangeEvent." - ); - } - - return esValue[implSymbol]["newURL"]; - } - } - Object.defineProperties(HashChangeEvent.prototype, { - oldURL: { enumerable: true }, - newURL: { enumerable: true }, - [Symbol.toStringTag]: { value: "HashChangeEvent", configurable: true } - }); - ctorRegistry[interfaceName] = HashChangeEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: HashChangeEvent - }); -}; - -const Impl = require("../events/HashChangeEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HashChangeEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HashChangeEventInit.js deleted file mode 100644 index 8bce20d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/HashChangeEventInit.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "newURL"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["USVString"](value, { - context: context + " has member 'newURL' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "oldURL"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["USVString"](value, { - context: context + " has member 'oldURL' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Headers.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Headers.js deleted file mode 100644 index 9826948..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Headers.js +++ /dev/null @@ -1,418 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Function = require("./Function.js"); -const newObjectInRealm = utils.newObjectInRealm; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Headers"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Headers'.`); -}; - -exports.createDefaultIterator = (globalObject, target, kind) => { - const ctorRegistry = globalObject[ctorRegistrySymbol]; - const iteratorPrototype = ctorRegistry["Headers Iterator"]; - const iterator = Object.create(iteratorPrototype); - Object.defineProperty(iterator, utils.iterInternalSymbol, { - value: { target, kind, index: 0 }, - configurable: true - }); - return iterator; -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Headers"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Headers { - constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - if (utils.isObject(curArg)) { - if (curArg[Symbol.iterator] !== undefined) { - if (!utils.isObject(curArg)) { - throw new globalObject.TypeError( - "Failed to construct 'Headers': parameter 1" + " sequence" + " is not an iterable object." - ); - } else { - const V = []; - const tmp = curArg; - for (let nextItem of tmp) { - if (!utils.isObject(nextItem)) { - throw new globalObject.TypeError( - "Failed to construct 'Headers': parameter 1" + - " sequence" + - "'s element" + - " is not an iterable object." - ); - } else { - const V = []; - const tmp = nextItem; - for (let nextItem of tmp) { - nextItem = conversions["ByteString"](nextItem, { - context: - "Failed to construct 'Headers': parameter 1" + " sequence" + "'s element" + "'s element", - globals: globalObject - }); - - V.push(nextItem); - } - nextItem = V; - } - - V.push(nextItem); - } - curArg = V; - } - } else { - if (!utils.isObject(curArg)) { - throw new globalObject.TypeError( - "Failed to construct 'Headers': parameter 1" + " record" + " is not an object." - ); - } else { - const result = Object.create(null); - for (const key of Reflect.ownKeys(curArg)) { - const desc = Object.getOwnPropertyDescriptor(curArg, key); - if (desc && desc.enumerable) { - let typedKey = key; - - typedKey = conversions["ByteString"](typedKey, { - context: "Failed to construct 'Headers': parameter 1" + " record" + "'s key", - globals: globalObject - }); - - let typedValue = curArg[key]; - - typedValue = conversions["ByteString"](typedValue, { - context: "Failed to construct 'Headers': parameter 1" + " record" + "'s value", - globals: globalObject - }); - - result[typedKey] = typedValue; - } - } - curArg = result; - } - } - } else { - throw new globalObject.TypeError( - "Failed to construct 'Headers': parameter 1" + " is not of any supported type." - ); - } - } - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - append(name, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'append' called on an object that is not a valid instance of Headers."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'append' on 'Headers': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'append' on 'Headers': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'append' on 'Headers': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].append(...args); - } - - delete(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'delete' called on an object that is not a valid instance of Headers."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'delete' on 'Headers': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'delete' on 'Headers': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].delete(...args); - } - - get(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get' called on an object that is not a valid instance of Headers."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'get' on 'Headers': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'get' on 'Headers': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].get(...args); - } - - getSetCookie() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'getSetCookie' called on an object that is not a valid instance of Headers."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].getSetCookie()); - } - - has(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'has' called on an object that is not a valid instance of Headers."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'has' on 'Headers': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'has' on 'Headers': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].has(...args); - } - - set(name, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set' called on an object that is not a valid instance of Headers."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'set' on 'Headers': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'set' on 'Headers': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'set' on 'Headers': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].set(...args); - } - - keys() { - if (!exports.is(this)) { - throw new globalObject.TypeError("'keys' called on an object that is not a valid instance of Headers."); - } - return exports.createDefaultIterator(globalObject, this, "key"); - } - - values() { - if (!exports.is(this)) { - throw new globalObject.TypeError("'values' called on an object that is not a valid instance of Headers."); - } - return exports.createDefaultIterator(globalObject, this, "value"); - } - - entries() { - if (!exports.is(this)) { - throw new globalObject.TypeError("'entries' called on an object that is not a valid instance of Headers."); - } - return exports.createDefaultIterator(globalObject, this, "key+value"); - } - - forEach(callback) { - if (!exports.is(this)) { - throw new globalObject.TypeError("'forEach' called on an object that is not a valid instance of Headers."); - } - if (arguments.length < 1) { - throw new globalObject.TypeError( - "Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present." - ); - } - callback = Function.convert(globalObject, callback, { - context: "Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1" - }); - const thisArg = arguments[1]; - let pairs = Array.from(this[implSymbol]); - let i = 0; - while (i < pairs.length) { - const [key, value] = pairs[i].map(utils.tryWrapperForImpl); - callback.call(thisArg, value, key, this); - pairs = Array.from(this[implSymbol]); - i++; - } - } - } - Object.defineProperties(Headers.prototype, { - append: { enumerable: true }, - delete: { enumerable: true }, - get: { enumerable: true }, - getSetCookie: { enumerable: true }, - has: { enumerable: true }, - set: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true }, - forEach: { enumerable: true }, - [Symbol.toStringTag]: { value: "Headers", configurable: true }, - [Symbol.iterator]: { value: Headers.prototype.entries, configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = Headers; - - ctorRegistry["Headers Iterator"] = Object.create(ctorRegistry["%IteratorPrototype%"], { - [Symbol.toStringTag]: { - configurable: true, - value: "Headers Iterator" - } - }); - utils.define(ctorRegistry["Headers Iterator"], { - next() { - const internal = this && this[utils.iterInternalSymbol]; - if (!internal) { - throw new globalObject.TypeError("next() called on a value that is not a Headers iterator object"); - } - - const { target, kind, index } = internal; - const values = Array.from(target[implSymbol]); - const len = values.length; - if (index >= len) { - return newObjectInRealm(globalObject, { value: undefined, done: true }); - } - - const pair = values[index]; - internal.index = index + 1; - return newObjectInRealm(globalObject, utils.iteratorResult(pair.map(utils.tryWrapperForImpl), kind)); - } - }); - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Headers - }); -}; - -const Impl = require("../fetch/Headers-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/History.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/History.js deleted file mode 100644 index 531d95a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/History.js +++ /dev/null @@ -1,266 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "History"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'History'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["History"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class History { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - go() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'go' called on an object that is not a valid instance of History."); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'go' on 'History': parameter 1", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - return esValue[implSymbol].go(...args); - } - - back() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'back' called on an object that is not a valid instance of History."); - } - - return esValue[implSymbol].back(); - } - - forward() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'forward' called on an object that is not a valid instance of History."); - } - - return esValue[implSymbol].forward(); - } - - pushState(data, title) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'pushState' called on an object that is not a valid instance of History."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'pushState' on 'History': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["any"](curArg, { - context: "Failed to execute 'pushState' on 'History': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'pushState' on 'History': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'pushState' on 'History': parameter 3", - globals: globalObject - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - return esValue[implSymbol].pushState(...args); - } - - replaceState(data, title) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'replaceState' called on an object that is not a valid instance of History."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'replaceState' on 'History': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["any"](curArg, { - context: "Failed to execute 'replaceState' on 'History': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'replaceState' on 'History': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'replaceState' on 'History': parameter 3", - globals: globalObject - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - return esValue[implSymbol].replaceState(...args); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get length' called on an object that is not a valid instance of History."); - } - - return esValue[implSymbol]["length"]; - } - - get state() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get state' called on an object that is not a valid instance of History."); - } - - return esValue[implSymbol]["state"]; - } - } - Object.defineProperties(History.prototype, { - go: { enumerable: true }, - back: { enumerable: true }, - forward: { enumerable: true }, - pushState: { enumerable: true }, - replaceState: { enumerable: true }, - length: { enumerable: true }, - state: { enumerable: true }, - [Symbol.toStringTag]: { value: "History", configurable: true } - }); - ctorRegistry[interfaceName] = History; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: History - }); -}; - -const Impl = require("../window/History-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/InputEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/InputEvent.js deleted file mode 100644 index f7b729e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/InputEvent.js +++ /dev/null @@ -1,168 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const InputEventInit = require("./InputEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const UIEvent = require("./UIEvent.js"); - -const interfaceName = "InputEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'InputEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["InputEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - UIEvent._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class InputEvent extends globalObject.UIEvent { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'InputEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'InputEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = InputEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'InputEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get data() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get data' called on an object that is not a valid instance of InputEvent."); - } - - return esValue[implSymbol]["data"]; - } - - get isComposing() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get isComposing' called on an object that is not a valid instance of InputEvent." - ); - } - - return esValue[implSymbol]["isComposing"]; - } - - get inputType() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get inputType' called on an object that is not a valid instance of InputEvent." - ); - } - - return esValue[implSymbol]["inputType"]; - } - } - Object.defineProperties(InputEvent.prototype, { - data: { enumerable: true }, - isComposing: { enumerable: true }, - inputType: { enumerable: true }, - [Symbol.toStringTag]: { value: "InputEvent", configurable: true } - }); - ctorRegistry[interfaceName] = InputEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: InputEvent - }); -}; - -const Impl = require("../events/InputEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/InputEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/InputEventInit.js deleted file mode 100644 index 480be50..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/InputEventInit.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const UIEventInit = require("./UIEventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - UIEventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "data"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["DOMString"](value, { - context: context + " has member 'data' that", - globals: globalObject - }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "inputType"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { - context: context + " has member 'inputType' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "isComposing"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'isComposing' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/KeyboardEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/KeyboardEvent.js deleted file mode 100644 index ecfc972..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/KeyboardEvent.js +++ /dev/null @@ -1,445 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const KeyboardEventInit = require("./KeyboardEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const UIEvent = require("./UIEvent.js"); - -const interfaceName = "KeyboardEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'KeyboardEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["KeyboardEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - UIEvent._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class KeyboardEvent extends globalObject.UIEvent { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'KeyboardEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'KeyboardEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = KeyboardEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'KeyboardEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - getModifierState(keyArg) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getModifierState' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getModifierState' on 'KeyboardEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getModifierState' on 'KeyboardEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].getModifierState(...args); - } - - initKeyboardEvent(typeArg) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'initKeyboardEvent' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': parameter 2", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': parameter 3", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = utils.tryImplForWrapper(curArg); - } - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[4]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': parameter 5", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - { - let curArg = arguments[5]; - if (curArg !== undefined) { - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': parameter 6", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[6]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': parameter 7", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[7]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': parameter 8", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[8]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': parameter 9", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[9]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initKeyboardEvent' on 'KeyboardEvent': parameter 10", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - return esValue[implSymbol].initKeyboardEvent(...args); - } - - get key() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get key' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["key"]; - } - - get code() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get code' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["code"]; - } - - get location() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get location' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["location"]; - } - - get ctrlKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ctrlKey' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["ctrlKey"]; - } - - get shiftKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get shiftKey' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["shiftKey"]; - } - - get altKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get altKey' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["altKey"]; - } - - get metaKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get metaKey' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["metaKey"]; - } - - get repeat() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get repeat' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["repeat"]; - } - - get isComposing() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get isComposing' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["isComposing"]; - } - - get charCode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get charCode' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["charCode"]; - } - - get keyCode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get keyCode' called on an object that is not a valid instance of KeyboardEvent." - ); - } - - return esValue[implSymbol]["keyCode"]; - } - } - Object.defineProperties(KeyboardEvent.prototype, { - getModifierState: { enumerable: true }, - initKeyboardEvent: { enumerable: true }, - key: { enumerable: true }, - code: { enumerable: true }, - location: { enumerable: true }, - ctrlKey: { enumerable: true }, - shiftKey: { enumerable: true }, - altKey: { enumerable: true }, - metaKey: { enumerable: true }, - repeat: { enumerable: true }, - isComposing: { enumerable: true }, - charCode: { enumerable: true }, - keyCode: { enumerable: true }, - [Symbol.toStringTag]: { value: "KeyboardEvent", configurable: true }, - DOM_KEY_LOCATION_STANDARD: { value: 0x00, enumerable: true }, - DOM_KEY_LOCATION_LEFT: { value: 0x01, enumerable: true }, - DOM_KEY_LOCATION_RIGHT: { value: 0x02, enumerable: true }, - DOM_KEY_LOCATION_NUMPAD: { value: 0x03, enumerable: true } - }); - Object.defineProperties(KeyboardEvent, { - DOM_KEY_LOCATION_STANDARD: { value: 0x00, enumerable: true }, - DOM_KEY_LOCATION_LEFT: { value: 0x01, enumerable: true }, - DOM_KEY_LOCATION_RIGHT: { value: 0x02, enumerable: true }, - DOM_KEY_LOCATION_NUMPAD: { value: 0x03, enumerable: true } - }); - ctorRegistry[interfaceName] = KeyboardEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: KeyboardEvent - }); -}; - -const Impl = require("../events/KeyboardEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/KeyboardEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/KeyboardEventInit.js deleted file mode 100644 index 9094ed3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/KeyboardEventInit.js +++ /dev/null @@ -1,116 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventModifierInit = require("./EventModifierInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventModifierInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "charCode"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long"](value, { - context: context + " has member 'charCode' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "code"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { context: context + " has member 'code' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "isComposing"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'isComposing' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "key"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { context: context + " has member 'key' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "keyCode"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long"](value, { - context: context + " has member 'keyCode' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "location"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long"](value, { - context: context + " has member 'location' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "repeat"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'repeat' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Location.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Location.js deleted file mode 100644 index 03672a7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Location.js +++ /dev/null @@ -1,404 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Location"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Location'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Location"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -function getUnforgeables(globalObject) { - let unforgeables = unforgeablesMap.get(globalObject); - if (unforgeables === undefined) { - unforgeables = Object.create(null); - utils.define(unforgeables, { - assign(url) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'assign' called on an object that is not a valid instance of Location."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'assign' on 'Location': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'assign' on 'Location': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].assign(...args); - }, - replace(url) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'replace' called on an object that is not a valid instance of Location."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'replace' on 'Location': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'replace' on 'Location': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].replace(...args); - }, - reload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'reload' called on an object that is not a valid instance of Location."); - } - - return esValue[implSymbol].reload(); - }, - get href() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get href' called on an object that is not a valid instance of Location."); - } - - return esValue[implSymbol]["href"]; - }, - set href(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set href' called on an object that is not a valid instance of Location."); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'href' property on 'Location': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["href"] = V; - }, - toString() { - const esValue = this; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'toString' called on an object that is not a valid instance of Location."); - } - - return esValue[implSymbol]["href"]; - }, - get origin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get origin' called on an object that is not a valid instance of Location." - ); - } - - return esValue[implSymbol]["origin"]; - }, - get protocol() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get protocol' called on an object that is not a valid instance of Location." - ); - } - - return esValue[implSymbol]["protocol"]; - }, - set protocol(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set protocol' called on an object that is not a valid instance of Location." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'protocol' property on 'Location': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["protocol"] = V; - }, - get host() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get host' called on an object that is not a valid instance of Location."); - } - - return esValue[implSymbol]["host"]; - }, - set host(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set host' called on an object that is not a valid instance of Location."); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'host' property on 'Location': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["host"] = V; - }, - get hostname() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hostname' called on an object that is not a valid instance of Location." - ); - } - - return esValue[implSymbol]["hostname"]; - }, - set hostname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set hostname' called on an object that is not a valid instance of Location." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'hostname' property on 'Location': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["hostname"] = V; - }, - get port() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get port' called on an object that is not a valid instance of Location."); - } - - return esValue[implSymbol]["port"]; - }, - set port(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set port' called on an object that is not a valid instance of Location."); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'port' property on 'Location': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["port"] = V; - }, - get pathname() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pathname' called on an object that is not a valid instance of Location." - ); - } - - return esValue[implSymbol]["pathname"]; - }, - set pathname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set pathname' called on an object that is not a valid instance of Location." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'pathname' property on 'Location': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["pathname"] = V; - }, - get search() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get search' called on an object that is not a valid instance of Location." - ); - } - - return esValue[implSymbol]["search"]; - }, - set search(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set search' called on an object that is not a valid instance of Location." - ); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'search' property on 'Location': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["search"] = V; - }, - get hash() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get hash' called on an object that is not a valid instance of Location."); - } - - return esValue[implSymbol]["hash"]; - }, - set hash(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set hash' called on an object that is not a valid instance of Location."); - } - - V = conversions["USVString"](V, { - context: "Failed to set the 'hash' property on 'Location': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["hash"] = V; - } - }); - Object.defineProperties(unforgeables, { - assign: { configurable: false, writable: false }, - replace: { configurable: false, writable: false }, - reload: { configurable: false, writable: false }, - href: { configurable: false }, - toString: { configurable: false, writable: false }, - origin: { configurable: false }, - protocol: { configurable: false }, - host: { configurable: false }, - hostname: { configurable: false }, - port: { configurable: false }, - pathname: { configurable: false }, - search: { configurable: false }, - hash: { configurable: false } - }); - unforgeablesMap.set(globalObject, unforgeables); - } - return unforgeables; -} - -exports._internalSetup = (wrapper, globalObject) => { - utils.define(wrapper, getUnforgeables(globalObject)); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const unforgeablesMap = new WeakMap(); -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Location { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(Location.prototype, { [Symbol.toStringTag]: { value: "Location", configurable: true } }); - ctorRegistry[interfaceName] = Location; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Location - }); -}; - -const Impl = require("../window/Location-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MessageEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MessageEvent.js deleted file mode 100644 index 01d796c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MessageEvent.js +++ /dev/null @@ -1,317 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const MessageEventInit = require("./MessageEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "MessageEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'MessageEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["MessageEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker", "AudioWorklet"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class MessageEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'MessageEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'MessageEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = MessageEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'MessageEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - initMessageEvent(type) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'initMessageEvent' called on an object that is not a valid instance of MessageEvent." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'initMessageEvent' on 'MessageEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initMessageEvent' on 'MessageEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initMessageEvent' on 'MessageEvent': parameter 2", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initMessageEvent' on 'MessageEvent': parameter 3", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - curArg = conversions["any"](curArg, { - context: "Failed to execute 'initMessageEvent' on 'MessageEvent': parameter 4", - globals: globalObject - }); - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[4]; - if (curArg !== undefined) { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'initMessageEvent' on 'MessageEvent': parameter 5", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - { - let curArg = arguments[5]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initMessageEvent' on 'MessageEvent': parameter 6", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - { - let curArg = arguments[6]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = utils.tryImplForWrapper(curArg); - } - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[7]; - if (curArg !== undefined) { - if (!utils.isObject(curArg)) { - throw new globalObject.TypeError( - "Failed to execute 'initMessageEvent' on 'MessageEvent': parameter 8" + " is not an iterable object." - ); - } else { - const V = []; - const tmp = curArg; - for (let nextItem of tmp) { - nextItem = utils.tryImplForWrapper(nextItem); - - V.push(nextItem); - } - curArg = V; - } - } else { - curArg = []; - } - args.push(curArg); - } - return esValue[implSymbol].initMessageEvent(...args); - } - - get data() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get data' called on an object that is not a valid instance of MessageEvent." - ); - } - - return esValue[implSymbol]["data"]; - } - - get origin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get origin' called on an object that is not a valid instance of MessageEvent." - ); - } - - return esValue[implSymbol]["origin"]; - } - - get lastEventId() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get lastEventId' called on an object that is not a valid instance of MessageEvent." - ); - } - - return esValue[implSymbol]["lastEventId"]; - } - - get source() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get source' called on an object that is not a valid instance of MessageEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["source"]); - } - - get ports() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ports' called on an object that is not a valid instance of MessageEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ports"]); - } - } - Object.defineProperties(MessageEvent.prototype, { - initMessageEvent: { enumerable: true }, - data: { enumerable: true }, - origin: { enumerable: true }, - lastEventId: { enumerable: true }, - source: { enumerable: true }, - ports: { enumerable: true }, - [Symbol.toStringTag]: { value: "MessageEvent", configurable: true } - }); - ctorRegistry[interfaceName] = MessageEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: MessageEvent - }); -}; - -const Impl = require("../events/MessageEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MessageEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MessageEventInit.js deleted file mode 100644 index 0e84b44..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MessageEventInit.js +++ /dev/null @@ -1,100 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "data"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["any"](value, { context: context + " has member 'data' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "lastEventId"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { - context: context + " has member 'lastEventId' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "origin"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["USVString"](value, { - context: context + " has member 'origin' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "ports"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (!utils.isObject(value)) { - throw new globalObject.TypeError(context + " has member 'ports' that" + " is not an iterable object."); - } else { - const V = []; - const tmp = value; - for (let nextItem of tmp) { - nextItem = utils.tryImplForWrapper(nextItem); - - V.push(nextItem); - } - value = V; - } - - ret[key] = value; - } else { - ret[key] = []; - } - } - - { - const key = "source"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = utils.tryImplForWrapper(value); - } - ret[key] = value; - } else { - ret[key] = null; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MimeType.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MimeType.js deleted file mode 100644 index f61bae7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MimeType.js +++ /dev/null @@ -1,156 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "MimeType"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'MimeType'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["MimeType"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class MimeType { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get type' called on an object that is not a valid instance of MimeType."); - } - - return esValue[implSymbol]["type"]; - } - - get description() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get description' called on an object that is not a valid instance of MimeType." - ); - } - - return esValue[implSymbol]["description"]; - } - - get suffixes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get suffixes' called on an object that is not a valid instance of MimeType." - ); - } - - return esValue[implSymbol]["suffixes"]; - } - - get enabledPlugin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get enabledPlugin' called on an object that is not a valid instance of MimeType." - ); - } - - return esValue[implSymbol]["enabledPlugin"]; - } - } - Object.defineProperties(MimeType.prototype, { - type: { enumerable: true }, - description: { enumerable: true }, - suffixes: { enumerable: true }, - enabledPlugin: { enumerable: true }, - [Symbol.toStringTag]: { value: "MimeType", configurable: true } - }); - ctorRegistry[interfaceName] = MimeType; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: MimeType - }); -}; - -const Impl = require("../navigator/MimeType-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MimeTypeArray.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MimeTypeArray.js deleted file mode 100644 index 854a31d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MimeTypeArray.js +++ /dev/null @@ -1,326 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "MimeTypeArray"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'MimeTypeArray'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["MimeTypeArray"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class MimeTypeArray { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'item' called on an object that is not a valid instance of MimeTypeArray."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'MimeTypeArray': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'MimeTypeArray': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].item(...args); - } - - namedItem(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'namedItem' called on an object that is not a valid instance of MimeTypeArray." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'namedItem' on 'MimeTypeArray': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'namedItem' on 'MimeTypeArray': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].namedItem(...args); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of MimeTypeArray." - ); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(MimeTypeArray.prototype, { - item: { enumerable: true }, - namedItem: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "MimeTypeArray", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = MimeTypeArray; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: MimeTypeArray - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../navigator/MimeTypeArray-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MouseEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MouseEvent.js deleted file mode 100644 index e2fa3b4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MouseEvent.js +++ /dev/null @@ -1,595 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const MouseEventInit = require("./MouseEventInit.js"); -const EventTarget = require("./EventTarget.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const UIEvent = require("./UIEvent.js"); - -const interfaceName = "MouseEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'MouseEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["MouseEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - UIEvent._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class MouseEvent extends globalObject.UIEvent { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'MouseEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'MouseEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = MouseEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'MouseEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - getModifierState(keyArg) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getModifierState' called on an object that is not a valid instance of MouseEvent." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getModifierState' on 'MouseEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getModifierState' on 'MouseEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].getModifierState(...args); - } - - initMouseEvent(typeArg) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'initMouseEvent' called on an object that is not a valid instance of MouseEvent." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'initMouseEvent' on 'MouseEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 2", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 3", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = utils.tryImplForWrapper(curArg); - } - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[4]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 5", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[5]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 6", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[6]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 7", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[7]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 8", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[8]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 9", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[9]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 10", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[10]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 11", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[11]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 12", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[12]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 13", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[13]; - if (curArg !== undefined) { - curArg = conversions["short"](curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 14", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[14]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = EventTarget.convert(globalObject, curArg, { - context: "Failed to execute 'initMouseEvent' on 'MouseEvent': parameter 15" - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - return esValue[implSymbol].initMouseEvent(...args); - } - - get screenX() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get screenX' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["screenX"]; - } - - get screenY() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get screenY' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["screenY"]; - } - - get clientX() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get clientX' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["clientX"]; - } - - get clientY() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get clientY' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["clientY"]; - } - - get ctrlKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ctrlKey' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["ctrlKey"]; - } - - get shiftKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get shiftKey' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["shiftKey"]; - } - - get altKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get altKey' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["altKey"]; - } - - get metaKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get metaKey' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["metaKey"]; - } - - get button() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get button' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["button"]; - } - - get buttons() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get buttons' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["buttons"]; - } - - get relatedTarget() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get relatedTarget' called on an object that is not a valid instance of MouseEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["relatedTarget"]); - } - - get pageX() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get pageX' called on an object that is not a valid instance of MouseEvent."); - } - - return esValue[implSymbol]["pageX"]; - } - - get pageY() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get pageY' called on an object that is not a valid instance of MouseEvent."); - } - - return esValue[implSymbol]["pageY"]; - } - - get x() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get x' called on an object that is not a valid instance of MouseEvent."); - } - - return esValue[implSymbol]["x"]; - } - - get y() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get y' called on an object that is not a valid instance of MouseEvent."); - } - - return esValue[implSymbol]["y"]; - } - - get offsetX() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get offsetX' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["offsetX"]; - } - - get offsetY() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get offsetY' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["offsetY"]; - } - - get movementX() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get movementX' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["movementX"]; - } - - get movementY() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get movementY' called on an object that is not a valid instance of MouseEvent." - ); - } - - return esValue[implSymbol]["movementY"]; - } - } - Object.defineProperties(MouseEvent.prototype, { - getModifierState: { enumerable: true }, - initMouseEvent: { enumerable: true }, - screenX: { enumerable: true }, - screenY: { enumerable: true }, - clientX: { enumerable: true }, - clientY: { enumerable: true }, - ctrlKey: { enumerable: true }, - shiftKey: { enumerable: true }, - altKey: { enumerable: true }, - metaKey: { enumerable: true }, - button: { enumerable: true }, - buttons: { enumerable: true }, - relatedTarget: { enumerable: true }, - pageX: { enumerable: true }, - pageY: { enumerable: true }, - x: { enumerable: true }, - y: { enumerable: true }, - offsetX: { enumerable: true }, - offsetY: { enumerable: true }, - movementX: { enumerable: true }, - movementY: { enumerable: true }, - [Symbol.toStringTag]: { value: "MouseEvent", configurable: true } - }); - ctorRegistry[interfaceName] = MouseEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: MouseEvent - }); -}; - -const Impl = require("../events/MouseEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MouseEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MouseEventInit.js deleted file mode 100644 index 50c06d2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MouseEventInit.js +++ /dev/null @@ -1,189 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventTarget = require("./EventTarget.js"); -const EventModifierInit = require("./EventModifierInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventModifierInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "button"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["short"](value, { context: context + " has member 'button' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "buttons"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned short"](value, { - context: context + " has member 'buttons' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "clientX"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { context: context + " has member 'clientX' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "clientX"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'clientX' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0.0; - } - } - - { - const key = "clientY"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { context: context + " has member 'clientY' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "clientY"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'clientY' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0.0; - } - } - - { - const key = "movementX"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { - context: context + " has member 'movementX' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "movementY"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { - context: context + " has member 'movementY' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "relatedTarget"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = EventTarget.convert(globalObject, value, { context: context + " has member 'relatedTarget' that" }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "screenX"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { context: context + " has member 'screenX' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "screenX"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'screenX' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0.0; - } - } - - { - const key = "screenY"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { context: context + " has member 'screenY' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "screenY"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'screenY' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0.0; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationCallback.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationCallback.js deleted file mode 100644 index dec585c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationCallback.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (typeof value !== "function") { - throw new globalObject.TypeError(context + " is not a function"); - } - - function invokeTheCallbackFunction(mutations, observer) { - const thisArg = utils.tryWrapperForImpl(this); - let callResult; - - mutations = utils.tryWrapperForImpl(mutations); - - observer = utils.tryWrapperForImpl(observer); - - callResult = Reflect.apply(value, thisArg, [mutations, observer]); - } - - invokeTheCallbackFunction.construct = (mutations, observer) => { - mutations = utils.tryWrapperForImpl(mutations); - - observer = utils.tryWrapperForImpl(observer); - - let callResult = Reflect.construct(value, [mutations, observer]); - }; - - invokeTheCallbackFunction[utils.wrapperSymbol] = value; - invokeTheCallbackFunction.objectReference = value; - - return invokeTheCallbackFunction; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationObserver.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationObserver.js deleted file mode 100644 index 32de69e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationObserver.js +++ /dev/null @@ -1,178 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const MutationCallback = require("./MutationCallback.js"); -const Node = require("./Node.js"); -const MutationObserverInit = require("./MutationObserverInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "MutationObserver"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'MutationObserver'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["MutationObserver"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class MutationObserver { - constructor(callback) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'MutationObserver': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = MutationCallback.convert(globalObject, curArg, { - context: "Failed to construct 'MutationObserver': parameter 1" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - observe(target) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'observe' called on an object that is not a valid instance of MutationObserver." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'observe' on 'MutationObserver': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'observe' on 'MutationObserver': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = MutationObserverInit.convert(globalObject, curArg, { - context: "Failed to execute 'observe' on 'MutationObserver': parameter 2" - }); - args.push(curArg); - } - return esValue[implSymbol].observe(...args); - } - - disconnect() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'disconnect' called on an object that is not a valid instance of MutationObserver." - ); - } - - return esValue[implSymbol].disconnect(); - } - - takeRecords() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'takeRecords' called on an object that is not a valid instance of MutationObserver." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].takeRecords()); - } - } - Object.defineProperties(MutationObserver.prototype, { - observe: { enumerable: true }, - disconnect: { enumerable: true }, - takeRecords: { enumerable: true }, - [Symbol.toStringTag]: { value: "MutationObserver", configurable: true } - }); - ctorRegistry[interfaceName] = MutationObserver; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: MutationObserver - }); -}; - -const Impl = require("../mutation-observer/MutationObserver-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationObserverInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationObserverInit.js deleted file mode 100644 index 7efca69..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationObserverInit.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "attributeFilter"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (!utils.isObject(value)) { - throw new globalObject.TypeError( - context + " has member 'attributeFilter' that" + " is not an iterable object." - ); - } else { - const V = []; - const tmp = value; - for (let nextItem of tmp) { - nextItem = conversions["DOMString"](nextItem, { - context: context + " has member 'attributeFilter' that" + "'s element", - globals: globalObject - }); - - V.push(nextItem); - } - value = V; - } - - ret[key] = value; - } - } - - { - const key = "attributeOldValue"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'attributeOldValue' that", - globals: globalObject - }); - - ret[key] = value; - } - } - - { - const key = "attributes"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'attributes' that", - globals: globalObject - }); - - ret[key] = value; - } - } - - { - const key = "characterData"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'characterData' that", - globals: globalObject - }); - - ret[key] = value; - } - } - - { - const key = "characterDataOldValue"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'characterDataOldValue' that", - globals: globalObject - }); - - ret[key] = value; - } - } - - { - const key = "childList"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'childList' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "subtree"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'subtree' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationRecord.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationRecord.js deleted file mode 100644 index 187608b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/MutationRecord.js +++ /dev/null @@ -1,229 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "MutationRecord"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'MutationRecord'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["MutationRecord"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class MutationRecord { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get type' called on an object that is not a valid instance of MutationRecord." - ); - } - - return esValue[implSymbol]["type"]; - } - - get target() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get target' called on an object that is not a valid instance of MutationRecord." - ); - } - - return utils.getSameObject(this, "target", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["target"]); - }); - } - - get addedNodes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get addedNodes' called on an object that is not a valid instance of MutationRecord." - ); - } - - return utils.getSameObject(this, "addedNodes", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["addedNodes"]); - }); - } - - get removedNodes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get removedNodes' called on an object that is not a valid instance of MutationRecord." - ); - } - - return utils.getSameObject(this, "removedNodes", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["removedNodes"]); - }); - } - - get previousSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get previousSibling' called on an object that is not a valid instance of MutationRecord." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["previousSibling"]); - } - - get nextSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get nextSibling' called on an object that is not a valid instance of MutationRecord." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["nextSibling"]); - } - - get attributeName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get attributeName' called on an object that is not a valid instance of MutationRecord." - ); - } - - return esValue[implSymbol]["attributeName"]; - } - - get attributeNamespace() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get attributeNamespace' called on an object that is not a valid instance of MutationRecord." - ); - } - - return esValue[implSymbol]["attributeNamespace"]; - } - - get oldValue() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oldValue' called on an object that is not a valid instance of MutationRecord." - ); - } - - return esValue[implSymbol]["oldValue"]; - } - } - Object.defineProperties(MutationRecord.prototype, { - type: { enumerable: true }, - target: { enumerable: true }, - addedNodes: { enumerable: true }, - removedNodes: { enumerable: true }, - previousSibling: { enumerable: true }, - nextSibling: { enumerable: true }, - attributeName: { enumerable: true }, - attributeNamespace: { enumerable: true }, - oldValue: { enumerable: true }, - [Symbol.toStringTag]: { value: "MutationRecord", configurable: true } - }); - ctorRegistry[interfaceName] = MutationRecord; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: MutationRecord - }); -}; - -const Impl = require("../mutation-observer/MutationRecord-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NamedNodeMap.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NamedNodeMap.js deleted file mode 100644 index 2bbcda3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NamedNodeMap.js +++ /dev/null @@ -1,527 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Attr = require("./Attr.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "NamedNodeMap"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'NamedNodeMap'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["NamedNodeMap"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class NamedNodeMap { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'item' called on an object that is not a valid instance of NamedNodeMap."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'NamedNodeMap': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'NamedNodeMap': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); - } - - getNamedItem(qualifiedName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getNamedItem' called on an object that is not a valid instance of NamedNodeMap." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getNamedItem' on 'NamedNodeMap': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getNamedItem' on 'NamedNodeMap': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getNamedItem(...args)); - } - - getNamedItemNS(namespace, localName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getNamedItemNS' called on an object that is not a valid instance of NamedNodeMap." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'getNamedItemNS' on 'NamedNodeMap': 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 'getNamedItemNS' on 'NamedNodeMap': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getNamedItemNS' on 'NamedNodeMap': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getNamedItemNS(...args)); - } - - setNamedItem(attr) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setNamedItem' called on an object that is not a valid instance of NamedNodeMap." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setNamedItem' on 'NamedNodeMap': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Attr.convert(globalObject, curArg, { - context: "Failed to execute 'setNamedItem' on 'NamedNodeMap': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].setNamedItem(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - setNamedItemNS(attr) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setNamedItemNS' called on an object that is not a valid instance of NamedNodeMap." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setNamedItemNS' on 'NamedNodeMap': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Attr.convert(globalObject, curArg, { - context: "Failed to execute 'setNamedItemNS' on 'NamedNodeMap': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].setNamedItemNS(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - removeNamedItem(qualifiedName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'removeNamedItem' called on an object that is not a valid instance of NamedNodeMap." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'removeNamedItem' on 'NamedNodeMap': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'removeNamedItem' on 'NamedNodeMap': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].removeNamedItem(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - removeNamedItemNS(namespace, localName) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'removeNamedItemNS' called on an object that is not a valid instance of NamedNodeMap." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'removeNamedItemNS' on 'NamedNodeMap': 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 'removeNamedItemNS' on 'NamedNodeMap': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'removeNamedItemNS' on 'NamedNodeMap': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].removeNamedItemNS(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of NamedNodeMap." - ); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(NamedNodeMap.prototype, { - item: { enumerable: true }, - getNamedItem: { enumerable: true }, - getNamedItemNS: { enumerable: true }, - setNamedItem: { enumerable: true }, - setNamedItemNS: { enumerable: true }, - removeNamedItem: { enumerable: true }, - removeNamedItemNS: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "NamedNodeMap", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = NamedNodeMap; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: NamedNodeMap - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(`${key}`); - } - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - const namedValue = target[implSymbol].getNamedItem(P); - - if (namedValue !== null && !(P in target) && !ignoreNamedProps) { - return { - writable: false, - enumerable: false, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - if (!Object.hasOwn(target, P)) { - const creating = !(target[implSymbol].getNamedItem(P) !== null); - if (!creating) { - return false; - } - } - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - if (target[implSymbol].getNamedItem(P) !== null && !(P in target)) { - return false; - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../attributes/NamedNodeMap-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Navigator.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Navigator.js deleted file mode 100644 index 35896a6..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Navigator.js +++ /dev/null @@ -1,326 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Navigator"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Navigator'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Navigator"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Navigator { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - javaEnabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'javaEnabled' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol].javaEnabled(); - } - - get appCodeName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get appCodeName' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["appCodeName"]; - } - - get appName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get appName' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["appName"]; - } - - get appVersion() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get appVersion' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["appVersion"]; - } - - get platform() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get platform' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["platform"]; - } - - get product() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get product' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["product"]; - } - - get productSub() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get productSub' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["productSub"]; - } - - get userAgent() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get userAgent' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["userAgent"]; - } - - get vendor() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get vendor' called on an object that is not a valid instance of Navigator."); - } - - return esValue[implSymbol]["vendor"]; - } - - get vendorSub() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get vendorSub' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["vendorSub"]; - } - - get language() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get language' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["language"]; - } - - get languages() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get languages' called on an object that is not a valid instance of Navigator." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["languages"]); - } - - get onLine() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onLine' called on an object that is not a valid instance of Navigator."); - } - - return esValue[implSymbol]["onLine"]; - } - - get cookieEnabled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get cookieEnabled' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["cookieEnabled"]; - } - - get plugins() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get plugins' called on an object that is not a valid instance of Navigator." - ); - } - - return utils.getSameObject(this, "plugins", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["plugins"]); - }); - } - - get mimeTypes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get mimeTypes' called on an object that is not a valid instance of Navigator." - ); - } - - return utils.getSameObject(this, "mimeTypes", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["mimeTypes"]); - }); - } - - get hardwareConcurrency() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get hardwareConcurrency' called on an object that is not a valid instance of Navigator." - ); - } - - return esValue[implSymbol]["hardwareConcurrency"]; - } - } - Object.defineProperties(Navigator.prototype, { - javaEnabled: { enumerable: true }, - appCodeName: { enumerable: true }, - appName: { enumerable: true }, - appVersion: { enumerable: true }, - platform: { enumerable: true }, - product: { enumerable: true }, - productSub: { enumerable: true }, - userAgent: { enumerable: true }, - vendor: { enumerable: true }, - vendorSub: { enumerable: true }, - language: { enumerable: true }, - languages: { enumerable: true }, - onLine: { enumerable: true }, - cookieEnabled: { enumerable: true }, - plugins: { enumerable: true }, - mimeTypes: { enumerable: true }, - hardwareConcurrency: { enumerable: true }, - [Symbol.toStringTag]: { value: "Navigator", configurable: true } - }); - ctorRegistry[interfaceName] = Navigator; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Navigator - }); -}; - -const Impl = require("../navigator/Navigator-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Node.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Node.js deleted file mode 100644 index f2c3e41..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Node.js +++ /dev/null @@ -1,763 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const GetRootNodeOptions = require("./GetRootNodeOptions.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const EventTarget = require("./EventTarget.js"); - -const interfaceName = "Node"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Node'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Node"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - EventTarget._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Node extends globalObject.EventTarget { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - getRootNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'getRootNode' called on an object that is not a valid instance of Node."); - } - const args = []; - { - let curArg = arguments[0]; - curArg = GetRootNodeOptions.convert(globalObject, curArg, { - context: "Failed to execute 'getRootNode' on 'Node': parameter 1" - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getRootNode(...args)); - } - - hasChildNodes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'hasChildNodes' called on an object that is not a valid instance of Node."); - } - - return esValue[implSymbol].hasChildNodes(); - } - - normalize() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'normalize' called on an object that is not a valid instance of Node."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].normalize(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - cloneNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'cloneNode' called on an object that is not a valid instance of Node."); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'cloneNode' on 'Node': parameter 1", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].cloneNode(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - isEqualNode(otherNode) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'isEqualNode' called on an object that is not a valid instance of Node."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'isEqualNode' on 'Node': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'isEqualNode' on 'Node': parameter 1" - }); - } - args.push(curArg); - } - return esValue[implSymbol].isEqualNode(...args); - } - - isSameNode(otherNode) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'isSameNode' called on an object that is not a valid instance of Node."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'isSameNode' on 'Node': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'isSameNode' on 'Node': parameter 1" - }); - } - args.push(curArg); - } - return esValue[implSymbol].isSameNode(...args); - } - - compareDocumentPosition(other) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'compareDocumentPosition' called on an object that is not a valid instance of Node." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'compareDocumentPosition' on 'Node': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'compareDocumentPosition' on 'Node': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].compareDocumentPosition(...args); - } - - contains(other) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'contains' called on an object that is not a valid instance of Node."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'contains' on 'Node': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'contains' on 'Node': parameter 1" - }); - } - args.push(curArg); - } - return esValue[implSymbol].contains(...args); - } - - lookupPrefix(namespace) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'lookupPrefix' called on an object that is not a valid instance of Node."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'lookupPrefix' on 'Node': 1 argument 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 'lookupPrefix' on 'Node': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].lookupPrefix(...args); - } - - lookupNamespaceURI(prefix) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'lookupNamespaceURI' called on an object that is not a valid instance of Node." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'lookupNamespaceURI' on 'Node': 1 argument 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 'lookupNamespaceURI' on 'Node': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].lookupNamespaceURI(...args); - } - - isDefaultNamespace(namespace) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'isDefaultNamespace' called on an object that is not a valid instance of Node." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'isDefaultNamespace' on 'Node': 1 argument 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 'isDefaultNamespace' on 'Node': parameter 1", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].isDefaultNamespace(...args); - } - - insertBefore(node, child) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'insertBefore' called on an object that is not a valid instance of Node."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'insertBefore' on 'Node': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'insertBefore' on 'Node': parameter 2" - }); - } - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].insertBefore(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - appendChild(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'appendChild' called on an object that is not a valid instance of Node."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'appendChild' on 'Node': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'appendChild' on 'Node': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].appendChild(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - replaceChild(node, child) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'replaceChild' called on an object that is not a valid instance of Node."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'replaceChild' on 'Node': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'replaceChild' on 'Node': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'replaceChild' on 'Node': parameter 2" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].replaceChild(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - removeChild(child) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'removeChild' called on an object that is not a valid instance of Node."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'removeChild' on 'Node': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'removeChild' on 'Node': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].removeChild(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get nodeType() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get nodeType' called on an object that is not a valid instance of Node."); - } - - return esValue[implSymbol]["nodeType"]; - } - - get nodeName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get nodeName' called on an object that is not a valid instance of Node."); - } - - return esValue[implSymbol]["nodeName"]; - } - - get baseURI() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get baseURI' called on an object that is not a valid instance of Node."); - } - - return esValue[implSymbol]["baseURI"]; - } - - get isConnected() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get isConnected' called on an object that is not a valid instance of Node."); - } - - return esValue[implSymbol]["isConnected"]; - } - - get ownerDocument() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ownerDocument' called on an object that is not a valid instance of Node." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ownerDocument"]); - } - - get parentNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get parentNode' called on an object that is not a valid instance of Node."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["parentNode"]); - } - - get parentElement() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get parentElement' called on an object that is not a valid instance of Node." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["parentElement"]); - } - - get childNodes() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get childNodes' called on an object that is not a valid instance of Node."); - } - - return utils.getSameObject(this, "childNodes", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["childNodes"]); - }); - } - - get firstChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get firstChild' called on an object that is not a valid instance of Node."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["firstChild"]); - } - - get lastChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get lastChild' called on an object that is not a valid instance of Node."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["lastChild"]); - } - - get previousSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get previousSibling' called on an object that is not a valid instance of Node." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["previousSibling"]); - } - - get nextSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get nextSibling' called on an object that is not a valid instance of Node."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["nextSibling"]); - } - - get nodeValue() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get nodeValue' called on an object that is not a valid instance of Node."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["nodeValue"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set nodeValue(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set nodeValue' called on an object that is not a valid instance of Node."); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'nodeValue' property on 'Node': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["nodeValue"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get textContent() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get textContent' called on an object that is not a valid instance of Node."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["textContent"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set textContent(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set textContent' called on an object that is not a valid instance of Node."); - } - - if (V === null || V === undefined) { - V = null; - } else { - V = conversions["DOMString"](V, { - context: "Failed to set the 'textContent' property on 'Node': The provided value", - globals: globalObject - }); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["textContent"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(Node.prototype, { - getRootNode: { enumerable: true }, - hasChildNodes: { enumerable: true }, - normalize: { enumerable: true }, - cloneNode: { enumerable: true }, - isEqualNode: { enumerable: true }, - isSameNode: { enumerable: true }, - compareDocumentPosition: { enumerable: true }, - contains: { enumerable: true }, - lookupPrefix: { enumerable: true }, - lookupNamespaceURI: { enumerable: true }, - isDefaultNamespace: { enumerable: true }, - insertBefore: { enumerable: true }, - appendChild: { enumerable: true }, - replaceChild: { enumerable: true }, - removeChild: { enumerable: true }, - nodeType: { enumerable: true }, - nodeName: { enumerable: true }, - baseURI: { enumerable: true }, - isConnected: { enumerable: true }, - ownerDocument: { enumerable: true }, - parentNode: { enumerable: true }, - parentElement: { enumerable: true }, - childNodes: { enumerable: true }, - firstChild: { enumerable: true }, - lastChild: { enumerable: true }, - previousSibling: { enumerable: true }, - nextSibling: { enumerable: true }, - nodeValue: { enumerable: true }, - textContent: { enumerable: true }, - [Symbol.toStringTag]: { value: "Node", configurable: true }, - ELEMENT_NODE: { value: 1, enumerable: true }, - ATTRIBUTE_NODE: { value: 2, enumerable: true }, - TEXT_NODE: { value: 3, enumerable: true }, - CDATA_SECTION_NODE: { value: 4, enumerable: true }, - ENTITY_REFERENCE_NODE: { value: 5, enumerable: true }, - ENTITY_NODE: { value: 6, enumerable: true }, - PROCESSING_INSTRUCTION_NODE: { value: 7, enumerable: true }, - COMMENT_NODE: { value: 8, enumerable: true }, - DOCUMENT_NODE: { value: 9, enumerable: true }, - DOCUMENT_TYPE_NODE: { value: 10, enumerable: true }, - DOCUMENT_FRAGMENT_NODE: { value: 11, enumerable: true }, - NOTATION_NODE: { value: 12, enumerable: true }, - DOCUMENT_POSITION_DISCONNECTED: { value: 0x01, enumerable: true }, - DOCUMENT_POSITION_PRECEDING: { value: 0x02, enumerable: true }, - DOCUMENT_POSITION_FOLLOWING: { value: 0x04, enumerable: true }, - DOCUMENT_POSITION_CONTAINS: { value: 0x08, enumerable: true }, - DOCUMENT_POSITION_CONTAINED_BY: { value: 0x10, enumerable: true }, - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: { value: 0x20, enumerable: true } - }); - Object.defineProperties(Node, { - ELEMENT_NODE: { value: 1, enumerable: true }, - ATTRIBUTE_NODE: { value: 2, enumerable: true }, - TEXT_NODE: { value: 3, enumerable: true }, - CDATA_SECTION_NODE: { value: 4, enumerable: true }, - ENTITY_REFERENCE_NODE: { value: 5, enumerable: true }, - ENTITY_NODE: { value: 6, enumerable: true }, - PROCESSING_INSTRUCTION_NODE: { value: 7, enumerable: true }, - COMMENT_NODE: { value: 8, enumerable: true }, - DOCUMENT_NODE: { value: 9, enumerable: true }, - DOCUMENT_TYPE_NODE: { value: 10, enumerable: true }, - DOCUMENT_FRAGMENT_NODE: { value: 11, enumerable: true }, - NOTATION_NODE: { value: 12, enumerable: true }, - DOCUMENT_POSITION_DISCONNECTED: { value: 0x01, enumerable: true }, - DOCUMENT_POSITION_PRECEDING: { value: 0x02, enumerable: true }, - DOCUMENT_POSITION_FOLLOWING: { value: 0x04, enumerable: true }, - DOCUMENT_POSITION_CONTAINS: { value: 0x08, enumerable: true }, - DOCUMENT_POSITION_CONTAINED_BY: { value: 0x10, enumerable: true }, - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: { value: 0x20, enumerable: true } - }); - ctorRegistry[interfaceName] = Node; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Node - }); -}; - -const Impl = require("../nodes/Node-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NodeFilter.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NodeFilter.js deleted file mode 100644 index e7c2840..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NodeFilter.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (!utils.isObject(value)) { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - function callTheUserObjectsOperation(node) { - let thisArg = utils.tryWrapperForImpl(this); - let O = value; - let X = O; - - if (typeof O !== "function") { - X = O["acceptNode"]; - if (typeof X !== "function") { - throw new globalObject.TypeError(`${context} does not correctly implement NodeFilter.`); - } - thisArg = O; - } - - node = utils.tryWrapperForImpl(node); - - let callResult = Reflect.apply(X, thisArg, [node]); - - callResult = conversions["unsigned short"](callResult, { context: context, globals: globalObject }); - - return callResult; - } - - callTheUserObjectsOperation[utils.wrapperSymbol] = value; - callTheUserObjectsOperation.objectReference = value; - - return callTheUserObjectsOperation; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - const NodeFilter = () => { - throw new globalObject.TypeError("Illegal invocation"); - }; - - Object.defineProperties(NodeFilter, { - FILTER_ACCEPT: { value: 1, enumerable: true }, - FILTER_REJECT: { value: 2, enumerable: true }, - FILTER_SKIP: { value: 3, enumerable: true }, - SHOW_ALL: { value: 0xffffffff, enumerable: true }, - SHOW_ELEMENT: { value: 0x1, enumerable: true }, - SHOW_ATTRIBUTE: { value: 0x2, enumerable: true }, - SHOW_TEXT: { value: 0x4, enumerable: true }, - SHOW_CDATA_SECTION: { value: 0x8, enumerable: true }, - SHOW_ENTITY_REFERENCE: { value: 0x10, enumerable: true }, - SHOW_ENTITY: { value: 0x20, enumerable: true }, - SHOW_PROCESSING_INSTRUCTION: { value: 0x40, enumerable: true }, - SHOW_COMMENT: { value: 0x80, enumerable: true }, - SHOW_DOCUMENT: { value: 0x100, enumerable: true }, - SHOW_DOCUMENT_TYPE: { value: 0x200, enumerable: true }, - SHOW_DOCUMENT_FRAGMENT: { value: 0x400, enumerable: true }, - SHOW_NOTATION: { value: 0x800, enumerable: true } - }); - - Object.defineProperty(globalObject, "NodeFilter", { - configurable: true, - writable: true, - value: NodeFilter - }); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NodeIterator.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NodeIterator.js deleted file mode 100644 index 7cae0bf..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NodeIterator.js +++ /dev/null @@ -1,207 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "NodeIterator"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'NodeIterator'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["NodeIterator"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class NodeIterator { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - nextNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'nextNode' called on an object that is not a valid instance of NodeIterator." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].nextNode()); - } - - previousNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'previousNode' called on an object that is not a valid instance of NodeIterator." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].previousNode()); - } - - detach() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'detach' called on an object that is not a valid instance of NodeIterator."); - } - - return esValue[implSymbol].detach(); - } - - get root() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get root' called on an object that is not a valid instance of NodeIterator." - ); - } - - return utils.getSameObject(this, "root", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["root"]); - }); - } - - get referenceNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get referenceNode' called on an object that is not a valid instance of NodeIterator." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["referenceNode"]); - } - - get pointerBeforeReferenceNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pointerBeforeReferenceNode' called on an object that is not a valid instance of NodeIterator." - ); - } - - return esValue[implSymbol]["pointerBeforeReferenceNode"]; - } - - get whatToShow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get whatToShow' called on an object that is not a valid instance of NodeIterator." - ); - } - - return esValue[implSymbol]["whatToShow"]; - } - - get filter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get filter' called on an object that is not a valid instance of NodeIterator." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["filter"]); - } - } - Object.defineProperties(NodeIterator.prototype, { - nextNode: { enumerable: true }, - previousNode: { enumerable: true }, - detach: { enumerable: true }, - root: { enumerable: true }, - referenceNode: { enumerable: true }, - pointerBeforeReferenceNode: { enumerable: true }, - whatToShow: { enumerable: true }, - filter: { enumerable: true }, - [Symbol.toStringTag]: { value: "NodeIterator", configurable: true } - }); - ctorRegistry[interfaceName] = NodeIterator; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: NodeIterator - }); -}; - -const Impl = require("../traversal/NodeIterator-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NodeList.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NodeList.js deleted file mode 100644 index 57e864d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/NodeList.js +++ /dev/null @@ -1,302 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "NodeList"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'NodeList'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["NodeList"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class NodeList { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'item' called on an object that is not a valid instance of NodeList."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'NodeList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'NodeList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get length' called on an object that is not a valid instance of NodeList."); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(NodeList.prototype, { - item: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "NodeList", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true }, - keys: { value: globalObject.Array.prototype.keys, configurable: true, enumerable: true, writable: true }, - values: { value: globalObject.Array.prototype.values, configurable: true, enumerable: true, writable: true }, - entries: { value: globalObject.Array.prototype.entries, configurable: true, enumerable: true, writable: true }, - forEach: { value: globalObject.Array.prototype.forEach, configurable: true, enumerable: true, writable: true } - }); - ctorRegistry[interfaceName] = NodeList; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: NodeList - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../nodes/NodeList-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/OnBeforeUnloadEventHandlerNonNull.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/OnBeforeUnloadEventHandlerNonNull.js deleted file mode 100644 index 571d110..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/OnBeforeUnloadEventHandlerNonNull.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - function invokeTheCallbackFunction(event) { - const thisArg = utils.tryWrapperForImpl(this); - let callResult; - - if (typeof value === "function") { - event = utils.tryWrapperForImpl(event); - - callResult = Reflect.apply(value, thisArg, [event]); - } - - if (callResult === null || callResult === undefined) { - callResult = null; - } else { - callResult = conversions["DOMString"](callResult, { context: context, globals: globalObject }); - } - return callResult; - } - - invokeTheCallbackFunction.construct = event => { - event = utils.tryWrapperForImpl(event); - - let callResult = Reflect.construct(value, [event]); - - if (callResult === null || callResult === undefined) { - callResult = null; - } else { - callResult = conversions["DOMString"](callResult, { context: context, globals: globalObject }); - } - return callResult; - }; - - invokeTheCallbackFunction[utils.wrapperSymbol] = value; - invokeTheCallbackFunction.objectReference = value; - - return invokeTheCallbackFunction; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/OnErrorEventHandlerNonNull.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/OnErrorEventHandlerNonNull.js deleted file mode 100644 index 11e6408..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/OnErrorEventHandlerNonNull.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - function invokeTheCallbackFunction(...args) { - const thisArg = utils.tryWrapperForImpl(this); - let callResult; - - if (typeof value === "function") { - for (let i = 0; i < Math.min(args.length, 5); i++) { - args[i] = utils.tryWrapperForImpl(args[i]); - } - - if (args.length < 1) { - for (let i = args.length; i < 1; i++) { - args[i] = undefined; - } - } else if (args.length > 5) { - args.length = 5; - } - - callResult = Reflect.apply(value, thisArg, args); - } - - callResult = conversions["any"](callResult, { context: context, globals: globalObject }); - - return callResult; - } - - invokeTheCallbackFunction.construct = (...args) => { - for (let i = 0; i < Math.min(args.length, 5); i++) { - args[i] = utils.tryWrapperForImpl(args[i]); - } - - if (args.length < 1) { - for (let i = args.length; i < 1; i++) { - args[i] = undefined; - } - } else if (args.length > 5) { - args.length = 5; - } - - let callResult = Reflect.construct(value, args); - - callResult = conversions["any"](callResult, { context: context, globals: globalObject }); - - return callResult; - }; - - invokeTheCallbackFunction[utils.wrapperSymbol] = value; - invokeTheCallbackFunction.objectReference = value; - - return invokeTheCallbackFunction; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PageTransitionEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PageTransitionEvent.js deleted file mode 100644 index 4e8d69c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PageTransitionEvent.js +++ /dev/null @@ -1,144 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const PageTransitionEventInit = require("./PageTransitionEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "PageTransitionEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'PageTransitionEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["PageTransitionEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class PageTransitionEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'PageTransitionEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'PageTransitionEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = PageTransitionEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'PageTransitionEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get persisted() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get persisted' called on an object that is not a valid instance of PageTransitionEvent." - ); - } - - return esValue[implSymbol]["persisted"]; - } - } - Object.defineProperties(PageTransitionEvent.prototype, { - persisted: { enumerable: true }, - [Symbol.toStringTag]: { value: "PageTransitionEvent", configurable: true } - }); - ctorRegistry[interfaceName] = PageTransitionEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: PageTransitionEvent - }); -}; - -const Impl = require("../events/PageTransitionEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PageTransitionEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PageTransitionEventInit.js deleted file mode 100644 index 008ee18..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PageTransitionEventInit.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "persisted"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'persisted' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Performance.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Performance.js deleted file mode 100644 index 285f6fc..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Performance.js +++ /dev/null @@ -1,142 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const EventTarget = require("./EventTarget.js"); - -const interfaceName = "Performance"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Performance'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Performance"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - EventTarget._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Performance extends globalObject.EventTarget { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - now() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'now' called on an object that is not a valid instance of Performance."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].now()); - } - - toJSON() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'toJSON' called on an object that is not a valid instance of Performance."); - } - - return esValue[implSymbol].toJSON(); - } - - get timeOrigin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get timeOrigin' called on an object that is not a valid instance of Performance." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["timeOrigin"]); - } - } - Object.defineProperties(Performance.prototype, { - now: { enumerable: true }, - toJSON: { enumerable: true }, - timeOrigin: { enumerable: true }, - [Symbol.toStringTag]: { value: "Performance", configurable: true } - }); - ctorRegistry[interfaceName] = Performance; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Performance - }); -}; - -const Impl = require("../hr-time/Performance-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Plugin.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Plugin.js deleted file mode 100644 index bb799c1..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Plugin.js +++ /dev/null @@ -1,359 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Plugin"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Plugin'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Plugin"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Plugin { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'item' called on an object that is not a valid instance of Plugin."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'Plugin': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'Plugin': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].item(...args); - } - - namedItem(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'namedItem' called on an object that is not a valid instance of Plugin."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'namedItem' on 'Plugin': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'namedItem' on 'Plugin': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].namedItem(...args); - } - - get name() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get name' called on an object that is not a valid instance of Plugin."); - } - - return esValue[implSymbol]["name"]; - } - - get description() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get description' called on an object that is not a valid instance of Plugin." - ); - } - - return esValue[implSymbol]["description"]; - } - - get filename() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get filename' called on an object that is not a valid instance of Plugin."); - } - - return esValue[implSymbol]["filename"]; - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get length' called on an object that is not a valid instance of Plugin."); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(Plugin.prototype, { - item: { enumerable: true }, - namedItem: { enumerable: true }, - name: { enumerable: true }, - description: { enumerable: true }, - filename: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "Plugin", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = Plugin; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Plugin - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - - if (target[implSymbol][utils.supportsPropertyIndex](index)) { - const indexedValue = target[implSymbol].item(index); - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - - if (target[implSymbol][utils.supportsPropertyIndex](index)) { - const indexedValue = target[implSymbol].item(index); - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !target[implSymbol][utils.supportsPropertyIndex](index); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../navigator/Plugin-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PluginArray.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PluginArray.js deleted file mode 100644 index 5a5e13e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PluginArray.js +++ /dev/null @@ -1,336 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "PluginArray"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'PluginArray'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["PluginArray"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class PluginArray { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - refresh() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'refresh' called on an object that is not a valid instance of PluginArray."); - } - - return esValue[implSymbol].refresh(); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'item' called on an object that is not a valid instance of PluginArray."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'PluginArray': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'PluginArray': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].item(...args); - } - - namedItem(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'namedItem' called on an object that is not a valid instance of PluginArray." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'namedItem' on 'PluginArray': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'namedItem' on 'PluginArray': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].namedItem(...args); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of PluginArray." - ); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(PluginArray.prototype, { - refresh: { enumerable: true }, - item: { enumerable: true }, - namedItem: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "PluginArray", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = PluginArray; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: PluginArray - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../navigator/PluginArray-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PointerEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PointerEvent.js deleted file mode 100644 index c5fa7c0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PointerEvent.js +++ /dev/null @@ -1,324 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const PointerEventInit = require("./PointerEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const MouseEvent = require("./MouseEvent.js"); - -const interfaceName = "PointerEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'PointerEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["PointerEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - MouseEvent._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class PointerEvent extends globalObject.MouseEvent { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'PointerEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'PointerEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = PointerEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'PointerEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - getCoalescedEvents() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getCoalescedEvents' called on an object that is not a valid instance of PointerEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].getCoalescedEvents()); - } - - getPredictedEvents() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getPredictedEvents' called on an object that is not a valid instance of PointerEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].getPredictedEvents()); - } - - get pointerId() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pointerId' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["pointerId"]; - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get width' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["width"]; - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get height' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["height"]; - } - - get pressure() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pressure' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["pressure"]; - } - - get tangentialPressure() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tangentialPressure' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["tangentialPressure"]; - } - - get tiltX() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tiltX' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["tiltX"]; - } - - get tiltY() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tiltY' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["tiltY"]; - } - - get twist() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get twist' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["twist"]; - } - - get altitudeAngle() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get altitudeAngle' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["altitudeAngle"]; - } - - get azimuthAngle() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get azimuthAngle' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["azimuthAngle"]; - } - - get pointerType() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pointerType' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["pointerType"]; - } - - get isPrimary() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get isPrimary' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["isPrimary"]; - } - - get persistentDeviceId() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get persistentDeviceId' called on an object that is not a valid instance of PointerEvent." - ); - } - - return esValue[implSymbol]["persistentDeviceId"]; - } - } - Object.defineProperties(PointerEvent.prototype, { - getCoalescedEvents: { enumerable: true }, - getPredictedEvents: { enumerable: true }, - pointerId: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - pressure: { enumerable: true }, - tangentialPressure: { enumerable: true }, - tiltX: { enumerable: true }, - tiltY: { enumerable: true }, - twist: { enumerable: true }, - altitudeAngle: { enumerable: true }, - azimuthAngle: { enumerable: true }, - pointerType: { enumerable: true }, - isPrimary: { enumerable: true }, - persistentDeviceId: { enumerable: true }, - [Symbol.toStringTag]: { value: "PointerEvent", configurable: true } - }); - ctorRegistry[interfaceName] = PointerEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: PointerEvent - }); -}; - -const Impl = require("../events/PointerEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PointerEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PointerEventInit.js deleted file mode 100644 index 3e499b9..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PointerEventInit.js +++ /dev/null @@ -1,241 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const PointerEvent = require("./PointerEvent.js"); -const MouseEventInit = require("./MouseEventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - MouseEventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "altitudeAngle"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { - context: context + " has member 'altitudeAngle' that", - globals: globalObject - }); - - ret[key] = value; - } - } - - { - const key = "azimuthAngle"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { - context: context + " has member 'azimuthAngle' that", - globals: globalObject - }); - - ret[key] = value; - } - } - - { - const key = "coalescedEvents"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (!utils.isObject(value)) { - throw new globalObject.TypeError( - context + " has member 'coalescedEvents' that" + " is not an iterable object." - ); - } else { - const V = []; - const tmp = value; - for (let nextItem of tmp) { - nextItem = PointerEvent.convert(globalObject, nextItem, { - context: context + " has member 'coalescedEvents' that" + "'s element" - }); - - V.push(nextItem); - } - value = V; - } - - ret[key] = value; - } else { - ret[key] = []; - } - } - - { - const key = "height"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'height' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 1; - } - } - - { - const key = "isPrimary"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'isPrimary' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "persistentDeviceId"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { - context: context + " has member 'persistentDeviceId' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "pointerId"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { context: context + " has member 'pointerId' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "pointerType"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { - context: context + " has member 'pointerType' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "predictedEvents"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (!utils.isObject(value)) { - throw new globalObject.TypeError( - context + " has member 'predictedEvents' that" + " is not an iterable object." - ); - } else { - const V = []; - const tmp = value; - for (let nextItem of tmp) { - nextItem = PointerEvent.convert(globalObject, nextItem, { - context: context + " has member 'predictedEvents' that" + "'s element" - }); - - V.push(nextItem); - } - value = V; - } - - ret[key] = value; - } else { - ret[key] = []; - } - } - - { - const key = "pressure"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["float"](value, { context: context + " has member 'pressure' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "tangentialPressure"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["float"](value, { - context: context + " has member 'tangentialPressure' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "tiltX"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { context: context + " has member 'tiltX' that", globals: globalObject }); - - ret[key] = value; - } - } - - { - const key = "tiltY"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { context: context + " has member 'tiltY' that", globals: globalObject }); - - ret[key] = value; - } - } - - { - const key = "twist"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { context: context + " has member 'twist' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "width"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'width' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 1; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PopStateEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PopStateEvent.js deleted file mode 100644 index 1bf940f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PopStateEvent.js +++ /dev/null @@ -1,144 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const PopStateEventInit = require("./PopStateEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "PopStateEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'PopStateEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["PopStateEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class PopStateEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'PopStateEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'PopStateEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = PopStateEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'PopStateEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get state() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get state' called on an object that is not a valid instance of PopStateEvent." - ); - } - - return esValue[implSymbol]["state"]; - } - } - Object.defineProperties(PopStateEvent.prototype, { - state: { enumerable: true }, - [Symbol.toStringTag]: { value: "PopStateEvent", configurable: true } - }); - ctorRegistry[interfaceName] = PopStateEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: PopStateEvent - }); -}; - -const Impl = require("../events/PopStateEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PopStateEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PopStateEventInit.js deleted file mode 100644 index 79ecec8..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PopStateEventInit.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "state"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["any"](value, { context: context + " has member 'state' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = null; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ProcessingInstruction.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ProcessingInstruction.js deleted file mode 100644 index d62d98c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ProcessingInstruction.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const CharacterData = require("./CharacterData.js"); - -const interfaceName = "ProcessingInstruction"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'ProcessingInstruction'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["ProcessingInstruction"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - CharacterData._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class ProcessingInstruction extends globalObject.CharacterData { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get target() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get target' called on an object that is not a valid instance of ProcessingInstruction." - ); - } - - return esValue[implSymbol]["target"]; - } - } - Object.defineProperties(ProcessingInstruction.prototype, { - target: { enumerable: true }, - [Symbol.toStringTag]: { value: "ProcessingInstruction", configurable: true } - }); - ctorRegistry[interfaceName] = ProcessingInstruction; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: ProcessingInstruction - }); -}; - -const Impl = require("../nodes/ProcessingInstruction-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ProgressEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ProgressEvent.js deleted file mode 100644 index 5a31ed5..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ProgressEvent.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ProgressEventInit = require("./ProgressEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "ProgressEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'ProgressEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["ProgressEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "DedicatedWorker", "SharedWorker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class ProgressEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'ProgressEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'ProgressEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = ProgressEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'ProgressEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get lengthComputable() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get lengthComputable' called on an object that is not a valid instance of ProgressEvent." - ); - } - - return esValue[implSymbol]["lengthComputable"]; - } - - get loaded() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get loaded' called on an object that is not a valid instance of ProgressEvent." - ); - } - - return esValue[implSymbol]["loaded"]; - } - - get total() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get total' called on an object that is not a valid instance of ProgressEvent." - ); - } - - return esValue[implSymbol]["total"]; - } - } - Object.defineProperties(ProgressEvent.prototype, { - lengthComputable: { enumerable: true }, - loaded: { enumerable: true }, - total: { enumerable: true }, - [Symbol.toStringTag]: { value: "ProgressEvent", configurable: true } - }); - ctorRegistry[interfaceName] = ProgressEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: ProgressEvent - }); -}; - -const Impl = require("../events/ProgressEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ProgressEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ProgressEventInit.js deleted file mode 100644 index 2738568..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ProgressEventInit.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "lengthComputable"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'lengthComputable' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "loaded"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long long"](value, { - context: context + " has member 'loaded' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "total"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long long"](value, { - context: context + " has member 'total' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PromiseRejectionEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PromiseRejectionEvent.js deleted file mode 100644 index 4242932..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PromiseRejectionEvent.js +++ /dev/null @@ -1,157 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const PromiseRejectionEventInit = require("./PromiseRejectionEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "PromiseRejectionEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'PromiseRejectionEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["PromiseRejectionEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class PromiseRejectionEvent extends globalObject.Event { - constructor(type, eventInitDict) { - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to construct 'PromiseRejectionEvent': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'PromiseRejectionEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = PromiseRejectionEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'PromiseRejectionEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get promise() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get promise' called on an object that is not a valid instance of PromiseRejectionEvent." - ); - } - - return esValue[implSymbol]["promise"]; - } - - get reason() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get reason' called on an object that is not a valid instance of PromiseRejectionEvent." - ); - } - - return esValue[implSymbol]["reason"]; - } - } - Object.defineProperties(PromiseRejectionEvent.prototype, { - promise: { enumerable: true }, - reason: { enumerable: true }, - [Symbol.toStringTag]: { value: "PromiseRejectionEvent", configurable: true } - }); - ctorRegistry[interfaceName] = PromiseRejectionEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: PromiseRejectionEvent - }); -}; - -const Impl = require("../events/PromiseRejectionEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PromiseRejectionEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PromiseRejectionEventInit.js deleted file mode 100644 index eea4d8d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/PromiseRejectionEventInit.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "promise"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["object"](value, { context: context + " has member 'promise' that", globals: globalObject }); - - ret[key] = value; - } else { - throw new globalObject.TypeError("promise is required in 'PromiseRejectionEventInit'"); - } - } - - { - const key = "reason"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["any"](value, { context: context + " has member 'reason' that", globals: globalObject }); - - ret[key] = value; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/RadioNodeList.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/RadioNodeList.js deleted file mode 100644 index b1e3a15..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/RadioNodeList.js +++ /dev/null @@ -1,296 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const NodeList = require("./NodeList.js"); - -const interfaceName = "RadioNodeList"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'RadioNodeList'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["RadioNodeList"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - NodeList._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class RadioNodeList extends globalObject.NodeList { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get value' called on an object that is not a valid instance of RadioNodeList." - ); - } - - return esValue[implSymbol]["value"]; - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set value' called on an object that is not a valid instance of RadioNodeList." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'value' property on 'RadioNodeList': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["value"] = V; - } - } - Object.defineProperties(RadioNodeList.prototype, { - value: { enumerable: true }, - [Symbol.toStringTag]: { value: "RadioNodeList", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = RadioNodeList; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: RadioNodeList - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../nodes/RadioNodeList-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Range.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Range.js deleted file mode 100644 index be62e10..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Range.js +++ /dev/null @@ -1,641 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Node = require("./Node.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const AbstractRange = require("./AbstractRange.js"); - -const interfaceName = "Range"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Range'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Range"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - AbstractRange._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Range extends globalObject.AbstractRange { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - setStart(node, offset) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'setStart' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'setStart' on 'Range': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'setStart' on 'Range': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setStart' on 'Range': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setStart(...args); - } - - setEnd(node, offset) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'setEnd' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'setEnd' on 'Range': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { context: "Failed to execute 'setEnd' on 'Range': parameter 1" }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setEnd' on 'Range': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setEnd(...args); - } - - setStartBefore(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'setStartBefore' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setStartBefore' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'setStartBefore' on 'Range': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].setStartBefore(...args); - } - - setStartAfter(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'setStartAfter' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setStartAfter' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'setStartAfter' on 'Range': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].setStartAfter(...args); - } - - setEndBefore(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'setEndBefore' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setEndBefore' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'setEndBefore' on 'Range': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].setEndBefore(...args); - } - - setEndAfter(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'setEndAfter' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setEndAfter' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'setEndAfter' on 'Range': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].setEndAfter(...args); - } - - collapse() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'collapse' called on an object that is not a valid instance of Range."); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'collapse' on 'Range': parameter 1", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - return esValue[implSymbol].collapse(...args); - } - - selectNode(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'selectNode' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'selectNode' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'selectNode' on 'Range': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].selectNode(...args); - } - - selectNodeContents(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'selectNodeContents' called on an object that is not a valid instance of Range." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'selectNodeContents' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'selectNodeContents' on 'Range': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].selectNodeContents(...args); - } - - compareBoundaryPoints(how, sourceRange) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'compareBoundaryPoints' called on an object that is not a valid instance of Range." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'compareBoundaryPoints' on 'Range': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned short"](curArg, { - context: "Failed to execute 'compareBoundaryPoints' on 'Range': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = exports.convert(globalObject, curArg, { - context: "Failed to execute 'compareBoundaryPoints' on 'Range': parameter 2" - }); - args.push(curArg); - } - return esValue[implSymbol].compareBoundaryPoints(...args); - } - - deleteContents() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'deleteContents' called on an object that is not a valid instance of Range."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].deleteContents(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - extractContents() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'extractContents' called on an object that is not a valid instance of Range." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].extractContents()); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - cloneContents() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'cloneContents' called on an object that is not a valid instance of Range."); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].cloneContents()); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - insertNode(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'insertNode' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'insertNode' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'insertNode' on 'Range': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].insertNode(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - surroundContents(newParent) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'surroundContents' called on an object that is not a valid instance of Range." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'surroundContents' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'surroundContents' on 'Range': parameter 1" - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].surroundContents(...args); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - cloneRange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'cloneRange' called on an object that is not a valid instance of Range."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].cloneRange()); - } - - detach() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'detach' called on an object that is not a valid instance of Range."); - } - - return esValue[implSymbol].detach(); - } - - isPointInRange(node, offset) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'isPointInRange' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'isPointInRange' on 'Range': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'isPointInRange' on 'Range': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'isPointInRange' on 'Range': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].isPointInRange(...args); - } - - comparePoint(node, offset) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'comparePoint' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'comparePoint' on 'Range': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'comparePoint' on 'Range': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'comparePoint' on 'Range': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].comparePoint(...args); - } - - intersectsNode(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'intersectsNode' called on an object that is not a valid instance of Range."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'intersectsNode' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'intersectsNode' on 'Range': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].intersectsNode(...args); - } - - toString() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'toString' called on an object that is not a valid instance of Range."); - } - - return esValue[implSymbol].toString(); - } - - createContextualFragment(fragment) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createContextualFragment' called on an object that is not a valid instance of Range." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'createContextualFragment' on 'Range': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'createContextualFragment' on 'Range': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return utils.tryWrapperForImpl(esValue[implSymbol].createContextualFragment(...args)); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get commonAncestorContainer() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get commonAncestorContainer' called on an object that is not a valid instance of Range." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["commonAncestorContainer"]); - } - } - Object.defineProperties(Range.prototype, { - setStart: { enumerable: true }, - setEnd: { enumerable: true }, - setStartBefore: { enumerable: true }, - setStartAfter: { enumerable: true }, - setEndBefore: { enumerable: true }, - setEndAfter: { enumerable: true }, - collapse: { enumerable: true }, - selectNode: { enumerable: true }, - selectNodeContents: { enumerable: true }, - compareBoundaryPoints: { enumerable: true }, - deleteContents: { enumerable: true }, - extractContents: { enumerable: true }, - cloneContents: { enumerable: true }, - insertNode: { enumerable: true }, - surroundContents: { enumerable: true }, - cloneRange: { enumerable: true }, - detach: { enumerable: true }, - isPointInRange: { enumerable: true }, - comparePoint: { enumerable: true }, - intersectsNode: { enumerable: true }, - toString: { enumerable: true }, - createContextualFragment: { enumerable: true }, - commonAncestorContainer: { enumerable: true }, - [Symbol.toStringTag]: { value: "Range", configurable: true }, - START_TO_START: { value: 0, enumerable: true }, - START_TO_END: { value: 1, enumerable: true }, - END_TO_END: { value: 2, enumerable: true }, - END_TO_START: { value: 3, enumerable: true } - }); - Object.defineProperties(Range, { - START_TO_START: { value: 0, enumerable: true }, - START_TO_END: { value: 1, enumerable: true }, - END_TO_END: { value: 2, enumerable: true }, - END_TO_START: { value: 3, enumerable: true } - }); - ctorRegistry[interfaceName] = Range; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Range - }); -}; - -const Impl = require("../range/Range-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedPreserveAspectRatio.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedPreserveAspectRatio.js deleted file mode 100644 index af253df..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedPreserveAspectRatio.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "SVGAnimatedPreserveAspectRatio"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGAnimatedPreserveAspectRatio'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGAnimatedPreserveAspectRatio"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGAnimatedPreserveAspectRatio { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get baseVal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get baseVal' called on an object that is not a valid instance of SVGAnimatedPreserveAspectRatio." - ); - } - - return utils.getSameObject(this, "baseVal", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["baseVal"]); - }); - } - - get animVal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get animVal' called on an object that is not a valid instance of SVGAnimatedPreserveAspectRatio." - ); - } - - return utils.getSameObject(this, "animVal", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["animVal"]); - }); - } - } - Object.defineProperties(SVGAnimatedPreserveAspectRatio.prototype, { - baseVal: { enumerable: true }, - animVal: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGAnimatedPreserveAspectRatio", configurable: true } - }); - ctorRegistry[interfaceName] = SVGAnimatedPreserveAspectRatio; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGAnimatedPreserveAspectRatio - }); -}; - -const Impl = require("../svg/SVGAnimatedPreserveAspectRatio-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedRect.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedRect.js deleted file mode 100644 index 6641340..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedRect.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "SVGAnimatedRect"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGAnimatedRect'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGAnimatedRect"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGAnimatedRect { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get baseVal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get baseVal' called on an object that is not a valid instance of SVGAnimatedRect." - ); - } - - return utils.getSameObject(this, "baseVal", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["baseVal"]); - }); - } - - get animVal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get animVal' called on an object that is not a valid instance of SVGAnimatedRect." - ); - } - - return utils.getSameObject(this, "animVal", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["animVal"]); - }); - } - } - Object.defineProperties(SVGAnimatedRect.prototype, { - baseVal: { enumerable: true }, - animVal: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGAnimatedRect", configurable: true } - }); - ctorRegistry[interfaceName] = SVGAnimatedRect; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGAnimatedRect - }); -}; - -const Impl = require("../svg/SVGAnimatedRect-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedString.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedString.js deleted file mode 100644 index 713db35..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedString.js +++ /dev/null @@ -1,149 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "SVGAnimatedString"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGAnimatedString'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGAnimatedString"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGAnimatedString { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get baseVal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get baseVal' called on an object that is not a valid instance of SVGAnimatedString." - ); - } - - return esValue[implSymbol]["baseVal"]; - } - - set baseVal(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set baseVal' called on an object that is not a valid instance of SVGAnimatedString." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'baseVal' property on 'SVGAnimatedString': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["baseVal"] = V; - } - - get animVal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get animVal' called on an object that is not a valid instance of SVGAnimatedString." - ); - } - - return esValue[implSymbol]["animVal"]; - } - } - Object.defineProperties(SVGAnimatedString.prototype, { - baseVal: { enumerable: true }, - animVal: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGAnimatedString", configurable: true } - }); - ctorRegistry[interfaceName] = SVGAnimatedString; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGAnimatedString - }); -}; - -const Impl = require("../svg/SVGAnimatedString-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGBoundingBoxOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGBoundingBoxOptions.js deleted file mode 100644 index 7d1b2c5..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGBoundingBoxOptions.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "clipped"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'clipped' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "fill"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'fill' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = true; - } - } - - { - const key = "markers"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'markers' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "stroke"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'stroke' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGDefsElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGDefsElement.js deleted file mode 100644 index b3423fa..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGDefsElement.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const SVGGraphicsElement = require("./SVGGraphicsElement.js"); - -const interfaceName = "SVGDefsElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGDefsElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGDefsElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - SVGGraphicsElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGDefsElement extends globalObject.SVGGraphicsElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(SVGDefsElement.prototype, { - [Symbol.toStringTag]: { value: "SVGDefsElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGDefsElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGDefsElement - }); -}; - -const Impl = require("../nodes/SVGDefsElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGDescElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGDescElement.js deleted file mode 100644 index 0c17e60..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGDescElement.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const SVGElement = require("./SVGElement.js"); - -const interfaceName = "SVGDescElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGDescElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGDescElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - SVGElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGDescElement extends globalObject.SVGElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(SVGDescElement.prototype, { - [Symbol.toStringTag]: { value: "SVGDescElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGDescElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGDescElement - }); -}; - -const Impl = require("../nodes/SVGDescElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGElement.js deleted file mode 100644 index 678b00e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGElement.js +++ /dev/null @@ -1,3155 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const create_SVGAnimatedString = require("./SVGAnimatedString.js").create; -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const OnErrorEventHandlerNonNull = require("./OnErrorEventHandlerNonNull.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Element = require("./Element.js"); - -const interfaceName = "SVGElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Element._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGElement extends globalObject.Element { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - focus() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'focus' called on an object that is not a valid instance of SVGElement."); - } - - return esValue[implSymbol].focus(); - } - - blur() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'blur' called on an object that is not a valid instance of SVGElement."); - } - - return esValue[implSymbol].blur(); - } - - get className() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get className' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.getSameObject(this, "className", () => { - return create_SVGAnimatedString(globalObject, [], { - element: esValue[implSymbol], - attribute: "class" - }); - }); - } - - get ownerSVGElement() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ownerSVGElement' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ownerSVGElement"]); - } - - get viewportElement() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get viewportElement' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["viewportElement"]); - } - - get style() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get style' called on an object that is not a valid instance of SVGElement."); - } - - return utils.getSameObject(this, "style", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["style"]); - }); - } - - set style(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set style' called on an object that is not a valid instance of SVGElement."); - } - - const Q = esValue["style"]; - if (!utils.isObject(Q)) { - throw new globalObject.TypeError("Property 'style' is not an object"); - } - Reflect.set(Q, "cssText", V); - } - - get onabort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onabort' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onabort"]); - } - - set onabort(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onabort' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onabort' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onabort"] = V; - } - - get onauxclick() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onauxclick' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onauxclick"]); - } - - set onauxclick(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onauxclick' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onauxclick' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onauxclick"] = V; - } - - get onbeforeinput() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforeinput' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforeinput"]); - } - - set onbeforeinput(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforeinput' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforeinput' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onbeforeinput"] = V; - } - - get onbeforematch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforematch' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforematch"]); - } - - set onbeforematch(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforematch' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforematch' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onbeforematch"] = V; - } - - get onbeforetoggle() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforetoggle' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforetoggle"]); - } - - set onbeforetoggle(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforetoggle' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforetoggle' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onbeforetoggle"] = V; - } - - get onblur() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onblur' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onblur"]); - } - - set onblur(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onblur' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onblur' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onblur"] = V; - } - - get oncancel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncancel' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncancel"]); - } - - set oncancel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncancel' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncancel' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oncancel"] = V; - } - - get oncanplay() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncanplay' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncanplay"]); - } - - set oncanplay(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncanplay' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncanplay' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oncanplay"] = V; - } - - get oncanplaythrough() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncanplaythrough' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncanplaythrough"]); - } - - set oncanplaythrough(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncanplaythrough' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncanplaythrough' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oncanplaythrough"] = V; - } - - get onchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onchange' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onchange"]); - } - - set onchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onchange' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onchange' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onchange"] = V; - } - - get onclick() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onclick' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onclick"]); - } - - set onclick(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onclick' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onclick' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onclick"] = V; - } - - get onclose() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onclose' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onclose"]); - } - - set onclose(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onclose' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onclose' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onclose"] = V; - } - - get oncontextlost() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncontextlost' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextlost"]); - } - - set oncontextlost(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncontextlost' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncontextlost' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oncontextlost"] = V; - } - - get oncontextmenu() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncontextmenu' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextmenu"]); - } - - set oncontextmenu(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncontextmenu' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncontextmenu' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oncontextmenu"] = V; - } - - get oncontextrestored() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncontextrestored' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncontextrestored"]); - } - - set oncontextrestored(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncontextrestored' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncontextrestored' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oncontextrestored"] = V; - } - - get oncopy() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncopy' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncopy"]); - } - - set oncopy(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncopy' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncopy' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oncopy"] = V; - } - - get oncuechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oncuechange' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncuechange"]); - } - - set oncuechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oncuechange' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncuechange' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oncuechange"] = V; - } - - get oncut() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get oncut' called on an object that is not a valid instance of SVGElement."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oncut"]); - } - - set oncut(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set oncut' called on an object that is not a valid instance of SVGElement."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oncut' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oncut"] = V; - } - - get ondblclick() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondblclick' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondblclick"]); - } - - set ondblclick(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondblclick' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondblclick' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ondblclick"] = V; - } - - get ondrag() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondrag' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondrag"]); - } - - set ondrag(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondrag' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondrag' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ondrag"] = V; - } - - get ondragend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragend' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragend"]); - } - - set ondragend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragend' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragend' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ondragend"] = V; - } - - get ondragenter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragenter' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragenter"]); - } - - set ondragenter(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragenter' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragenter' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ondragenter"] = V; - } - - get ondragleave() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragleave' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragleave"]); - } - - set ondragleave(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragleave' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragleave' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ondragleave"] = V; - } - - get ondragover() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragover' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragover"]); - } - - set ondragover(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragover' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragover' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ondragover"] = V; - } - - get ondragstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondragstart' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondragstart"]); - } - - set ondragstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondragstart' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondragstart' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ondragstart"] = V; - } - - get ondrop() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondrop' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondrop"]); - } - - set ondrop(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondrop' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondrop' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ondrop"] = V; - } - - get ondurationchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ondurationchange' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ondurationchange"]); - } - - set ondurationchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ondurationchange' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ondurationchange' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ondurationchange"] = V; - } - - get onemptied() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onemptied' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onemptied"]); - } - - set onemptied(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onemptied' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onemptied' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onemptied"] = V; - } - - get onended() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onended' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onended"]); - } - - set onended(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onended' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onended' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onended"] = V; - } - - get onerror() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onerror' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onerror"]); - } - - set onerror(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onerror' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = OnErrorEventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onerror' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onerror"] = V; - } - - get onfocus() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onfocus' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onfocus"]); - } - - set onfocus(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onfocus' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onfocus' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onfocus"] = V; - } - - get onformdata() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onformdata' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onformdata"]); - } - - set onformdata(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onformdata' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onformdata' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onformdata"] = V; - } - - get oninput() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oninput' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oninput"]); - } - - set oninput(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oninput' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oninput' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oninput"] = V; - } - - get oninvalid() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oninvalid' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["oninvalid"]); - } - - set oninvalid(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set oninvalid' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'oninvalid' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["oninvalid"] = V; - } - - get onkeydown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onkeydown' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onkeydown"]); - } - - set onkeydown(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onkeydown' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onkeydown' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onkeydown"] = V; - } - - get onkeypress() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onkeypress' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onkeypress"]); - } - - set onkeypress(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onkeypress' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onkeypress' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onkeypress"] = V; - } - - get onkeyup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onkeyup' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onkeyup"]); - } - - set onkeyup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onkeyup' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onkeyup' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onkeyup"] = V; - } - - get onload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onload' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onload"]); - } - - set onload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onload' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onload' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onload"] = V; - } - - get onloadeddata() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadeddata' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadeddata"]); - } - - set onloadeddata(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadeddata' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadeddata' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onloadeddata"] = V; - } - - get onloadedmetadata() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadedmetadata' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadedmetadata"]); - } - - set onloadedmetadata(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadedmetadata' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadedmetadata' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onloadedmetadata"] = V; - } - - get onloadstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadstart' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadstart"]); - } - - set onloadstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadstart' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadstart' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onloadstart"] = V; - } - - get onmousedown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmousedown' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmousedown"]); - } - - set onmousedown(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmousedown' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmousedown' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onmousedown"] = V; - } - - get onmouseenter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseenter"]); - } - - set onmouseenter(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseenter' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onmouseenter"] = V; - } - - get onmouseleave() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseleave"]); - } - - set onmouseleave(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - return; - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseleave' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onmouseleave"] = V; - } - - get onmousemove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmousemove' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmousemove"]); - } - - set onmousemove(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmousemove' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmousemove' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onmousemove"] = V; - } - - get onmouseout() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmouseout' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseout"]); - } - - set onmouseout(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmouseout' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseout' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onmouseout"] = V; - } - - get onmouseover() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmouseover' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseover"]); - } - - set onmouseover(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmouseover' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseover' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onmouseover"] = V; - } - - get onmouseup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmouseup' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmouseup"]); - } - - set onmouseup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmouseup' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmouseup' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onmouseup"] = V; - } - - get onpaste() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpaste' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpaste"]); - } - - set onpaste(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpaste' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpaste' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpaste"] = V; - } - - get onpause() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpause' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpause"]); - } - - set onpause(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpause' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpause' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpause"] = V; - } - - get onplay() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onplay' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onplay"]); - } - - set onplay(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onplay' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onplay' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onplay"] = V; - } - - get onplaying() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onplaying' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onplaying"]); - } - - set onplaying(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onplaying' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onplaying' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onplaying"] = V; - } - - get onprogress() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onprogress' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onprogress"]); - } - - set onprogress(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onprogress' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onprogress' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onprogress"] = V; - } - - get onratechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onratechange' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onratechange"]); - } - - set onratechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onratechange' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onratechange' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onratechange"] = V; - } - - get onreset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onreset' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onreset"]); - } - - set onreset(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onreset' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onreset' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onreset"] = V; - } - - get onresize() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onresize' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onresize"]); - } - - set onresize(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onresize' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onresize' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onresize"] = V; - } - - get onscroll() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onscroll' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onscroll"]); - } - - set onscroll(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onscroll' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onscroll' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onscroll"] = V; - } - - get onscrollend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onscrollend' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onscrollend"]); - } - - set onscrollend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onscrollend' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onscrollend' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onscrollend"] = V; - } - - get onsecuritypolicyviolation() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onsecuritypolicyviolation' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onsecuritypolicyviolation"]); - } - - set onsecuritypolicyviolation(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onsecuritypolicyviolation' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onsecuritypolicyviolation' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onsecuritypolicyviolation"] = V; - } - - get onseeked() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onseeked' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onseeked"]); - } - - set onseeked(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onseeked' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onseeked' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onseeked"] = V; - } - - get onseeking() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onseeking' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onseeking"]); - } - - set onseeking(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onseeking' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onseeking' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onseeking"] = V; - } - - get onselect() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onselect' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onselect"]); - } - - set onselect(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onselect' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onselect' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onselect"] = V; - } - - get onslotchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onslotchange' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onslotchange"]); - } - - set onslotchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onslotchange' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onslotchange' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onslotchange"] = V; - } - - get onstalled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onstalled' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onstalled"]); - } - - set onstalled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onstalled' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onstalled' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onstalled"] = V; - } - - get onsubmit() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onsubmit' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onsubmit"]); - } - - set onsubmit(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onsubmit' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onsubmit' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onsubmit"] = V; - } - - get onsuspend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onsuspend' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onsuspend"]); - } - - set onsuspend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onsuspend' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onsuspend' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onsuspend"] = V; - } - - get ontimeupdate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontimeupdate' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontimeupdate"]); - } - - set ontimeupdate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontimeupdate' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontimeupdate' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ontimeupdate"] = V; - } - - get ontoggle() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontoggle' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontoggle"]); - } - - set ontoggle(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontoggle' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontoggle' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ontoggle"] = V; - } - - get onvolumechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onvolumechange' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onvolumechange"]); - } - - set onvolumechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onvolumechange' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onvolumechange' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onvolumechange"] = V; - } - - get onwaiting() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwaiting' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwaiting"]); - } - - set onwaiting(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwaiting' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwaiting' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onwaiting"] = V; - } - - get onwebkitanimationend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkitanimationend' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkitanimationend"]); - } - - set onwebkitanimationend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkitanimationend' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkitanimationend' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onwebkitanimationend"] = V; - } - - get onwebkitanimationiteration() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkitanimationiteration' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkitanimationiteration"]); - } - - set onwebkitanimationiteration(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkitanimationiteration' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkitanimationiteration' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onwebkitanimationiteration"] = V; - } - - get onwebkitanimationstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkitanimationstart' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkitanimationstart"]); - } - - set onwebkitanimationstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkitanimationstart' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkitanimationstart' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onwebkitanimationstart"] = V; - } - - get onwebkittransitionend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwebkittransitionend' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwebkittransitionend"]); - } - - set onwebkittransitionend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwebkittransitionend' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwebkittransitionend' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onwebkittransitionend"] = V; - } - - get onwheel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onwheel' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onwheel"]); - } - - set onwheel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onwheel' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onwheel' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onwheel"] = V; - } - - get ontouchstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchstart' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchstart"]); - } - - set ontouchstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchstart' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchstart' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ontouchstart"] = V; - } - - get ontouchend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchend' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchend"]); - } - - set ontouchend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchend' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchend' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ontouchend"] = V; - } - - get ontouchmove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchmove' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchmove"]); - } - - set ontouchmove(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchmove' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchmove' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ontouchmove"] = V; - } - - get ontouchcancel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontouchcancel' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontouchcancel"]); - } - - set ontouchcancel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontouchcancel' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontouchcancel' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ontouchcancel"] = V; - } - - get onpointerover() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerover' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerover"]); - } - - set onpointerover(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerover' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerover' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpointerover"] = V; - } - - get onpointerenter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerenter' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerenter"]); - } - - set onpointerenter(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerenter' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerenter' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpointerenter"] = V; - } - - get onpointerdown() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerdown' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerdown"]); - } - - set onpointerdown(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerdown' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerdown' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpointerdown"] = V; - } - - get onpointermove() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointermove' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointermove"]); - } - - set onpointermove(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointermove' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointermove' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpointermove"] = V; - } - - get onpointerrawupdate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerrawupdate' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerrawupdate"]); - } - - set onpointerrawupdate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerrawupdate' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerrawupdate' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpointerrawupdate"] = V; - } - - get onpointerup() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerup' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerup"]); - } - - set onpointerup(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerup' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerup' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpointerup"] = V; - } - - get onpointercancel() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointercancel' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointercancel"]); - } - - set onpointercancel(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointercancel' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointercancel' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpointercancel"] = V; - } - - get onpointerout() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerout' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerout"]); - } - - set onpointerout(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerout' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerout' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpointerout"] = V; - } - - get onpointerleave() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpointerleave' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpointerleave"]); - } - - set onpointerleave(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpointerleave' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpointerleave' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onpointerleave"] = V; - } - - get ongotpointercapture() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ongotpointercapture' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ongotpointercapture"]); - } - - set ongotpointercapture(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ongotpointercapture' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ongotpointercapture' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["ongotpointercapture"] = V; - } - - get onlostpointercapture() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onlostpointercapture' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onlostpointercapture"]); - } - - set onlostpointercapture(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onlostpointercapture' called on an object that is not a valid instance of SVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onlostpointercapture' property on 'SVGElement': The provided value" - }); - } - esValue[implSymbol]["onlostpointercapture"] = V; - } - - get dataset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get dataset' called on an object that is not a valid instance of SVGElement." - ); - } - - return utils.getSameObject(this, "dataset", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["dataset"]); - }); - } - - get nonce() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get nonce' called on an object that is not a valid instance of SVGElement."); - } - - const value = esValue[implSymbol]._reflectGetTheContentAttribute("nonce"); - return value === null ? "" : value; - } - - set nonce(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set nonce' called on an object that is not a valid instance of SVGElement."); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'nonce' property on 'SVGElement': The provided value", - globals: globalObject - }); - - esValue[implSymbol]._reflectSetTheContentAttribute("nonce", V); - } - - get tabIndex() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tabIndex' called on an object that is not a valid instance of SVGElement." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["tabIndex"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set tabIndex(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set tabIndex' called on an object that is not a valid instance of SVGElement." - ); - } - - V = conversions["long"](V, { - context: "Failed to set the 'tabIndex' property on 'SVGElement': The provided value", - globals: globalObject - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["tabIndex"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - } - Object.defineProperties(SVGElement.prototype, { - focus: { enumerable: true }, - blur: { enumerable: true }, - className: { enumerable: true }, - ownerSVGElement: { enumerable: true }, - viewportElement: { enumerable: true }, - style: { enumerable: true }, - onabort: { enumerable: true }, - onauxclick: { enumerable: true }, - onbeforeinput: { enumerable: true }, - onbeforematch: { enumerable: true }, - onbeforetoggle: { enumerable: true }, - onblur: { enumerable: true }, - oncancel: { enumerable: true }, - oncanplay: { enumerable: true }, - oncanplaythrough: { enumerable: true }, - onchange: { enumerable: true }, - onclick: { enumerable: true }, - onclose: { enumerable: true }, - oncontextlost: { enumerable: true }, - oncontextmenu: { enumerable: true }, - oncontextrestored: { enumerable: true }, - oncopy: { enumerable: true }, - oncuechange: { enumerable: true }, - oncut: { enumerable: true }, - ondblclick: { enumerable: true }, - ondrag: { enumerable: true }, - ondragend: { enumerable: true }, - ondragenter: { enumerable: true }, - ondragleave: { enumerable: true }, - ondragover: { enumerable: true }, - ondragstart: { enumerable: true }, - ondrop: { enumerable: true }, - ondurationchange: { enumerable: true }, - onemptied: { enumerable: true }, - onended: { enumerable: true }, - onerror: { enumerable: true }, - onfocus: { enumerable: true }, - onformdata: { enumerable: true }, - oninput: { enumerable: true }, - oninvalid: { enumerable: true }, - onkeydown: { enumerable: true }, - onkeypress: { enumerable: true }, - onkeyup: { enumerable: true }, - onload: { enumerable: true }, - onloadeddata: { enumerable: true }, - onloadedmetadata: { enumerable: true }, - onloadstart: { enumerable: true }, - onmousedown: { enumerable: true }, - onmouseenter: { enumerable: true }, - onmouseleave: { enumerable: true }, - onmousemove: { enumerable: true }, - onmouseout: { enumerable: true }, - onmouseover: { enumerable: true }, - onmouseup: { enumerable: true }, - onpaste: { enumerable: true }, - onpause: { enumerable: true }, - onplay: { enumerable: true }, - onplaying: { enumerable: true }, - onprogress: { enumerable: true }, - onratechange: { enumerable: true }, - onreset: { enumerable: true }, - onresize: { enumerable: true }, - onscroll: { enumerable: true }, - onscrollend: { enumerable: true }, - onsecuritypolicyviolation: { enumerable: true }, - onseeked: { enumerable: true }, - onseeking: { enumerable: true }, - onselect: { enumerable: true }, - onslotchange: { enumerable: true }, - onstalled: { enumerable: true }, - onsubmit: { enumerable: true }, - onsuspend: { enumerable: true }, - ontimeupdate: { enumerable: true }, - ontoggle: { enumerable: true }, - onvolumechange: { enumerable: true }, - onwaiting: { enumerable: true }, - onwebkitanimationend: { enumerable: true }, - onwebkitanimationiteration: { enumerable: true }, - onwebkitanimationstart: { enumerable: true }, - onwebkittransitionend: { enumerable: true }, - onwheel: { enumerable: true }, - ontouchstart: { enumerable: true }, - ontouchend: { enumerable: true }, - ontouchmove: { enumerable: true }, - ontouchcancel: { enumerable: true }, - onpointerover: { enumerable: true }, - onpointerenter: { enumerable: true }, - onpointerdown: { enumerable: true }, - onpointermove: { enumerable: true }, - onpointerrawupdate: { enumerable: true }, - onpointerup: { enumerable: true }, - onpointercancel: { enumerable: true }, - onpointerout: { enumerable: true }, - onpointerleave: { enumerable: true }, - ongotpointercapture: { enumerable: true }, - onlostpointercapture: { enumerable: true }, - dataset: { enumerable: true }, - nonce: { enumerable: true }, - tabIndex: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGElement - }); -}; - -const Impl = require("../nodes/SVGElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGGElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGGElement.js deleted file mode 100644 index b4fb95c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGGElement.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const SVGGraphicsElement = require("./SVGGraphicsElement.js"); - -const interfaceName = "SVGGElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGGElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGGElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - SVGGraphicsElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGGElement extends globalObject.SVGGraphicsElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(SVGGElement.prototype, { - [Symbol.toStringTag]: { value: "SVGGElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGGElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGGElement - }); -}; - -const Impl = require("../nodes/SVGGElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGGraphicsElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGGraphicsElement.js deleted file mode 100644 index 837990e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGGraphicsElement.js +++ /dev/null @@ -1,139 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const SVGElement = require("./SVGElement.js"); - -const interfaceName = "SVGGraphicsElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGGraphicsElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGGraphicsElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - SVGElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGGraphicsElement extends globalObject.SVGElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get requiredExtensions() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get requiredExtensions' called on an object that is not a valid instance of SVGGraphicsElement." - ); - } - - return utils.getSameObject(this, "requiredExtensions", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["requiredExtensions"]); - }); - } - - get systemLanguage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get systemLanguage' called on an object that is not a valid instance of SVGGraphicsElement." - ); - } - - return utils.getSameObject(this, "systemLanguage", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["systemLanguage"]); - }); - } - } - Object.defineProperties(SVGGraphicsElement.prototype, { - requiredExtensions: { enumerable: true }, - systemLanguage: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGGraphicsElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGGraphicsElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGGraphicsElement - }); -}; - -const Impl = require("../nodes/SVGGraphicsElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGMetadataElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGMetadataElement.js deleted file mode 100644 index 9ad2e77..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGMetadataElement.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const SVGElement = require("./SVGElement.js"); - -const interfaceName = "SVGMetadataElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGMetadataElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGMetadataElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - SVGElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGMetadataElement extends globalObject.SVGElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(SVGMetadataElement.prototype, { - [Symbol.toStringTag]: { value: "SVGMetadataElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGMetadataElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGMetadataElement - }); -}; - -const Impl = require("../nodes/SVGMetadataElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGNumber.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGNumber.js deleted file mode 100644 index 6a35e6f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGNumber.js +++ /dev/null @@ -1,132 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "SVGNumber"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGNumber'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGNumber"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGNumber { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get value() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get value' called on an object that is not a valid instance of SVGNumber."); - } - - return esValue[implSymbol]["value"]; - } - - set value(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set value' called on an object that is not a valid instance of SVGNumber."); - } - - V = conversions["float"](V, { - context: "Failed to set the 'value' property on 'SVGNumber': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["value"] = V; - } - } - Object.defineProperties(SVGNumber.prototype, { - value: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGNumber", configurable: true } - }); - ctorRegistry[interfaceName] = SVGNumber; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGNumber - }); -}; - -const Impl = require("../svg/SVGNumber-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGPreserveAspectRatio.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGPreserveAspectRatio.js deleted file mode 100644 index 2080d7c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGPreserveAspectRatio.js +++ /dev/null @@ -1,196 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "SVGPreserveAspectRatio"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGPreserveAspectRatio'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGPreserveAspectRatio"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGPreserveAspectRatio { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get align() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get align' called on an object that is not a valid instance of SVGPreserveAspectRatio." - ); - } - - return esValue[implSymbol]["align"]; - } - - set align(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set align' called on an object that is not a valid instance of SVGPreserveAspectRatio." - ); - } - - V = conversions["unsigned short"](V, { - context: "Failed to set the 'align' property on 'SVGPreserveAspectRatio': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["align"] = V; - } - - get meetOrSlice() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get meetOrSlice' called on an object that is not a valid instance of SVGPreserveAspectRatio." - ); - } - - return esValue[implSymbol]["meetOrSlice"]; - } - - set meetOrSlice(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set meetOrSlice' called on an object that is not a valid instance of SVGPreserveAspectRatio." - ); - } - - V = conversions["unsigned short"](V, { - context: "Failed to set the 'meetOrSlice' property on 'SVGPreserveAspectRatio': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["meetOrSlice"] = V; - } - } - Object.defineProperties(SVGPreserveAspectRatio.prototype, { - align: { enumerable: true }, - meetOrSlice: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGPreserveAspectRatio", configurable: true }, - SVG_PRESERVEASPECTRATIO_UNKNOWN: { value: 0, enumerable: true }, - SVG_PRESERVEASPECTRATIO_NONE: { value: 1, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMINYMIN: { value: 2, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMIDYMIN: { value: 3, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMAXYMIN: { value: 4, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMINYMID: { value: 5, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMIDYMID: { value: 6, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMAXYMID: { value: 7, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMINYMAX: { value: 8, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMIDYMAX: { value: 9, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMAXYMAX: { value: 10, enumerable: true }, - SVG_MEETORSLICE_UNKNOWN: { value: 0, enumerable: true }, - SVG_MEETORSLICE_MEET: { value: 1, enumerable: true }, - SVG_MEETORSLICE_SLICE: { value: 2, enumerable: true } - }); - Object.defineProperties(SVGPreserveAspectRatio, { - SVG_PRESERVEASPECTRATIO_UNKNOWN: { value: 0, enumerable: true }, - SVG_PRESERVEASPECTRATIO_NONE: { value: 1, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMINYMIN: { value: 2, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMIDYMIN: { value: 3, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMAXYMIN: { value: 4, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMINYMID: { value: 5, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMIDYMID: { value: 6, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMAXYMID: { value: 7, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMINYMAX: { value: 8, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMIDYMAX: { value: 9, enumerable: true }, - SVG_PRESERVEASPECTRATIO_XMAXYMAX: { value: 10, enumerable: true }, - SVG_MEETORSLICE_UNKNOWN: { value: 0, enumerable: true }, - SVG_MEETORSLICE_MEET: { value: 1, enumerable: true }, - SVG_MEETORSLICE_SLICE: { value: 2, enumerable: true } - }); - ctorRegistry[interfaceName] = SVGPreserveAspectRatio; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGPreserveAspectRatio - }); -}; - -const Impl = require("../svg/SVGPreserveAspectRatio-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGRect.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGRect.js deleted file mode 100644 index 043979d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGRect.js +++ /dev/null @@ -1,210 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "SVGRect"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGRect'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGRect"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGRect { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get x() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get x' called on an object that is not a valid instance of SVGRect."); - } - - return esValue[implSymbol]["x"]; - } - - set x(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set x' called on an object that is not a valid instance of SVGRect."); - } - - V = conversions["float"](V, { - context: "Failed to set the 'x' property on 'SVGRect': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["x"] = V; - } - - get y() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get y' called on an object that is not a valid instance of SVGRect."); - } - - return esValue[implSymbol]["y"]; - } - - set y(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set y' called on an object that is not a valid instance of SVGRect."); - } - - V = conversions["float"](V, { - context: "Failed to set the 'y' property on 'SVGRect': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["y"] = V; - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get width' called on an object that is not a valid instance of SVGRect."); - } - - return esValue[implSymbol]["width"]; - } - - set width(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set width' called on an object that is not a valid instance of SVGRect."); - } - - V = conversions["float"](V, { - context: "Failed to set the 'width' property on 'SVGRect': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["width"] = V; - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get height' called on an object that is not a valid instance of SVGRect."); - } - - return esValue[implSymbol]["height"]; - } - - set height(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set height' called on an object that is not a valid instance of SVGRect."); - } - - V = conversions["float"](V, { - context: "Failed to set the 'height' property on 'SVGRect': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["height"] = V; - } - } - Object.defineProperties(SVGRect.prototype, { - x: { enumerable: true }, - y: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGRect", configurable: true } - }); - ctorRegistry[interfaceName] = SVGRect; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGRect - }); -}; - -const Impl = require("../svg/SVGRect-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGSVGElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGSVGElement.js deleted file mode 100644 index a77099e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGSVGElement.js +++ /dev/null @@ -1,786 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const create_SVGAnimatedRect = require("./SVGAnimatedRect.js").create; -const create_SVGAnimatedPreserveAspectRatio = require("./SVGAnimatedPreserveAspectRatio.js").create; -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const OnBeforeUnloadEventHandlerNonNull = require("./OnBeforeUnloadEventHandlerNonNull.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const SVGGraphicsElement = require("./SVGGraphicsElement.js"); - -const interfaceName = "SVGSVGElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGSVGElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGSVGElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - SVGGraphicsElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGSVGElement extends globalObject.SVGGraphicsElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - createSVGNumber() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createSVGNumber' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].createSVGNumber()); - } - - createSVGRect() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'createSVGRect' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].createSVGRect()); - } - - getElementById(elementId) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getElementById' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getElementById' on 'SVGSVGElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getElementById' on 'SVGSVGElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getElementById(...args)); - } - - suspendRedraw(maxWaitMilliseconds) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'suspendRedraw' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'suspendRedraw' on 'SVGSVGElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'suspendRedraw' on 'SVGSVGElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].suspendRedraw(...args); - } - - unsuspendRedraw(suspendHandleID) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'unsuspendRedraw' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'unsuspendRedraw' on 'SVGSVGElement': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'unsuspendRedraw' on 'SVGSVGElement': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].unsuspendRedraw(...args); - } - - unsuspendRedrawAll() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'unsuspendRedrawAll' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return esValue[implSymbol].unsuspendRedrawAll(); - } - - forceRedraw() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'forceRedraw' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return esValue[implSymbol].forceRedraw(); - } - - get viewBox() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get viewBox' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.getSameObject(this, "viewBox", () => { - return create_SVGAnimatedRect(globalObject, [], { - element: esValue[implSymbol], - attribute: "viewBox" - }); - }); - } - - get preserveAspectRatio() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get preserveAspectRatio' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.getSameObject(this, "preserveAspectRatio", () => { - return create_SVGAnimatedPreserveAspectRatio(globalObject, [], { - element: esValue[implSymbol] - }); - }); - } - - get onafterprint() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onafterprint' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onafterprint"]); - } - - set onafterprint(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onafterprint' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onafterprint' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onafterprint"] = V; - } - - get onbeforeprint() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforeprint' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforeprint"]); - } - - set onbeforeprint(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforeprint' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforeprint' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onbeforeprint"] = V; - } - - get onbeforeunload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onbeforeunload' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onbeforeunload"]); - } - - set onbeforeunload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onbeforeunload' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = OnBeforeUnloadEventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onbeforeunload' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onbeforeunload"] = V; - } - - get onhashchange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onhashchange' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onhashchange"]); - } - - set onhashchange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onhashchange' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onhashchange' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onhashchange"] = V; - } - - get onlanguagechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onlanguagechange' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onlanguagechange"]); - } - - set onlanguagechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onlanguagechange' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onlanguagechange' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onlanguagechange"] = V; - } - - get onmessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmessage' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmessage"]); - } - - set onmessage(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmessage' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmessage' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onmessage"] = V; - } - - get onmessageerror() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmessageerror' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmessageerror"]); - } - - set onmessageerror(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmessageerror' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmessageerror' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onmessageerror"] = V; - } - - get onoffline() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onoffline' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onoffline"]); - } - - set onoffline(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onoffline' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onoffline' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onoffline"] = V; - } - - get ononline() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ononline' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ononline"]); - } - - set ononline(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ononline' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ononline' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["ononline"] = V; - } - - get onpagehide() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpagehide' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpagehide"]); - } - - set onpagehide(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpagehide' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpagehide' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onpagehide"] = V; - } - - get onpageshow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpageshow' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpageshow"]); - } - - set onpageshow(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpageshow' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpageshow' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onpageshow"] = V; - } - - get onpopstate() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onpopstate' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onpopstate"]); - } - - set onpopstate(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onpopstate' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onpopstate' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onpopstate"] = V; - } - - get onrejectionhandled() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onrejectionhandled' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onrejectionhandled"]); - } - - set onrejectionhandled(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onrejectionhandled' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onrejectionhandled' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onrejectionhandled"] = V; - } - - get onstorage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onstorage' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onstorage"]); - } - - set onstorage(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onstorage' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onstorage' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onstorage"] = V; - } - - get onunhandledrejection() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onunhandledrejection' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onunhandledrejection"]); - } - - set onunhandledrejection(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onunhandledrejection' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onunhandledrejection' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onunhandledrejection"] = V; - } - - get onunload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onunload' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onunload"]); - } - - set onunload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onunload' called on an object that is not a valid instance of SVGSVGElement." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onunload' property on 'SVGSVGElement': The provided value" - }); - } - esValue[implSymbol]["onunload"] = V; - } - } - Object.defineProperties(SVGSVGElement.prototype, { - createSVGNumber: { enumerable: true }, - createSVGRect: { enumerable: true }, - getElementById: { enumerable: true }, - suspendRedraw: { enumerable: true }, - unsuspendRedraw: { enumerable: true }, - unsuspendRedrawAll: { enumerable: true }, - forceRedraw: { enumerable: true }, - viewBox: { enumerable: true }, - preserveAspectRatio: { enumerable: true }, - onafterprint: { enumerable: true }, - onbeforeprint: { enumerable: true }, - onbeforeunload: { enumerable: true }, - onhashchange: { enumerable: true }, - onlanguagechange: { enumerable: true }, - onmessage: { enumerable: true }, - onmessageerror: { enumerable: true }, - onoffline: { enumerable: true }, - ononline: { enumerable: true }, - onpagehide: { enumerable: true }, - onpageshow: { enumerable: true }, - onpopstate: { enumerable: true }, - onrejectionhandled: { enumerable: true }, - onstorage: { enumerable: true }, - onunhandledrejection: { enumerable: true }, - onunload: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGSVGElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGSVGElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGSVGElement - }); -}; - -const Impl = require("../nodes/SVGSVGElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGStringList.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGStringList.js deleted file mode 100644 index e845155..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGStringList.js +++ /dev/null @@ -1,511 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "SVGStringList"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGStringList'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGStringList"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGStringList { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - clear() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'clear' called on an object that is not a valid instance of SVGStringList."); - } - - return esValue[implSymbol].clear(); - } - - initialize(newItem) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'initialize' called on an object that is not a valid instance of SVGStringList." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'initialize' on 'SVGStringList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initialize' on 'SVGStringList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].initialize(...args); - } - - getItem(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getItem' called on an object that is not a valid instance of SVGStringList." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getItem' on 'SVGStringList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'getItem' on 'SVGStringList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].getItem(...args); - } - - insertItemBefore(newItem, index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'insertItemBefore' called on an object that is not a valid instance of SVGStringList." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'insertItemBefore' on 'SVGStringList': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'insertItemBefore' on 'SVGStringList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'insertItemBefore' on 'SVGStringList': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].insertItemBefore(...args); - } - - replaceItem(newItem, index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'replaceItem' called on an object that is not a valid instance of SVGStringList." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'replaceItem' on 'SVGStringList': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'replaceItem' on 'SVGStringList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'replaceItem' on 'SVGStringList': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].replaceItem(...args); - } - - removeItem(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'removeItem' called on an object that is not a valid instance of SVGStringList." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'removeItem' on 'SVGStringList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'removeItem' on 'SVGStringList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].removeItem(...args); - } - - appendItem(newItem) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'appendItem' called on an object that is not a valid instance of SVGStringList." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'appendItem' on 'SVGStringList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'appendItem' on 'SVGStringList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].appendItem(...args); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of SVGStringList." - ); - } - - return esValue[implSymbol]["length"]; - } - - get numberOfItems() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get numberOfItems' called on an object that is not a valid instance of SVGStringList." - ); - } - - return esValue[implSymbol]["numberOfItems"]; - } - } - Object.defineProperties(SVGStringList.prototype, { - clear: { enumerable: true }, - initialize: { enumerable: true }, - getItem: { enumerable: true }, - insertItemBefore: { enumerable: true }, - replaceItem: { enumerable: true }, - removeItem: { enumerable: true }, - appendItem: { enumerable: true }, - length: { enumerable: true }, - numberOfItems: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGStringList", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = SVGStringList; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGStringList - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - - if (target[implSymbol][utils.supportsPropertyIndex](index)) { - const indexedValue = target[implSymbol].getItem(index); - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - let indexedValue = V; - - indexedValue = conversions["DOMString"](indexedValue, { - context: "Failed to set the " + index + " property on 'SVGStringList': The provided value", - globals: globalObject - }); - - const creating = !target[implSymbol][utils.supportsPropertyIndex](index); - if (creating) { - target[implSymbol][utils.indexedSetNew](index, indexedValue); - } else { - target[implSymbol][utils.indexedSetExisting](index, indexedValue); - } - - return true; - } - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - - if (target[implSymbol][utils.supportsPropertyIndex](index)) { - const indexedValue = target[implSymbol].getItem(index); - ownDesc = { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - if (desc.get || desc.set) { - return false; - } - - const index = P >>> 0; - let indexedValue = desc.value; - - indexedValue = conversions["DOMString"](indexedValue, { - context: "Failed to set the " + index + " property on 'SVGStringList': The provided value", - globals: globalObject - }); - - const creating = !target[implSymbol][utils.supportsPropertyIndex](index); - if (creating) { - target[implSymbol][utils.indexedSetNew](index, indexedValue); - } else { - target[implSymbol][utils.indexedSetExisting](index, indexedValue); - } - - return true; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !target[implSymbol][utils.supportsPropertyIndex](index); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../svg/SVGStringList-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGSwitchElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGSwitchElement.js deleted file mode 100644 index 92e4b66..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGSwitchElement.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const SVGGraphicsElement = require("./SVGGraphicsElement.js"); - -const interfaceName = "SVGSwitchElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGSwitchElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGSwitchElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - SVGGraphicsElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGSwitchElement extends globalObject.SVGGraphicsElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(SVGSwitchElement.prototype, { - [Symbol.toStringTag]: { value: "SVGSwitchElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGSwitchElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGSwitchElement - }); -}; - -const Impl = require("../nodes/SVGSwitchElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGSymbolElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGSymbolElement.js deleted file mode 100644 index df07c28..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGSymbolElement.js +++ /dev/null @@ -1,146 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const create_SVGAnimatedRect = require("./SVGAnimatedRect.js").create; -const create_SVGAnimatedPreserveAspectRatio = require("./SVGAnimatedPreserveAspectRatio.js").create; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const SVGGraphicsElement = require("./SVGGraphicsElement.js"); - -const interfaceName = "SVGSymbolElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGSymbolElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGSymbolElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - SVGGraphicsElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGSymbolElement extends globalObject.SVGGraphicsElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get viewBox() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get viewBox' called on an object that is not a valid instance of SVGSymbolElement." - ); - } - - return utils.getSameObject(this, "viewBox", () => { - return create_SVGAnimatedRect(globalObject, [], { - element: esValue[implSymbol], - attribute: "viewBox" - }); - }); - } - - get preserveAspectRatio() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get preserveAspectRatio' called on an object that is not a valid instance of SVGSymbolElement." - ); - } - - return utils.getSameObject(this, "preserveAspectRatio", () => { - return create_SVGAnimatedPreserveAspectRatio(globalObject, [], { - element: esValue[implSymbol] - }); - }); - } - } - Object.defineProperties(SVGSymbolElement.prototype, { - viewBox: { enumerable: true }, - preserveAspectRatio: { enumerable: true }, - [Symbol.toStringTag]: { value: "SVGSymbolElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGSymbolElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGSymbolElement - }); -}; - -const Impl = require("../nodes/SVGSymbolElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGTitleElement.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGTitleElement.js deleted file mode 100644 index f294603..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SVGTitleElement.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const SVGElement = require("./SVGElement.js"); - -const interfaceName = "SVGTitleElement"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SVGTitleElement'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SVGTitleElement"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - SVGElement._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SVGTitleElement extends globalObject.SVGElement { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(SVGTitleElement.prototype, { - [Symbol.toStringTag]: { value: "SVGTitleElement", configurable: true } - }); - ctorRegistry[interfaceName] = SVGTitleElement; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SVGTitleElement - }); -}; - -const Impl = require("../nodes/SVGTitleElement-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Screen.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Screen.js deleted file mode 100644 index 943f35b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Screen.js +++ /dev/null @@ -1,180 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Screen"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Screen'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Screen"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Screen { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get availWidth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get availWidth' called on an object that is not a valid instance of Screen." - ); - } - - return esValue[implSymbol]["availWidth"]; - } - - get availHeight() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get availHeight' called on an object that is not a valid instance of Screen." - ); - } - - return esValue[implSymbol]["availHeight"]; - } - - get width() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get width' called on an object that is not a valid instance of Screen."); - } - - return esValue[implSymbol]["width"]; - } - - get height() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get height' called on an object that is not a valid instance of Screen."); - } - - return esValue[implSymbol]["height"]; - } - - get colorDepth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get colorDepth' called on an object that is not a valid instance of Screen." - ); - } - - return esValue[implSymbol]["colorDepth"]; - } - - get pixelDepth() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pixelDepth' called on an object that is not a valid instance of Screen." - ); - } - - return esValue[implSymbol]["pixelDepth"]; - } - } - Object.defineProperties(Screen.prototype, { - availWidth: { enumerable: true }, - availHeight: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - colorDepth: { enumerable: true }, - pixelDepth: { enumerable: true }, - [Symbol.toStringTag]: { value: "Screen", configurable: true } - }); - ctorRegistry[interfaceName] = Screen; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Screen - }); -}; - -const Impl = require("../window/Screen-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollBehavior.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollBehavior.js deleted file mode 100644 index 9668f63..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollBehavior.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["auto", "instant", "smooth"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for ScrollBehavior`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollIntoViewOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollIntoViewOptions.js deleted file mode 100644 index 00cb221..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollIntoViewOptions.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ScrollLogicalPosition = require("./ScrollLogicalPosition.js"); -const ScrollOptions = require("./ScrollOptions.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - ScrollOptions._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "block"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = ScrollLogicalPosition.convert(globalObject, value, { context: context + " has member 'block' that" }); - - ret[key] = value; - } else { - ret[key] = "start"; - } - } - - { - const key = "inline"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = ScrollLogicalPosition.convert(globalObject, value, { context: context + " has member 'inline' that" }); - - ret[key] = value; - } else { - ret[key] = "nearest"; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollLogicalPosition.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollLogicalPosition.js deleted file mode 100644 index f7e9a10..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollLogicalPosition.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["start", "center", "end", "nearest"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError( - `${context} '${string}' is not a valid enumeration value for ScrollLogicalPosition` - ); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollOptions.js deleted file mode 100644 index 1bfa5f3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollOptions.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ScrollBehavior = require("./ScrollBehavior.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "behavior"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = ScrollBehavior.convert(globalObject, value, { context: context + " has member 'behavior' that" }); - - ret[key] = value; - } else { - ret[key] = "auto"; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollRestoration.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollRestoration.js deleted file mode 100644 index 1b3c19b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ScrollRestoration.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["auto", "manual"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for ScrollRestoration`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Selection.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Selection.js deleted file mode 100644 index 3e039cc..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Selection.js +++ /dev/null @@ -1,569 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Range = require("./Range.js"); -const Node = require("./Node.js"); -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Selection"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Selection'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Selection"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Selection { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - getRangeAt(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'getRangeAt' called on an object that is not a valid instance of Selection."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getRangeAt' on 'Selection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'getRangeAt' on 'Selection': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].getRangeAt(...args)); - } - - addRange(range) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'addRange' called on an object that is not a valid instance of Selection."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'addRange' on 'Selection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Range.convert(globalObject, curArg, { - context: "Failed to execute 'addRange' on 'Selection': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].addRange(...args); - } - - removeRange(range) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'removeRange' called on an object that is not a valid instance of Selection." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'removeRange' on 'Selection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Range.convert(globalObject, curArg, { - context: "Failed to execute 'removeRange' on 'Selection': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].removeRange(...args); - } - - removeAllRanges() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'removeAllRanges' called on an object that is not a valid instance of Selection." - ); - } - - return esValue[implSymbol].removeAllRanges(); - } - - empty() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'empty' called on an object that is not a valid instance of Selection."); - } - - return esValue[implSymbol].empty(); - } - - collapse(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'collapse' called on an object that is not a valid instance of Selection."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'collapse' on 'Selection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'collapse' on 'Selection': parameter 1" - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'collapse' on 'Selection': parameter 2", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - return esValue[implSymbol].collapse(...args); - } - - setPosition(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setPosition' called on an object that is not a valid instance of Selection." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'setPosition' on 'Selection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'setPosition' on 'Selection': parameter 1" - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setPosition' on 'Selection': parameter 2", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - return esValue[implSymbol].setPosition(...args); - } - - collapseToStart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'collapseToStart' called on an object that is not a valid instance of Selection." - ); - } - - return esValue[implSymbol].collapseToStart(); - } - - collapseToEnd() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'collapseToEnd' called on an object that is not a valid instance of Selection." - ); - } - - return esValue[implSymbol].collapseToEnd(); - } - - extend(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'extend' called on an object that is not a valid instance of Selection."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'extend' on 'Selection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'extend' on 'Selection': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'extend' on 'Selection': parameter 2", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - return esValue[implSymbol].extend(...args); - } - - setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setBaseAndExtent' called on an object that is not a valid instance of Selection." - ); - } - - if (arguments.length < 4) { - throw new globalObject.TypeError( - `Failed to execute 'setBaseAndExtent' on 'Selection': 4 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'setBaseAndExtent' on 'Selection': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setBaseAndExtent' on 'Selection': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'setBaseAndExtent' on 'Selection': parameter 3" - }); - args.push(curArg); - } - { - let curArg = arguments[3]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'setBaseAndExtent' on 'Selection': parameter 4", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setBaseAndExtent(...args); - } - - selectAllChildren(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'selectAllChildren' called on an object that is not a valid instance of Selection." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'selectAllChildren' on 'Selection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'selectAllChildren' on 'Selection': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].selectAllChildren(...args); - } - - deleteFromDocument() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'deleteFromDocument' called on an object that is not a valid instance of Selection." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol].deleteFromDocument(); - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - containsNode(node) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'containsNode' called on an object that is not a valid instance of Selection." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'containsNode' on 'Selection': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'containsNode' on 'Selection': parameter 1" - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'containsNode' on 'Selection': parameter 2", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - return esValue[implSymbol].containsNode(...args); - } - - toString() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'toString' called on an object that is not a valid instance of Selection."); - } - - return esValue[implSymbol].toString(); - } - - get anchorNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get anchorNode' called on an object that is not a valid instance of Selection." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["anchorNode"]); - } - - get anchorOffset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get anchorOffset' called on an object that is not a valid instance of Selection." - ); - } - - return esValue[implSymbol]["anchorOffset"]; - } - - get focusNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get focusNode' called on an object that is not a valid instance of Selection." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["focusNode"]); - } - - get focusOffset() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get focusOffset' called on an object that is not a valid instance of Selection." - ); - } - - return esValue[implSymbol]["focusOffset"]; - } - - get isCollapsed() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get isCollapsed' called on an object that is not a valid instance of Selection." - ); - } - - return esValue[implSymbol]["isCollapsed"]; - } - - get rangeCount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rangeCount' called on an object that is not a valid instance of Selection." - ); - } - - return esValue[implSymbol]["rangeCount"]; - } - - get type() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get type' called on an object that is not a valid instance of Selection."); - } - - return esValue[implSymbol]["type"]; - } - } - Object.defineProperties(Selection.prototype, { - getRangeAt: { enumerable: true }, - addRange: { enumerable: true }, - removeRange: { enumerable: true }, - removeAllRanges: { enumerable: true }, - empty: { enumerable: true }, - collapse: { enumerable: true }, - setPosition: { enumerable: true }, - collapseToStart: { enumerable: true }, - collapseToEnd: { enumerable: true }, - extend: { enumerable: true }, - setBaseAndExtent: { enumerable: true }, - selectAllChildren: { enumerable: true }, - deleteFromDocument: { enumerable: true }, - containsNode: { enumerable: true }, - toString: { enumerable: true }, - anchorNode: { enumerable: true }, - anchorOffset: { enumerable: true }, - focusNode: { enumerable: true }, - focusOffset: { enumerable: true }, - isCollapsed: { enumerable: true }, - rangeCount: { enumerable: true }, - type: { enumerable: true }, - [Symbol.toStringTag]: { value: "Selection", configurable: true } - }); - ctorRegistry[interfaceName] = Selection; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Selection - }); -}; - -const Impl = require("../selection/Selection-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SelectionMode.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SelectionMode.js deleted file mode 100644 index dc807c7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SelectionMode.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["select", "start", "end", "preserve"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for SelectionMode`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ShadowRoot.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ShadowRoot.js deleted file mode 100644 index b170d13..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ShadowRoot.js +++ /dev/null @@ -1,187 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; -const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const DocumentFragment = require("./DocumentFragment.js"); - -const interfaceName = "ShadowRoot"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'ShadowRoot'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["ShadowRoot"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - DocumentFragment._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class ShadowRoot extends globalObject.DocumentFragment { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get mode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get mode' called on an object that is not a valid instance of ShadowRoot."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["mode"]); - } - - get host() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get host' called on an object that is not a valid instance of ShadowRoot."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["host"]); - } - - get innerHTML() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get innerHTML' called on an object that is not a valid instance of ShadowRoot." - ); - } - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - return esValue[implSymbol]["innerHTML"]; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - set innerHTML(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set innerHTML' called on an object that is not a valid instance of ShadowRoot." - ); - } - - V = conversions["DOMString"](V, { - context: "Failed to set the 'innerHTML' property on 'ShadowRoot': The provided value", - globals: globalObject, - treatNullAsEmptyString: true - }); - - ceReactionsPreSteps_helpers_custom_elements(globalObject); - try { - esValue[implSymbol]["innerHTML"] = V; - } finally { - ceReactionsPostSteps_helpers_custom_elements(globalObject); - } - } - - get activeElement() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get activeElement' called on an object that is not a valid instance of ShadowRoot." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["activeElement"]); - } - } - Object.defineProperties(ShadowRoot.prototype, { - mode: { enumerable: true }, - host: { enumerable: true }, - innerHTML: { enumerable: true }, - activeElement: { enumerable: true }, - [Symbol.toStringTag]: { value: "ShadowRoot", configurable: true } - }); - ctorRegistry[interfaceName] = ShadowRoot; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: ShadowRoot - }); -}; - -const Impl = require("../nodes/ShadowRoot-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ShadowRootInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ShadowRootInit.js deleted file mode 100644 index 6602147..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ShadowRootInit.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const ShadowRootMode = require("./ShadowRootMode.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "mode"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = ShadowRootMode.convert(globalObject, value, { context: context + " has member 'mode' that" }); - - ret[key] = value; - } else { - throw new globalObject.TypeError("mode is required in 'ShadowRootInit'"); - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ShadowRootMode.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ShadowRootMode.js deleted file mode 100644 index 3760713..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ShadowRootMode.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["open", "closed"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for ShadowRootMode`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StaticRange.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StaticRange.js deleted file mode 100644 index 50270da..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StaticRange.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const StaticRangeInit = require("./StaticRangeInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const AbstractRange = require("./AbstractRange.js"); - -const interfaceName = "StaticRange"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'StaticRange'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["StaticRange"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - AbstractRange._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class StaticRange extends globalObject.AbstractRange { - constructor(init) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'StaticRange': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = StaticRangeInit.convert(globalObject, curArg, { - context: "Failed to construct 'StaticRange': parameter 1" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - } - Object.defineProperties(StaticRange.prototype, { - [Symbol.toStringTag]: { value: "StaticRange", configurable: true } - }); - ctorRegistry[interfaceName] = StaticRange; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: StaticRange - }); -}; - -const Impl = require("../range/StaticRange-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StaticRangeInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StaticRangeInit.js deleted file mode 100644 index 0be2211..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StaticRangeInit.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Node = require("./Node.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "endContainer"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = Node.convert(globalObject, value, { context: context + " has member 'endContainer' that" }); - - ret[key] = value; - } else { - throw new globalObject.TypeError("endContainer is required in 'StaticRangeInit'"); - } - } - - { - const key = "endOffset"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long"](value, { - context: context + " has member 'endOffset' that", - globals: globalObject - }); - - ret[key] = value; - } else { - throw new globalObject.TypeError("endOffset is required in 'StaticRangeInit'"); - } - } - - { - const key = "startContainer"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = Node.convert(globalObject, value, { context: context + " has member 'startContainer' that" }); - - ret[key] = value; - } else { - throw new globalObject.TypeError("startContainer is required in 'StaticRangeInit'"); - } - } - - { - const key = "startOffset"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long"](value, { - context: context + " has member 'startOffset' that", - globals: globalObject - }); - - ret[key] = value; - } else { - throw new globalObject.TypeError("startOffset is required in 'StaticRangeInit'"); - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Storage.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Storage.js deleted file mode 100644 index 3c4b561..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Storage.js +++ /dev/null @@ -1,397 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "Storage"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Storage'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Storage"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Storage { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - key(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'key' called on an object that is not a valid instance of Storage."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'key' on 'Storage': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'key' on 'Storage': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].key(...args); - } - - getItem(key) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'getItem' called on an object that is not a valid instance of Storage."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getItem' on 'Storage': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'getItem' on 'Storage': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].getItem(...args); - } - - setItem(key, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'setItem' called on an object that is not a valid instance of Storage."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'setItem' on 'Storage': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setItem' on 'Storage': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'setItem' on 'Storage': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setItem(...args); - } - - removeItem(key) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'removeItem' called on an object that is not a valid instance of Storage."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'removeItem' on 'Storage': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'removeItem' on 'Storage': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].removeItem(...args); - } - - clear() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'clear' called on an object that is not a valid instance of Storage."); - } - - return esValue[implSymbol].clear(); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get length' called on an object that is not a valid instance of Storage."); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(Storage.prototype, { - key: { enumerable: true }, - getItem: { enumerable: true }, - setItem: { enumerable: true }, - removeItem: { enumerable: true }, - clear: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "Storage", configurable: true } - }); - ctorRegistry[interfaceName] = Storage; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Storage - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(`${key}`); - } - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - const namedValue = target[implSymbol].getItem(P); - - if (namedValue !== null && !(P in target) && !ignoreNamedProps) { - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - - if (typeof P === "string") { - let namedValue = V; - - namedValue = conversions["DOMString"](namedValue, { - context: "Failed to set the '" + P + "' property on 'Storage': The provided value", - globals: globalObject - }); - - target[implSymbol].setItem(P, namedValue); - - return true; - } - } - let ownDesc; - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - if (!Object.hasOwn(target, P)) { - if (desc.get || desc.set) { - return false; - } - - let namedValue = desc.value; - - namedValue = conversions["DOMString"](namedValue, { - context: "Failed to set the '" + P + "' property on 'Storage': The provided value", - globals: globalObject - }); - - target[implSymbol].setItem(P, namedValue); - - return true; - } - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (target[implSymbol].getItem(P) !== null && !(P in target)) { - target[implSymbol].removeItem(P); - return true; - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../webstorage/Storage-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StorageEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StorageEvent.js deleted file mode 100644 index 23a92d8..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StorageEvent.js +++ /dev/null @@ -1,318 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const StorageEventInit = require("./StorageEventInit.js"); -const Storage = require("./Storage.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "StorageEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'StorageEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["StorageEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class StorageEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'StorageEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'StorageEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = StorageEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'StorageEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - initStorageEvent(type) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'initStorageEvent' called on an object that is not a valid instance of StorageEvent." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'initStorageEvent' on 'StorageEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initStorageEvent' on 'StorageEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initStorageEvent' on 'StorageEvent': parameter 2", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initStorageEvent' on 'StorageEvent': parameter 3", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initStorageEvent' on 'StorageEvent': parameter 4", - globals: globalObject - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[4]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initStorageEvent' on 'StorageEvent': parameter 5", - globals: globalObject - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[5]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initStorageEvent' on 'StorageEvent': parameter 6", - globals: globalObject - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[6]; - if (curArg !== undefined) { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'initStorageEvent' on 'StorageEvent': parameter 7", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - { - let curArg = arguments[7]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = Storage.convert(globalObject, curArg, { - context: "Failed to execute 'initStorageEvent' on 'StorageEvent': parameter 8" - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - return esValue[implSymbol].initStorageEvent(...args); - } - - get key() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get key' called on an object that is not a valid instance of StorageEvent."); - } - - return esValue[implSymbol]["key"]; - } - - get oldValue() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get oldValue' called on an object that is not a valid instance of StorageEvent." - ); - } - - return esValue[implSymbol]["oldValue"]; - } - - get newValue() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get newValue' called on an object that is not a valid instance of StorageEvent." - ); - } - - return esValue[implSymbol]["newValue"]; - } - - get url() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get url' called on an object that is not a valid instance of StorageEvent."); - } - - return esValue[implSymbol]["url"]; - } - - get storageArea() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get storageArea' called on an object that is not a valid instance of StorageEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["storageArea"]); - } - } - Object.defineProperties(StorageEvent.prototype, { - initStorageEvent: { enumerable: true }, - key: { enumerable: true }, - oldValue: { enumerable: true }, - newValue: { enumerable: true }, - url: { enumerable: true }, - storageArea: { enumerable: true }, - [Symbol.toStringTag]: { value: "StorageEvent", configurable: true } - }); - ctorRegistry[interfaceName] = StorageEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: StorageEvent - }); -}; - -const Impl = require("../events/StorageEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StorageEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StorageEventInit.js deleted file mode 100644 index c51c712..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StorageEventInit.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Storage = require("./Storage.js"); -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "key"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["DOMString"](value, { context: context + " has member 'key' that", globals: globalObject }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "newValue"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["DOMString"](value, { - context: context + " has member 'newValue' that", - globals: globalObject - }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "oldValue"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = conversions["DOMString"](value, { - context: context + " has member 'oldValue' that", - globals: globalObject - }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "storageArea"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = Storage.convert(globalObject, value, { context: context + " has member 'storageArea' that" }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "url"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["USVString"](value, { context: context + " has member 'url' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StyleSheetList.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StyleSheetList.js deleted file mode 100644 index 89a889a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/StyleSheetList.js +++ /dev/null @@ -1,300 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "StyleSheetList"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'StyleSheetList'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["StyleSheetList"].prototype; - } - - return Object.create(proto); -} - -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - let wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = makeProxy(wrapper, globalObject); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class StyleSheetList { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'item' called on an object that is not a valid instance of StyleSheetList."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'item' on 'StyleSheetList': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'item' on 'StyleSheetList': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get length' called on an object that is not a valid instance of StyleSheetList." - ); - } - - return esValue[implSymbol]["length"]; - } - } - Object.defineProperties(StyleSheetList.prototype, { - item: { enumerable: true }, - length: { enumerable: true }, - [Symbol.toStringTag]: { value: "StyleSheetList", configurable: true }, - [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } - }); - ctorRegistry[interfaceName] = StyleSheetList; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: StyleSheetList - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === "symbol") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === "symbol") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(`${key}`); - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === "symbol") { - return Reflect.set(target, P, V, receiver); - } - // The `receiver` argument refers to the Proxy exotic object or an object - // that inherits from it, whereas `target` refers to the Proxy target: - if (target[implSymbol][utils.wrapperSymbol] === receiver) { - const globalObject = this._globalObject; - } - let ownDesc; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== null) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - return utils.ordinarySetWithOwnDescriptor(target, P, V, receiver, ownDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === "symbol") { - return Reflect.defineProperty(target, P, desc); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - return false; - } - - return Reflect.defineProperty(target, P, desc); - } - - deleteProperty(target, P) { - if (typeof P === "symbol") { - return Reflect.deleteProperty(target, P); - } - - const globalObject = this._globalObject; - - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== null); - } - - return Reflect.deleteProperty(target, P); - } - - preventExtensions() { - return false; - } -} - -const Impl = require("../cssom/StyleSheetList-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SubmitEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SubmitEvent.js deleted file mode 100644 index 94c9aec..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SubmitEvent.js +++ /dev/null @@ -1,144 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const SubmitEventInit = require("./SubmitEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "SubmitEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'SubmitEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["SubmitEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class SubmitEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'SubmitEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'SubmitEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = SubmitEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'SubmitEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get submitter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get submitter' called on an object that is not a valid instance of SubmitEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["submitter"]); - } - } - Object.defineProperties(SubmitEvent.prototype, { - submitter: { enumerable: true }, - [Symbol.toStringTag]: { value: "SubmitEvent", configurable: true } - }); - ctorRegistry[interfaceName] = SubmitEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SubmitEvent - }); -}; - -const Impl = require("../events/SubmitEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SubmitEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SubmitEventInit.js deleted file mode 100644 index a911318..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SubmitEventInit.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const HTMLElement = require("./HTMLElement.js"); -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "submitter"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = HTMLElement.convert(globalObject, value, { context: context + " has member 'submitter' that" }); - } - ret[key] = value; - } else { - ret[key] = null; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SupportedType.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SupportedType.js deleted file mode 100644 index f64ae10..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/SupportedType.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -const enumerationValues = new Set([ - "text/html", - "text/xml", - "application/xml", - "application/xhtml+xml", - "image/svg+xml" -]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for SupportedType`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Text.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Text.js deleted file mode 100644 index 0ab77e0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/Text.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const CharacterData = require("./CharacterData.js"); - -const interfaceName = "Text"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'Text'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["Text"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - CharacterData._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class Text extends globalObject.CharacterData { - constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'Text': parameter 1", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - splitText(offset) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'splitText' called on an object that is not a valid instance of Text."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'splitText' on 'Text': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["unsigned long"](curArg, { - context: "Failed to execute 'splitText' on 'Text': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].splitText(...args)); - } - - get wholeText() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get wholeText' called on an object that is not a valid instance of Text."); - } - - return esValue[implSymbol]["wholeText"]; - } - - get assignedSlot() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get assignedSlot' called on an object that is not a valid instance of Text." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["assignedSlot"]); - } - } - Object.defineProperties(Text.prototype, { - splitText: { enumerable: true }, - wholeText: { enumerable: true }, - assignedSlot: { enumerable: true }, - [Symbol.toStringTag]: { value: "Text", configurable: true } - }); - ctorRegistry[interfaceName] = Text; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Text - }); -}; - -const Impl = require("../nodes/Text-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextDecodeOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextDecodeOptions.js deleted file mode 100644 index e3f79e9..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextDecodeOptions.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "stream"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'stream' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextDecoder.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextDecoder.js deleted file mode 100644 index 5f571c8..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextDecoder.js +++ /dev/null @@ -1,211 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const TextDecoderOptions = require("./TextDecoderOptions.js"); -const TextDecodeOptions = require("./TextDecodeOptions.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "TextDecoder"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'TextDecoder'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["TextDecoder"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class TextDecoder { - constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'TextDecoder': parameter 1", - globals: globalObject - }); - } else { - curArg = "utf-8"; - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = TextDecoderOptions.convert(globalObject, curArg, { - context: "Failed to construct 'TextDecoder': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - decode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'decode' called on an object that is not a valid instance of TextDecoder."); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - if (utils.isArrayBuffer(curArg)) { - curArg = conversions["ArrayBuffer"](curArg, { - context: "Failed to execute 'decode' on 'TextDecoder': parameter 1", - globals: globalObject - }); - } else if (utils.isSharedArrayBuffer(curArg)) { - curArg = conversions["SharedArrayBuffer"](curArg, { - context: "Failed to execute 'decode' on 'TextDecoder': parameter 1", - globals: globalObject - }); - } else if (ArrayBuffer.isView(curArg)) { - curArg = conversions["ArrayBufferView"](curArg, { - context: "Failed to execute 'decode' on 'TextDecoder': parameter 1", - globals: globalObject, - allowShared: true - }); - } else { - throw new globalObject.TypeError( - "Failed to execute 'decode' on 'TextDecoder': parameter 1" + " is not of any supported type." - ); - } - } - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = TextDecodeOptions.convert(globalObject, curArg, { - context: "Failed to execute 'decode' on 'TextDecoder': parameter 2" - }); - args.push(curArg); - } - return esValue[implSymbol].decode(...args); - } - - get encoding() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get encoding' called on an object that is not a valid instance of TextDecoder." - ); - } - - return esValue[implSymbol]["encoding"]; - } - - get fatal() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get fatal' called on an object that is not a valid instance of TextDecoder." - ); - } - - return esValue[implSymbol]["fatal"]; - } - - get ignoreBOM() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ignoreBOM' called on an object that is not a valid instance of TextDecoder." - ); - } - - return esValue[implSymbol]["ignoreBOM"]; - } - } - Object.defineProperties(TextDecoder.prototype, { - decode: { enumerable: true }, - encoding: { enumerable: true }, - fatal: { enumerable: true }, - ignoreBOM: { enumerable: true }, - [Symbol.toStringTag]: { value: "TextDecoder", configurable: true } - }); - ctorRegistry[interfaceName] = TextDecoder; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: TextDecoder - }); -}; - -const Impl = require("../encoding/TextDecoder-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextDecoderOptions.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextDecoderOptions.js deleted file mode 100644 index ed5717b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextDecoderOptions.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "fatal"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { context: context + " has member 'fatal' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = "ignoreBOM"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["boolean"](value, { - context: context + " has member 'ignoreBOM' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = false; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextEncoder.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextEncoder.js deleted file mode 100644 index fd3e19f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextEncoder.js +++ /dev/null @@ -1,176 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "TextEncoder"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'TextEncoder'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["TextEncoder"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class TextEncoder { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - encode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'encode' called on an object that is not a valid instance of TextEncoder."); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'encode' on 'TextEncoder': parameter 1", - globals: globalObject - }); - } else { - curArg = ""; - } - args.push(curArg); - } - return esValue[implSymbol].encode(...args); - } - - encodeInto(source, destination) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'encodeInto' called on an object that is not a valid instance of TextEncoder." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'encodeInto' on 'TextEncoder': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'encodeInto' on 'TextEncoder': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["Uint8Array"](curArg, { - context: "Failed to execute 'encodeInto' on 'TextEncoder': parameter 2", - globals: globalObject, - allowShared: true - }); - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].encodeInto(...args)); - } - - get encoding() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get encoding' called on an object that is not a valid instance of TextEncoder." - ); - } - - return esValue[implSymbol]["encoding"]; - } - } - Object.defineProperties(TextEncoder.prototype, { - encode: { enumerable: true }, - encodeInto: { enumerable: true }, - encoding: { enumerable: true }, - [Symbol.toStringTag]: { value: "TextEncoder", configurable: true } - }); - ctorRegistry[interfaceName] = TextEncoder; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: TextEncoder - }); -}; - -const Impl = require("../encoding/TextEncoder-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextEncoderEncodeIntoResult.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextEncoderEncodeIntoResult.js deleted file mode 100644 index 3f3cc9d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextEncoderEncodeIntoResult.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - { - const key = "read"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long long"](value, { - context: context + " has member 'read' that", - globals: globalObject - }); - - ret[key] = value; - } - } - - { - const key = "written"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long long"](value, { - context: context + " has member 'written' that", - globals: globalObject - }); - - ret[key] = value; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextTrackKind.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextTrackKind.js deleted file mode 100644 index 5ad709a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TextTrackKind.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["subtitles", "captions", "descriptions", "chapters", "metadata"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for TextTrackKind`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TouchEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TouchEvent.js deleted file mode 100644 index 5ef8cc7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TouchEvent.js +++ /dev/null @@ -1,222 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const TouchEventInit = require("./TouchEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const UIEvent = require("./UIEvent.js"); - -const interfaceName = "TouchEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'TouchEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["TouchEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - UIEvent._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class TouchEvent extends globalObject.UIEvent { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'TouchEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'TouchEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = TouchEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'TouchEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get touches() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get touches' called on an object that is not a valid instance of TouchEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["touches"]); - } - - get targetTouches() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get targetTouches' called on an object that is not a valid instance of TouchEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["targetTouches"]); - } - - get changedTouches() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get changedTouches' called on an object that is not a valid instance of TouchEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["changedTouches"]); - } - - get altKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get altKey' called on an object that is not a valid instance of TouchEvent." - ); - } - - return esValue[implSymbol]["altKey"]; - } - - get metaKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get metaKey' called on an object that is not a valid instance of TouchEvent." - ); - } - - return esValue[implSymbol]["metaKey"]; - } - - get ctrlKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ctrlKey' called on an object that is not a valid instance of TouchEvent." - ); - } - - return esValue[implSymbol]["ctrlKey"]; - } - - get shiftKey() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get shiftKey' called on an object that is not a valid instance of TouchEvent." - ); - } - - return esValue[implSymbol]["shiftKey"]; - } - } - Object.defineProperties(TouchEvent.prototype, { - touches: { enumerable: true }, - targetTouches: { enumerable: true }, - changedTouches: { enumerable: true }, - altKey: { enumerable: true }, - metaKey: { enumerable: true }, - ctrlKey: { enumerable: true }, - shiftKey: { enumerable: true }, - [Symbol.toStringTag]: { value: "TouchEvent", configurable: true } - }); - ctorRegistry[interfaceName] = TouchEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: TouchEvent - }); -}; - -const Impl = require("../events/TouchEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TouchEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TouchEventInit.js deleted file mode 100644 index 7a47277..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TouchEventInit.js +++ /dev/null @@ -1,89 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventModifierInit = require("./EventModifierInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventModifierInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "changedTouches"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (!utils.isObject(value)) { - throw new globalObject.TypeError(context + " has member 'changedTouches' that" + " is not an iterable object."); - } else { - const V = []; - const tmp = value; - for (let nextItem of tmp) { - nextItem = utils.tryImplForWrapper(nextItem); - - V.push(nextItem); - } - value = V; - } - - ret[key] = value; - } else { - ret[key] = []; - } - } - - { - const key = "targetTouches"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (!utils.isObject(value)) { - throw new globalObject.TypeError(context + " has member 'targetTouches' that" + " is not an iterable object."); - } else { - const V = []; - const tmp = value; - for (let nextItem of tmp) { - nextItem = utils.tryImplForWrapper(nextItem); - - V.push(nextItem); - } - value = V; - } - - ret[key] = value; - } else { - ret[key] = []; - } - } - - { - const key = "touches"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (!utils.isObject(value)) { - throw new globalObject.TypeError(context + " has member 'touches' that" + " is not an iterable object."); - } else { - const V = []; - const tmp = value; - for (let nextItem of tmp) { - nextItem = utils.tryImplForWrapper(nextItem); - - V.push(nextItem); - } - value = V; - } - - ret[key] = value; - } else { - ret[key] = []; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TransitionEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TransitionEvent.js deleted file mode 100644 index b0f7181..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TransitionEvent.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const TransitionEventInit = require("./TransitionEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "TransitionEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'TransitionEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["TransitionEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class TransitionEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'TransitionEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'TransitionEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = TransitionEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'TransitionEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get propertyName() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get propertyName' called on an object that is not a valid instance of TransitionEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["propertyName"]); - } - - get elapsedTime() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get elapsedTime' called on an object that is not a valid instance of TransitionEvent." - ); - } - - return esValue[implSymbol]["elapsedTime"]; - } - - get pseudoElement() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get pseudoElement' called on an object that is not a valid instance of TransitionEvent." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["pseudoElement"]); - } - } - Object.defineProperties(TransitionEvent.prototype, { - propertyName: { enumerable: true }, - elapsedTime: { enumerable: true }, - pseudoElement: { enumerable: true }, - [Symbol.toStringTag]: { value: "TransitionEvent", configurable: true } - }); - ctorRegistry[interfaceName] = TransitionEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: TransitionEvent - }); -}; - -const Impl = require("../events/TransitionEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TransitionEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TransitionEventInit.js deleted file mode 100644 index 0eb30f4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TransitionEventInit.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "elapsedTime"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { - context: context + " has member 'elapsedTime' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0.0; - } - } - - { - const key = "propertyName"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { - context: context + " has member 'propertyName' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } - - { - const key = "pseudoElement"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["DOMString"](value, { - context: context + " has member 'pseudoElement' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = ""; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TreeWalker.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TreeWalker.js deleted file mode 100644 index 41683b2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/TreeWalker.js +++ /dev/null @@ -1,255 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Node = require("./Node.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "TreeWalker"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'TreeWalker'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["TreeWalker"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class TreeWalker { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - parentNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'parentNode' called on an object that is not a valid instance of TreeWalker." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].parentNode()); - } - - firstChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'firstChild' called on an object that is not a valid instance of TreeWalker." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].firstChild()); - } - - lastChild() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'lastChild' called on an object that is not a valid instance of TreeWalker."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].lastChild()); - } - - previousSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'previousSibling' called on an object that is not a valid instance of TreeWalker." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].previousSibling()); - } - - nextSibling() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'nextSibling' called on an object that is not a valid instance of TreeWalker." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].nextSibling()); - } - - previousNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'previousNode' called on an object that is not a valid instance of TreeWalker." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].previousNode()); - } - - nextNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'nextNode' called on an object that is not a valid instance of TreeWalker."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol].nextNode()); - } - - get root() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get root' called on an object that is not a valid instance of TreeWalker."); - } - - return utils.getSameObject(this, "root", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["root"]); - }); - } - - get whatToShow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get whatToShow' called on an object that is not a valid instance of TreeWalker." - ); - } - - return esValue[implSymbol]["whatToShow"]; - } - - get filter() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get filter' called on an object that is not a valid instance of TreeWalker." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["filter"]); - } - - get currentNode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get currentNode' called on an object that is not a valid instance of TreeWalker." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["currentNode"]); - } - - set currentNode(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set currentNode' called on an object that is not a valid instance of TreeWalker." - ); - } - - V = Node.convert(globalObject, V, { - context: "Failed to set the 'currentNode' property on 'TreeWalker': The provided value" - }); - - esValue[implSymbol]["currentNode"] = V; - } - } - Object.defineProperties(TreeWalker.prototype, { - parentNode: { enumerable: true }, - firstChild: { enumerable: true }, - lastChild: { enumerable: true }, - previousSibling: { enumerable: true }, - nextSibling: { enumerable: true }, - previousNode: { enumerable: true }, - nextNode: { enumerable: true }, - root: { enumerable: true }, - whatToShow: { enumerable: true }, - filter: { enumerable: true }, - currentNode: { enumerable: true }, - [Symbol.toStringTag]: { value: "TreeWalker", configurable: true } - }); - ctorRegistry[interfaceName] = TreeWalker; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: TreeWalker - }); -}; - -const Impl = require("../traversal/TreeWalker-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/UIEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/UIEvent.js deleted file mode 100644 index 487e5e2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/UIEvent.js +++ /dev/null @@ -1,235 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const UIEventInit = require("./UIEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Event = require("./Event.js"); - -const interfaceName = "UIEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'UIEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["UIEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Event._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class UIEvent extends globalObject.Event { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'UIEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'UIEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = UIEventInit.convert(globalObject, curArg, { context: "Failed to construct 'UIEvent': parameter 2" }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - initUIEvent(typeArg) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'initUIEvent' called on an object that is not a valid instance of UIEvent."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'initUIEvent' on 'UIEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'initUIEvent' on 'UIEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initUIEvent' on 'UIEvent': parameter 2", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'initUIEvent' on 'UIEvent': parameter 3", - globals: globalObject - }); - } else { - curArg = false; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = utils.tryImplForWrapper(curArg); - } - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[4]; - if (curArg !== undefined) { - curArg = conversions["long"](curArg, { - context: "Failed to execute 'initUIEvent' on 'UIEvent': parameter 5", - globals: globalObject - }); - } else { - curArg = 0; - } - args.push(curArg); - } - return esValue[implSymbol].initUIEvent(...args); - } - - get view() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get view' called on an object that is not a valid instance of UIEvent."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["view"]); - } - - get detail() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get detail' called on an object that is not a valid instance of UIEvent."); - } - - return esValue[implSymbol]["detail"]; - } - - get which() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get which' called on an object that is not a valid instance of UIEvent."); - } - - return esValue[implSymbol]["which"]; - } - } - Object.defineProperties(UIEvent.prototype, { - initUIEvent: { enumerable: true }, - view: { enumerable: true }, - detail: { enumerable: true }, - which: { enumerable: true }, - [Symbol.toStringTag]: { value: "UIEvent", configurable: true } - }); - ctorRegistry[interfaceName] = UIEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: UIEvent - }); -}; - -const Impl = require("../events/UIEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/UIEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/UIEventInit.js deleted file mode 100644 index 3051b23..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/UIEventInit.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventInit = require("./EventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - EventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "detail"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["long"](value, { context: context + " has member 'detail' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "view"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (value === null || value === undefined) { - value = null; - } else { - value = utils.tryImplForWrapper(value); - } - ret[key] = value; - } else { - ret[key] = null; - } - } - - { - const key = "which"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long"](value, { - context: context + " has member 'which' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ValidityState.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ValidityState.js deleted file mode 100644 index 9491d7c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/ValidityState.js +++ /dev/null @@ -1,249 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "ValidityState"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'ValidityState'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["ValidityState"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class ValidityState { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get valueMissing() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get valueMissing' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["valueMissing"]; - } - - get typeMismatch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get typeMismatch' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["typeMismatch"]; - } - - get patternMismatch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get patternMismatch' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["patternMismatch"]; - } - - get tooLong() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tooLong' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["tooLong"]; - } - - get tooShort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get tooShort' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["tooShort"]; - } - - get rangeUnderflow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rangeUnderflow' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["rangeUnderflow"]; - } - - get rangeOverflow() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get rangeOverflow' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["rangeOverflow"]; - } - - get stepMismatch() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get stepMismatch' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["stepMismatch"]; - } - - get badInput() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get badInput' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["badInput"]; - } - - get customError() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get customError' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["customError"]; - } - - get valid() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get valid' called on an object that is not a valid instance of ValidityState." - ); - } - - return esValue[implSymbol]["valid"]; - } - } - Object.defineProperties(ValidityState.prototype, { - valueMissing: { enumerable: true }, - typeMismatch: { enumerable: true }, - patternMismatch: { enumerable: true }, - tooLong: { enumerable: true }, - tooShort: { enumerable: true }, - rangeUnderflow: { enumerable: true }, - rangeOverflow: { enumerable: true }, - stepMismatch: { enumerable: true }, - badInput: { enumerable: true }, - customError: { enumerable: true }, - valid: { enumerable: true }, - [Symbol.toStringTag]: { value: "ValidityState", configurable: true } - }); - ctorRegistry[interfaceName] = ValidityState; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: ValidityState - }); -}; - -const Impl = require("../constraint-validation/ValidityState-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/VisibilityState.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/VisibilityState.js deleted file mode 100644 index 798eb09..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/VisibilityState.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["hidden", "visible", "prerender"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for VisibilityState`); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/VoidFunction.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/VoidFunction.js deleted file mode 100644 index 9a00672..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/VoidFunction.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (typeof value !== "function") { - throw new globalObject.TypeError(context + " is not a function"); - } - - function invokeTheCallbackFunction() { - const thisArg = utils.tryWrapperForImpl(this); - let callResult; - - callResult = Reflect.apply(value, thisArg, []); - } - - invokeTheCallbackFunction.construct = () => { - let callResult = Reflect.construct(value, []); - }; - - invokeTheCallbackFunction[utils.wrapperSymbol] = value; - invokeTheCallbackFunction.objectReference = value; - - return invokeTheCallbackFunction; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/WebSocket.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/WebSocket.js deleted file mode 100644 index faa6d77..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/WebSocket.js +++ /dev/null @@ -1,480 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Blob = require("./Blob.js"); -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const BinaryType = require("./BinaryType.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const EventTarget = require("./EventTarget.js"); - -const interfaceName = "WebSocket"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'WebSocket'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["WebSocket"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - EventTarget._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "Worker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class WebSocket extends globalObject.EventTarget { - constructor(url) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'WebSocket': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to construct 'WebSocket': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - if (utils.isObject(curArg)) { - if (curArg[Symbol.iterator] !== undefined) { - if (!utils.isObject(curArg)) { - throw new globalObject.TypeError( - "Failed to construct 'WebSocket': parameter 2" + " sequence" + " is not an iterable object." - ); - } else { - const V = []; - const tmp = curArg; - for (let nextItem of tmp) { - nextItem = conversions["DOMString"](nextItem, { - context: "Failed to construct 'WebSocket': parameter 2" + " sequence" + "'s element", - globals: globalObject - }); - - V.push(nextItem); - } - curArg = V; - } - } else { - } - } else { - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'WebSocket': parameter 2", - globals: globalObject - }); - } - } else { - curArg = []; - } - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - close() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'close' called on an object that is not a valid instance of WebSocket."); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions["unsigned short"](curArg, { - context: "Failed to execute 'close' on 'WebSocket': parameter 1", - globals: globalObject, - clamp: true - }); - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'close' on 'WebSocket': parameter 2", - globals: globalObject - }); - } - args.push(curArg); - } - return esValue[implSymbol].close(...args); - } - - send(data) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'send' called on an object that is not a valid instance of WebSocket."); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'send' on 'WebSocket': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - if (Blob.is(curArg)) { - { - let curArg = arguments[0]; - curArg = Blob.convert(globalObject, curArg, { - context: "Failed to execute 'send' on 'WebSocket': parameter 1" - }); - args.push(curArg); - } - } else if (utils.isArrayBuffer(curArg)) { - { - let curArg = arguments[0]; - curArg = conversions["ArrayBuffer"](curArg, { - context: "Failed to execute 'send' on 'WebSocket': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - } else if (ArrayBuffer.isView(curArg)) { - { - let curArg = arguments[0]; - if (ArrayBuffer.isView(curArg)) { - curArg = conversions["ArrayBufferView"](curArg, { - context: "Failed to execute 'send' on 'WebSocket': parameter 1", - globals: globalObject - }); - } else { - throw new globalObject.TypeError( - "Failed to execute 'send' on 'WebSocket': parameter 1" + " is not of any supported type." - ); - } - args.push(curArg); - } - } else { - { - let curArg = arguments[0]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'send' on 'WebSocket': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - } - } - return esValue[implSymbol].send(...args); - } - - get url() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get url' called on an object that is not a valid instance of WebSocket."); - } - - return esValue[implSymbol]["url"]; - } - - get readyState() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get readyState' called on an object that is not a valid instance of WebSocket." - ); - } - - return esValue[implSymbol]["readyState"]; - } - - get bufferedAmount() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get bufferedAmount' called on an object that is not a valid instance of WebSocket." - ); - } - - return esValue[implSymbol]["bufferedAmount"]; - } - - get onopen() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'get onopen' called on an object that is not a valid instance of WebSocket."); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onopen"]); - } - - set onopen(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'set onopen' called on an object that is not a valid instance of WebSocket."); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onopen' property on 'WebSocket': The provided value" - }); - } - esValue[implSymbol]["onopen"] = V; - } - - get onerror() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onerror' called on an object that is not a valid instance of WebSocket." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onerror"]); - } - - set onerror(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onerror' called on an object that is not a valid instance of WebSocket." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onerror' property on 'WebSocket': The provided value" - }); - } - esValue[implSymbol]["onerror"] = V; - } - - get onclose() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onclose' called on an object that is not a valid instance of WebSocket." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onclose"]); - } - - set onclose(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onclose' called on an object that is not a valid instance of WebSocket." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onclose' property on 'WebSocket': The provided value" - }); - } - esValue[implSymbol]["onclose"] = V; - } - - get extensions() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get extensions' called on an object that is not a valid instance of WebSocket." - ); - } - - return esValue[implSymbol]["extensions"]; - } - - get protocol() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get protocol' called on an object that is not a valid instance of WebSocket." - ); - } - - return esValue[implSymbol]["protocol"]; - } - - get onmessage() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onmessage' called on an object that is not a valid instance of WebSocket." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onmessage"]); - } - - set onmessage(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onmessage' called on an object that is not a valid instance of WebSocket." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onmessage' property on 'WebSocket': The provided value" - }); - } - esValue[implSymbol]["onmessage"] = V; - } - - get binaryType() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get binaryType' called on an object that is not a valid instance of WebSocket." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["binaryType"]); - } - - set binaryType(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set binaryType' called on an object that is not a valid instance of WebSocket." - ); - } - - V = `${V}`; - if (!BinaryType.enumerationValues.has(V)) { - return; - } - - esValue[implSymbol]["binaryType"] = V; - } - } - Object.defineProperties(WebSocket.prototype, { - close: { enumerable: true }, - send: { enumerable: true }, - url: { enumerable: true }, - readyState: { enumerable: true }, - bufferedAmount: { enumerable: true }, - onopen: { enumerable: true }, - onerror: { enumerable: true }, - onclose: { enumerable: true }, - extensions: { enumerable: true }, - protocol: { enumerable: true }, - onmessage: { enumerable: true }, - binaryType: { enumerable: true }, - [Symbol.toStringTag]: { value: "WebSocket", configurable: true }, - CONNECTING: { value: 0, enumerable: true }, - OPEN: { value: 1, enumerable: true }, - CLOSING: { value: 2, enumerable: true }, - CLOSED: { value: 3, enumerable: true } - }); - Object.defineProperties(WebSocket, { - CONNECTING: { value: 0, enumerable: true }, - OPEN: { value: 1, enumerable: true }, - CLOSING: { value: 2, enumerable: true }, - CLOSED: { value: 3, enumerable: true } - }); - ctorRegistry[interfaceName] = WebSocket; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: WebSocket - }); -}; - -const Impl = require("../websockets/WebSocket-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/WheelEvent.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/WheelEvent.js deleted file mode 100644 index 8ab0e97..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/WheelEvent.js +++ /dev/null @@ -1,191 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const WheelEventInit = require("./WheelEventInit.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const MouseEvent = require("./MouseEvent.js"); - -const interfaceName = "WheelEvent"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'WheelEvent'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["WheelEvent"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - MouseEvent._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class WheelEvent extends globalObject.MouseEvent { - constructor(type) { - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to construct 'WheelEvent': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to construct 'WheelEvent': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = WheelEventInit.convert(globalObject, curArg, { - context: "Failed to construct 'WheelEvent': parameter 2" - }); - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - get deltaX() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get deltaX' called on an object that is not a valid instance of WheelEvent." - ); - } - - return esValue[implSymbol]["deltaX"]; - } - - get deltaY() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get deltaY' called on an object that is not a valid instance of WheelEvent." - ); - } - - return esValue[implSymbol]["deltaY"]; - } - - get deltaZ() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get deltaZ' called on an object that is not a valid instance of WheelEvent." - ); - } - - return esValue[implSymbol]["deltaZ"]; - } - - get deltaMode() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get deltaMode' called on an object that is not a valid instance of WheelEvent." - ); - } - - return esValue[implSymbol]["deltaMode"]; - } - } - Object.defineProperties(WheelEvent.prototype, { - deltaX: { enumerable: true }, - deltaY: { enumerable: true }, - deltaZ: { enumerable: true }, - deltaMode: { enumerable: true }, - [Symbol.toStringTag]: { value: "WheelEvent", configurable: true }, - DOM_DELTA_PIXEL: { value: 0x00, enumerable: true }, - DOM_DELTA_LINE: { value: 0x01, enumerable: true }, - DOM_DELTA_PAGE: { value: 0x02, enumerable: true } - }); - Object.defineProperties(WheelEvent, { - DOM_DELTA_PIXEL: { value: 0x00, enumerable: true }, - DOM_DELTA_LINE: { value: 0x01, enumerable: true }, - DOM_DELTA_PAGE: { value: 0x02, enumerable: true } - }); - ctorRegistry[interfaceName] = WheelEvent; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: WheelEvent - }); -}; - -const Impl = require("../events/WheelEvent-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/WheelEventInit.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/WheelEventInit.js deleted file mode 100644 index 757f81c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/WheelEventInit.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const MouseEventInit = require("./MouseEventInit.js"); - -exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { - MouseEventInit._convertInherit(globalObject, obj, ret, { context }); - - { - const key = "deltaMode"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["unsigned long"](value, { - context: context + " has member 'deltaMode' that", - globals: globalObject - }); - - ret[key] = value; - } else { - ret[key] = 0; - } - } - - { - const key = "deltaX"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'deltaX' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0.0; - } - } - - { - const key = "deltaY"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'deltaY' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0.0; - } - } - - { - const key = "deltaZ"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions["double"](value, { context: context + " has member 'deltaZ' that", globals: globalObject }); - - ret[key] = value; - } else { - ret[key] = 0.0; - } - } -}; - -exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { - if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new globalObject.TypeError(`${context} is not an object.`); - } - - const ret = Object.create(null); - exports._convertInherit(globalObject, obj, ret, { context }); - return ret; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLDocument.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLDocument.js deleted file mode 100644 index d493a5e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLDocument.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const Document = require("./Document.js"); - -const interfaceName = "XMLDocument"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'XMLDocument'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["XMLDocument"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Document._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class XMLDocument extends globalObject.Document { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(XMLDocument.prototype, { - [Symbol.toStringTag]: { value: "XMLDocument", configurable: true } - }); - ctorRegistry[interfaceName] = XMLDocument; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: XMLDocument - }); -}; - -const Impl = require("../nodes/XMLDocument-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequest.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequest.js deleted file mode 100644 index 83b86fd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequest.js +++ /dev/null @@ -1,663 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Document = require("./Document.js"); -const Blob = require("./Blob.js"); -const FormData = require("./FormData.js"); -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const XMLHttpRequestResponseType = require("./XMLHttpRequestResponseType.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const XMLHttpRequestEventTarget = require("./XMLHttpRequestEventTarget.js"); - -const interfaceName = "XMLHttpRequest"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'XMLHttpRequest'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["XMLHttpRequest"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - XMLHttpRequestEventTarget._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "DedicatedWorker", "SharedWorker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class XMLHttpRequest extends globalObject.XMLHttpRequestEventTarget { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - open(method, url) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'open' called on an object that is not a valid instance of XMLHttpRequest."); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'open' on 'XMLHttpRequest': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - switch (arguments.length) { - case 2: - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - break; - case 3: - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - break; - case 4: - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 4", - globals: globalObject - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - break; - default: - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[2]; - curArg = conversions["boolean"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 3", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 4", - globals: globalObject - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - { - let curArg = arguments[4]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'open' on 'XMLHttpRequest': parameter 5", - globals: globalObject - }); - } - } else { - curArg = null; - } - args.push(curArg); - } - } - return esValue[implSymbol].open(...args); - } - - setRequestHeader(name, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'setRequestHeader' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - if (arguments.length < 2) { - throw new globalObject.TypeError( - `Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 2 arguments required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'setRequestHeader' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - { - let curArg = arguments[1]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'setRequestHeader' on 'XMLHttpRequest': parameter 2", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].setRequestHeader(...args); - } - - send() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'send' called on an object that is not a valid instance of XMLHttpRequest."); - } - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - if (Document.is(curArg) || Blob.is(curArg) || FormData.is(curArg)) { - curArg = utils.implForWrapper(curArg); - } else if (utils.isArrayBuffer(curArg)) { - curArg = conversions["ArrayBuffer"](curArg, { - context: "Failed to execute 'send' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - } else if (ArrayBuffer.isView(curArg)) { - curArg = conversions["ArrayBufferView"](curArg, { - context: "Failed to execute 'send' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - } else { - curArg = conversions["USVString"](curArg, { - context: "Failed to execute 'send' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - } - } - } else { - curArg = null; - } - args.push(curArg); - } - return esValue[implSymbol].send(...args); - } - - abort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError("'abort' called on an object that is not a valid instance of XMLHttpRequest."); - } - - return esValue[implSymbol].abort(); - } - - getResponseHeader(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getResponseHeader' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'getResponseHeader' on 'XMLHttpRequest': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["ByteString"](curArg, { - context: "Failed to execute 'getResponseHeader' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].getResponseHeader(...args); - } - - getAllResponseHeaders() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'getAllResponseHeaders' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return esValue[implSymbol].getAllResponseHeaders(); - } - - overrideMimeType(mime) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'overrideMimeType' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'overrideMimeType' on 'XMLHttpRequest': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions["DOMString"](curArg, { - context: "Failed to execute 'overrideMimeType' on 'XMLHttpRequest': parameter 1", - globals: globalObject - }); - args.push(curArg); - } - return esValue[implSymbol].overrideMimeType(...args); - } - - get onreadystatechange() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onreadystatechange' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onreadystatechange"]); - } - - set onreadystatechange(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onreadystatechange' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onreadystatechange' property on 'XMLHttpRequest': The provided value" - }); - } - esValue[implSymbol]["onreadystatechange"] = V; - } - - get readyState() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get readyState' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return esValue[implSymbol]["readyState"]; - } - - get timeout() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get timeout' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return esValue[implSymbol]["timeout"]; - } - - set timeout(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set timeout' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - V = conversions["unsigned long"](V, { - context: "Failed to set the 'timeout' property on 'XMLHttpRequest': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["timeout"] = V; - } - - get withCredentials() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get withCredentials' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return esValue[implSymbol]["withCredentials"]; - } - - set withCredentials(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set withCredentials' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - V = conversions["boolean"](V, { - context: "Failed to set the 'withCredentials' property on 'XMLHttpRequest': The provided value", - globals: globalObject - }); - - esValue[implSymbol]["withCredentials"] = V; - } - - get upload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get upload' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return utils.getSameObject(this, "upload", () => { - return utils.tryWrapperForImpl(esValue[implSymbol]["upload"]); - }); - } - - get responseURL() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get responseURL' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return esValue[implSymbol]["responseURL"]; - } - - get status() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get status' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return esValue[implSymbol]["status"]; - } - - get statusText() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get statusText' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return esValue[implSymbol]["statusText"]; - } - - get responseType() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get responseType' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["responseType"]); - } - - set responseType(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set responseType' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - V = `${V}`; - if (!XMLHttpRequestResponseType.enumerationValues.has(V)) { - return; - } - - esValue[implSymbol]["responseType"] = V; - } - - get response() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get response' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return esValue[implSymbol]["response"]; - } - - get responseText() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get responseText' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return esValue[implSymbol]["responseText"]; - } - - get responseXML() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get responseXML' called on an object that is not a valid instance of XMLHttpRequest." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["responseXML"]); - } - } - Object.defineProperties(XMLHttpRequest.prototype, { - open: { enumerable: true }, - setRequestHeader: { enumerable: true }, - send: { enumerable: true }, - abort: { enumerable: true }, - getResponseHeader: { enumerable: true }, - getAllResponseHeaders: { enumerable: true }, - overrideMimeType: { enumerable: true }, - onreadystatechange: { enumerable: true }, - readyState: { enumerable: true }, - timeout: { enumerable: true }, - withCredentials: { enumerable: true }, - upload: { enumerable: true }, - responseURL: { enumerable: true }, - status: { enumerable: true }, - statusText: { enumerable: true }, - responseType: { enumerable: true }, - response: { enumerable: true }, - responseText: { enumerable: true }, - responseXML: { enumerable: true }, - [Symbol.toStringTag]: { value: "XMLHttpRequest", configurable: true }, - UNSENT: { value: 0, enumerable: true }, - OPENED: { value: 1, enumerable: true }, - HEADERS_RECEIVED: { value: 2, enumerable: true }, - LOADING: { value: 3, enumerable: true }, - DONE: { value: 4, enumerable: true } - }); - Object.defineProperties(XMLHttpRequest, { - UNSENT: { value: 0, enumerable: true }, - OPENED: { value: 1, enumerable: true }, - HEADERS_RECEIVED: { value: 2, enumerable: true }, - LOADING: { value: 3, enumerable: true }, - DONE: { value: 4, enumerable: true } - }); - ctorRegistry[interfaceName] = XMLHttpRequest; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: XMLHttpRequest - }); -}; - -const Impl = require("../xhr/XMLHttpRequest-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestEventTarget.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestEventTarget.js deleted file mode 100644 index 94d7666..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestEventTarget.js +++ /dev/null @@ -1,334 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const EventHandlerNonNull = require("./EventHandlerNonNull.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const EventTarget = require("./EventTarget.js"); - -const interfaceName = "XMLHttpRequestEventTarget"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'XMLHttpRequestEventTarget'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["XMLHttpRequestEventTarget"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - EventTarget._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "DedicatedWorker", "SharedWorker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class XMLHttpRequestEventTarget extends globalObject.EventTarget { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - - get onloadstart() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadstart' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadstart"]); - } - - set onloadstart(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadstart' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadstart' property on 'XMLHttpRequestEventTarget': The provided value" - }); - } - esValue[implSymbol]["onloadstart"] = V; - } - - get onprogress() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onprogress' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onprogress"]); - } - - set onprogress(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onprogress' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onprogress' property on 'XMLHttpRequestEventTarget': The provided value" - }); - } - esValue[implSymbol]["onprogress"] = V; - } - - get onabort() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onabort' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onabort"]); - } - - set onabort(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onabort' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onabort' property on 'XMLHttpRequestEventTarget': The provided value" - }); - } - esValue[implSymbol]["onabort"] = V; - } - - get onerror() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onerror' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onerror"]); - } - - set onerror(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onerror' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onerror' property on 'XMLHttpRequestEventTarget': The provided value" - }); - } - esValue[implSymbol]["onerror"] = V; - } - - get onload() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onload' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onload"]); - } - - set onload(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onload' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onload' property on 'XMLHttpRequestEventTarget': The provided value" - }); - } - esValue[implSymbol]["onload"] = V; - } - - get ontimeout() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get ontimeout' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["ontimeout"]); - } - - set ontimeout(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set ontimeout' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'ontimeout' property on 'XMLHttpRequestEventTarget': The provided value" - }); - } - esValue[implSymbol]["ontimeout"] = V; - } - - get onloadend() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'get onloadend' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - return utils.tryWrapperForImpl(esValue[implSymbol]["onloadend"]); - } - - set onloadend(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'set onloadend' called on an object that is not a valid instance of XMLHttpRequestEventTarget." - ); - } - - if (!utils.isObject(V)) { - V = null; - } else { - V = EventHandlerNonNull.convert(globalObject, V, { - context: "Failed to set the 'onloadend' property on 'XMLHttpRequestEventTarget': The provided value" - }); - } - esValue[implSymbol]["onloadend"] = V; - } - } - Object.defineProperties(XMLHttpRequestEventTarget.prototype, { - onloadstart: { enumerable: true }, - onprogress: { enumerable: true }, - onabort: { enumerable: true }, - onerror: { enumerable: true }, - onload: { enumerable: true }, - ontimeout: { enumerable: true }, - onloadend: { enumerable: true }, - [Symbol.toStringTag]: { value: "XMLHttpRequestEventTarget", configurable: true } - }); - ctorRegistry[interfaceName] = XMLHttpRequestEventTarget; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: XMLHttpRequestEventTarget - }); -}; - -const Impl = require("../xhr/XMLHttpRequestEventTarget-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestResponseType.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestResponseType.js deleted file mode 100644 index 96a958f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestResponseType.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -const enumerationValues = new Set(["", "arraybuffer", "blob", "document", "json", "text"]); -exports.enumerationValues = enumerationValues; - -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - const string = `${value}`; - if (!enumerationValues.has(string)) { - throw new globalObject.TypeError( - `${context} '${string}' is not a valid enumeration value for XMLHttpRequestResponseType` - ); - } - return string; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestUpload.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestUpload.js deleted file mode 100644 index 148e8a2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestUpload.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const XMLHttpRequestEventTarget = require("./XMLHttpRequestEventTarget.js"); - -const interfaceName = "XMLHttpRequestUpload"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'XMLHttpRequestUpload'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["XMLHttpRequestUpload"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - XMLHttpRequestEventTarget._internalSetup(wrapper, globalObject); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window", "DedicatedWorker", "SharedWorker"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class XMLHttpRequestUpload extends globalObject.XMLHttpRequestEventTarget { - constructor() { - throw new globalObject.TypeError("Illegal constructor"); - } - } - Object.defineProperties(XMLHttpRequestUpload.prototype, { - [Symbol.toStringTag]: { value: "XMLHttpRequestUpload", configurable: true } - }); - ctorRegistry[interfaceName] = XMLHttpRequestUpload; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: XMLHttpRequestUpload - }); -}; - -const Impl = require("../xhr/XMLHttpRequestUpload-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLSerializer.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLSerializer.js deleted file mode 100644 index be23a18..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/XMLSerializer.js +++ /dev/null @@ -1,132 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const utils = require("./utils.js"); - -const Node = require("./Node.js"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = "XMLSerializer"; - -exports.is = value => { - return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new globalObject.TypeError(`${context} is not of type 'XMLSerializer'.`); -}; - -function makeWrapper(globalObject, newTarget) { - let proto; - if (newTarget !== undefined) { - proto = newTarget.prototype; - } - - if (!utils.isObject(proto)) { - proto = globalObject[ctorRegistrySymbol]["XMLSerializer"].prototype; - } - - return Object.create(proto); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = (globalObject, newTarget) => { - const wrapper = makeWrapper(globalObject, newTarget); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set(["Window"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const ctorRegistry = utils.initCtorRegistry(globalObject); - class XMLSerializer { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - serializeToString(root) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new globalObject.TypeError( - "'serializeToString' called on an object that is not a valid instance of XMLSerializer." - ); - } - - if (arguments.length < 1) { - throw new globalObject.TypeError( - `Failed to execute 'serializeToString' on 'XMLSerializer': 1 argument required, but only ${arguments.length} present.` - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = Node.convert(globalObject, curArg, { - context: "Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1" - }); - args.push(curArg); - } - return esValue[implSymbol].serializeToString(...args); - } - } - Object.defineProperties(XMLSerializer.prototype, { - serializeToString: { enumerable: true }, - [Symbol.toStringTag]: { value: "XMLSerializer", configurable: true } - }); - ctorRegistry[interfaceName] = XMLSerializer; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: XMLSerializer - }); -}; - -const Impl = require("../domparsing/XMLSerializer-impl.js"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/utils.js b/vanilla/node_modules/jsdom/lib/jsdom/living/generated/utils.js deleted file mode 100644 index 5e50979..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/generated/utils.js +++ /dev/null @@ -1,252 +0,0 @@ -"use strict"; - -// Returns "Type(value) is Object" in ES terminology. -function isObject(value) { - return (typeof value === "object" && value !== null) || typeof value === "function"; -} - -const call = Function.call.bind(Function.call); - -// Like `Object.assign`, but using `[[GetOwnProperty]]` and `[[DefineOwnProperty]]` -// instead of `[[Get]]` and `[[Set]]` and only allowing objects -function define(target, source) { - for (const key of Reflect.ownKeys(source)) { - const descriptor = Reflect.getOwnPropertyDescriptor(source, key); - if (descriptor && !Reflect.defineProperty(target, key, descriptor)) { - throw new TypeError(`Cannot redefine property: ${String(key)}`); - } - } -} - -function newObjectInRealm(globalObject, object) { - const ctorRegistry = initCtorRegistry(globalObject); - return Object.defineProperties( - Object.create(ctorRegistry["%Object.prototype%"]), - Object.getOwnPropertyDescriptors(object) - ); -} - -const wrapperSymbol = Symbol("wrapper"); -const implSymbol = Symbol("impl"); -const sameObjectCaches = Symbol("SameObject caches"); -const ctorRegistrySymbol = Symbol.for("[webidl2js] constructor registry"); - -const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(async function* () {}).prototype); - -function initCtorRegistry(globalObject) { - if (Object.hasOwn(globalObject, ctorRegistrySymbol)) { - return globalObject[ctorRegistrySymbol]; - } - - const ctorRegistry = Object.create(null); - - // In addition to registering all the WebIDL2JS-generated types in the constructor registry, - // we also register a few intrinsics that we make use of in generated code, since they are not - // easy to grab from the globalObject variable. - ctorRegistry["%Object.prototype%"] = globalObject.Object.prototype; - ctorRegistry["%IteratorPrototype%"] = Object.getPrototypeOf( - Object.getPrototypeOf(new globalObject.Array()[Symbol.iterator]()) - ); - - try { - ctorRegistry["%AsyncIteratorPrototype%"] = Object.getPrototypeOf( - Object.getPrototypeOf( - globalObject.eval("(async function* () {})").prototype - ) - ); - } catch { - ctorRegistry["%AsyncIteratorPrototype%"] = AsyncIteratorPrototype; - } - - globalObject[ctorRegistrySymbol] = ctorRegistry; - return ctorRegistry; -} - -function getSameObject(wrapper, prop, creator) { - if (!wrapper[sameObjectCaches]) { - wrapper[sameObjectCaches] = Object.create(null); - } - - if (prop in wrapper[sameObjectCaches]) { - return wrapper[sameObjectCaches][prop]; - } - - wrapper[sameObjectCaches][prop] = creator(); - return wrapper[sameObjectCaches][prop]; -} - -function wrapperForImpl(impl) { - return impl ? impl[wrapperSymbol] : null; -} - -function implForWrapper(wrapper) { - return wrapper ? wrapper[implSymbol] : null; -} - -function tryWrapperForImpl(impl) { - const wrapper = wrapperForImpl(impl); - return wrapper ? wrapper : impl; -} - -function tryImplForWrapper(wrapper) { - const impl = implForWrapper(wrapper); - return impl ? impl : wrapper; -} - -const iterInternalSymbol = Symbol("internal"); - -function isArrayIndexPropName(P) { - if (typeof P !== "string") { - return false; - } - const i = P >>> 0; - if (i === 2 ** 32 - 1) { - return false; - } - const s = `${i}`; - if (P !== s) { - return false; - } - return true; -} - -const arrayBufferByteLengthGetter = - Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get; -function isArrayBuffer(value) { - try { - arrayBufferByteLengthGetter.call(value); - return true; - } catch { - return false; - } -} - -const sharedArrayBufferByteLengthGetter = - Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get; -function isSharedArrayBuffer(value) { - try { - sharedArrayBufferByteLengthGetter.call(value); - return true; - } catch { - return false; - } -} - -function iteratorResult([key, value], kind) { - let result; - switch (kind) { - case "key": - result = key; - break; - case "value": - result = value; - break; - case "key+value": - result = [key, value]; - break; - } - return { value: result, done: false }; -} - -function ordinarySetWithOwnDescriptor(target, property, value, receiver, ownDesc) { - if (ownDesc === undefined) { - const parent = Reflect.getPrototypeOf(target); - if (parent !== null) { - return Reflect.set(parent, property, value, receiver); - } - ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; - } - if (isDataDescriptor(ownDesc)) { - if (!ownDesc.writable) { - return false; - } - if (!isObject(receiver)) { - return false; - } - const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, property); - if (existingDesc !== undefined) { - if (isAccessorDescriptor(existingDesc)) { - return false; - } - if (existingDesc.writable === false) { - return false; - } - const valueDesc = { value }; - return Reflect.defineProperty(receiver, property, valueDesc); - } - - return Reflect.defineProperty( - receiver, - property, - { value, writable: true, enumerable: true, configurable: true } - ); - } - - const setter = ownDesc.set; - if (setter === undefined) { - return false; - } - call(setter, receiver, value); - return true; -} - -function isDataDescriptor(desc) { - return Object.hasOwn(desc, "value") || Object.hasOwn(desc, "writable"); -} - -function isAccessorDescriptor(desc) { - return Object.hasOwn(desc, "get") || Object.hasOwn(desc, "set"); -} - -const supportsPropertyIndex = Symbol("supports property index"); -const supportedPropertyIndices = Symbol("supported property indices"); -const supportsPropertyName = Symbol("supports property name"); -const supportedPropertyNames = Symbol("supported property names"); -const indexedGet = Symbol("indexed property get"); -const indexedSetNew = Symbol("indexed property set new"); -const indexedSetExisting = Symbol("indexed property set existing"); -const namedGet = Symbol("named property get"); -const namedSetNew = Symbol("named property set new"); -const namedSetExisting = Symbol("named property set existing"); -const namedDelete = Symbol("named property delete"); - -const asyncIteratorNext = Symbol("async iterator get the next iteration result"); -const asyncIteratorReturn = Symbol("async iterator return steps"); -const asyncIteratorInit = Symbol("async iterator initialization steps"); -const asyncIteratorEOI = Symbol("async iterator end of iteration"); - -module.exports = exports = { - isObject, - define, - newObjectInRealm, - wrapperSymbol, - implSymbol, - getSameObject, - ctorRegistrySymbol, - initCtorRegistry, - wrapperForImpl, - implForWrapper, - tryWrapperForImpl, - tryImplForWrapper, - iterInternalSymbol, - isArrayBuffer, - isSharedArrayBuffer, - isArrayIndexPropName, - supportsPropertyIndex, - supportedPropertyIndices, - supportsPropertyName, - supportedPropertyNames, - indexedGet, - indexedSetNew, - indexedSetExisting, - namedGet, - namedSetNew, - namedSetExisting, - namedDelete, - asyncIteratorNext, - asyncIteratorReturn, - asyncIteratorInit, - asyncIteratorEOI, - iteratorResult, - ordinarySetWithOwnDescriptor -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/geometry/DOMRect-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/geometry/DOMRect-impl.js deleted file mode 100644 index 7a71f55..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/geometry/DOMRect-impl.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -const DOMRectReadOnlyImpl = require("./DOMRectReadOnly-impl").implementation; -const DOMRect = require("../generated/DOMRect"); - -class DOMRectImpl extends DOMRectReadOnlyImpl { - static fromRect(globalObject, other) { - return DOMRect.createImpl(globalObject, [other.x, other.y, other.width, other.height]); - } - - get x() { - return super.x; - } - set x(newX) { - this._x = newX; - } - - get y() { - return super.y; - } - set y(newY) { - this._y = newY; - } - - get width() { - return super.width; - } - set width(newWidth) { - this._width = newWidth; - } - - get height() { - return super.height; - } - set height(newHeight) { - this._height = newHeight; - } -} - -exports.implementation = DOMRectImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/geometry/DOMRectReadOnly-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/geometry/DOMRectReadOnly-impl.js deleted file mode 100644 index 5179865..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/geometry/DOMRectReadOnly-impl.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -const DOMRectReadOnly = require("../generated/DOMRectReadOnly"); - -class DOMRectReadOnlyImpl { - constructor(globalObject, [x = 0, y = 0, width = 0, height = 0]) { - this._globalObject = globalObject; - this._x = x; - this._y = y; - this._width = width; - this._height = height; - } - - static fromRect(globalObject, other) { - return DOMRectReadOnly.createImpl(globalObject, [other.x, other.y, other.width, other.height]); - } - - get x() { - return this._x; - } - - get y() { - return this._y; - } - - get width() { - return this._width; - } - - get height() { - return this._height; - } - - get top() { - const { height, y } = this; - // We use Math.min's built-in NaN handling: https://github.com/w3c/fxtf-drafts/issues/222 - return Math.min(y, y + height); - } - - get right() { - const { width, x } = this; - // We use Math.max's built-in NaN handling: https://github.com/w3c/fxtf-drafts/issues/222 - return Math.max(x, x + width); - } - - get bottom() { - const { height, y } = this; - // We use Math.max's built-in NaN handling: https://github.com/w3c/fxtf-drafts/issues/222 - return Math.max(y, y + height); - } - - get left() { - const { width, x } = this; - // We use Math.min's built-in NaN handling: https://github.com/w3c/fxtf-drafts/issues/222 - return Math.min(x, x + width); - } - - // Could be removed after https://github.com/jsdom/webidl2js/issues/185 gets fixed. - toJSON() { - return { - x: this.x, - y: this.y, - width: this.width, - height: this.height, - top: this.top, - right: this.right, - bottom: this.bottom, - left: this.left - }; - } -} - -exports.implementation = DOMRectReadOnlyImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js deleted file mode 100644 index db0ed91..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; - -/** - * Concatenate the given typed arrays into a single `Uint8Array`. - * - * @param {Array<TypedArray>} arrays - An array of typed arrays. They can be of any type (but not `DataView` or - * `ArrayBuffer`). - * @returns {Uint8Array} - A new `Uint8Array` containing a copy of the concatenated data. - * @see {@link https://github.com/tc39/proposal-typedarray-concat} - */ -exports.concatTypedArrays = arrays => { - const totalLength = arrays.reduce((sum, arr) => sum + arr.byteLength, 0); - const result = new Uint8Array(totalLength); - let offset = 0; - for (const arr of arrays) { - const toSet = arr instanceof Uint8Array ? arr : new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); - result.set(toSet, offset); - offset += arr.byteLength; - } - return result; -}; - -/** - * Create a copy of the data in a given `ArrayBuffer`, in a new `ArrayBuffer` created in the target realm. - * - * Used when we have some internal data, usually in the Node.js realm, and we need to copy it to the target realm. - * Compared to {@link copyToArrayBufferInTargetRealmDestructively}, use this when we need to keep the original data - * around, such as when exposing the data from inside the `Blob` implementation to the user. - * - * @param {ArrayBuffer} arrayBuffer - The `ArrayBuffer` to copy the data from. - * @param {object} newRealm - The target realm's global object, which has `ArrayBuffer` and `Uint8Array` constructor - * properties. - * @returns {ArrayBuffer} - A new `ArrayBuffer` containing a copy of the data, using the `ArrayBuffer` constructor from - * `newRealm`. - */ -exports.copyToArrayBufferInTargetRealm = (arrayBuffer, newRealm) => { - const newAB = new newRealm.ArrayBuffer(arrayBuffer.byteLength); - const view = new newRealm.Uint8Array(newAB); - view.set(new newRealm.Uint8Array(arrayBuffer)); - return newAB; -}; - -/** - * Create a copy of the data in a given `ArrayBuffer`, in a new `ArrayBuffer` created in the target realm. The original - * `ArrayBuffer` is transferred in the process, so its data is no longer usable. - * - * Used when we have some internal data, usually in the Node.js realm, and we need to copy it to the target realm. - * Compared to {@link copyToArrayBufferInTargetRealm}, use this when we don't need to keep the original data around, - * such as when copying data from the Node.js network or `WebSocket` stack to the jsdom user. - * - * @param {ArrayBuffer} arrayBuffer - The `ArrayBuffer` to extract the data from. After calling this function, - * `arrayBuffer` is no longer usable. - * @param {object} newRealm - The target realm's global object, which has an `ArrayBuffer` constructor property. - * @returns {ArrayBuffer} - A new `ArrayBuffer` containing the original data data, using the `ArrayBuffer` constructor - * from `newRealm`. - */ -exports.copyToArrayBufferInTargetRealmDestructively = (arrayBuffer, newRealm) => { - if (!newRealm.ArrayBuffer.prototype.transfer) { - return exports.copyToArrayBufferInTargetRealm(arrayBuffer, newRealm); - } - - return newRealm.ArrayBuffer.prototype.transfer.call(arrayBuffer); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/colors.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/colors.js deleted file mode 100644 index ca8653c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/colors.js +++ /dev/null @@ -1,245 +0,0 @@ -"use strict"; - -// https://drafts.csswg.org/css-color-4/#named-color -const namedColors = { - __proto__: null, - aliceblue: [0xF0, 0xF8, 0xFF], - antiquewhite: [0xFA, 0xEB, 0xD7], - aqua: [0x00, 0xFF, 0xFF], - aquamarine: [0x7F, 0xFF, 0xD4], - azure: [0xF0, 0xFF, 0xFF], - beige: [0xF5, 0xF5, 0xDC], - bisque: [0xFF, 0xE4, 0xC4], - black: [0x00, 0x00, 0x00], - blanchedalmond: [0xFF, 0xEB, 0xCD], - blue: [0x00, 0x00, 0xFF], - blueviolet: [0x8A, 0x2B, 0xE2], - brown: [0xA5, 0x2A, 0x2A], - burlywood: [0xDE, 0xB8, 0x87], - cadetblue: [0x5F, 0x9E, 0xA0], - chartreuse: [0x7F, 0xFF, 0x00], - chocolate: [0xD2, 0x69, 0x1E], - coral: [0xFF, 0x7F, 0x50], - cornflowerblue: [0x64, 0x95, 0xED], - cornsilk: [0xFF, 0xF8, 0xDC], - crimson: [0xDC, 0x14, 0x3C], - cyan: [0x00, 0xFF, 0xFF], - darkblue: [0x00, 0x00, 0x8B], - darkcyan: [0x00, 0x8B, 0x8B], - darkgoldenrod: [0xB8, 0x86, 0x0B], - darkgray: [0xA9, 0xA9, 0xA9], - darkgreen: [0x00, 0x64, 0x00], - darkgrey: [0xA9, 0xA9, 0xA9], - darkkhaki: [0xBD, 0xB7, 0x6B], - darkmagenta: [0x8B, 0x00, 0x8B], - darkolivegreen: [0x55, 0x6B, 0x2F], - darkorange: [0xFF, 0x8C, 0x00], - darkorchid: [0x99, 0x32, 0xCC], - darkred: [0x8B, 0x00, 0x00], - darksalmon: [0xE9, 0x96, 0x7A], - darkseagreen: [0x8F, 0xBC, 0x8F], - darkslateblue: [0x48, 0x3D, 0x8B], - darkslategray: [0x2F, 0x4F, 0x4F], - darkslategrey: [0x2F, 0x4F, 0x4F], - darkturquoise: [0x00, 0xCE, 0xD1], - darkviolet: [0x94, 0x00, 0xD3], - deeppink: [0xFF, 0x14, 0x93], - deepskyblue: [0x00, 0xBF, 0xFF], - dimgray: [0x69, 0x69, 0x69], - dimgrey: [0x69, 0x69, 0x69], - dodgerblue: [0x1E, 0x90, 0xFF], - firebrick: [0xB2, 0x22, 0x22], - floralwhite: [0xFF, 0xFA, 0xF0], - forestgreen: [0x22, 0x8B, 0x22], - fuchsia: [0xFF, 0x00, 0xFF], - gainsboro: [0xDC, 0xDC, 0xDC], - ghostwhite: [0xF8, 0xF8, 0xFF], - gold: [0xFF, 0xD7, 0x00], - goldenrod: [0xDA, 0xA5, 0x20], - gray: [0x80, 0x80, 0x80], - green: [0x00, 0x80, 0x00], - greenyellow: [0xAD, 0xFF, 0x2F], - grey: [0x80, 0x80, 0x80], - honeydew: [0xF0, 0xFF, 0xF0], - hotpink: [0xFF, 0x69, 0xB4], - indianred: [0xCD, 0x5C, 0x5C], - indigo: [0x4B, 0x00, 0x82], - ivory: [0xFF, 0xFF, 0xF0], - khaki: [0xF0, 0xE6, 0x8C], - lavender: [0xE6, 0xE6, 0xFA], - lavenderblush: [0xFF, 0xF0, 0xF5], - lawngreen: [0x7C, 0xFC, 0x00], - lemonchiffon: [0xFF, 0xFA, 0xCD], - lightblue: [0xAD, 0xD8, 0xE6], - lightcoral: [0xF0, 0x80, 0x80], - lightcyan: [0xE0, 0xFF, 0xFF], - lightgoldenrodyellow: [0xFA, 0xFA, 0xD2], - lightgray: [0xD3, 0xD3, 0xD3], - lightgreen: [0x90, 0xEE, 0x90], - lightgrey: [0xD3, 0xD3, 0xD3], - lightpink: [0xFF, 0xB6, 0xC1], - lightsalmon: [0xFF, 0xA0, 0x7A], - lightseagreen: [0x20, 0xB2, 0xAA], - lightskyblue: [0x87, 0xCE, 0xFA], - lightslategray: [0x77, 0x88, 0x99], - lightslategrey: [0x77, 0x88, 0x99], - lightsteelblue: [0xB0, 0xC4, 0xDE], - lightyellow: [0xFF, 0xFF, 0xE0], - lime: [0x00, 0xFF, 0x00], - limegreen: [0x32, 0xCD, 0x32], - linen: [0xFA, 0xF0, 0xE6], - magenta: [0xFF, 0x00, 0xFF], - maroon: [0x80, 0x00, 0x00], - mediumaquamarine: [0x66, 0xCD, 0xAA], - mediumblue: [0x00, 0x00, 0xCD], - mediumorchid: [0xBA, 0x55, 0xD3], - mediumpurple: [0x93, 0x70, 0xDB], - mediumseagreen: [0x3C, 0xB3, 0x71], - mediumslateblue: [0x7B, 0x68, 0xEE], - mediumspringgreen: [0x00, 0xFA, 0x9A], - mediumturquoise: [0x48, 0xD1, 0xCC], - mediumvioletred: [0xC7, 0x15, 0x85], - midnightblue: [0x19, 0x19, 0x70], - mintcream: [0xF5, 0xFF, 0xFA], - mistyrose: [0xFF, 0xE4, 0xE1], - moccasin: [0xFF, 0xE4, 0xB5], - navajowhite: [0xFF, 0xDE, 0xAD], - navy: [0x00, 0x00, 0x80], - oldlace: [0xFD, 0xF5, 0xE6], - olive: [0x80, 0x80, 0x00], - olivedrab: [0x6B, 0x8E, 0x23], - orange: [0xFF, 0xA5, 0x00], - orangered: [0xFF, 0x45, 0x00], - orchid: [0xDA, 0x70, 0xD6], - palegoldenrod: [0xEE, 0xE8, 0xAA], - palegreen: [0x98, 0xFB, 0x98], - paleturquoise: [0xAF, 0xEE, 0xEE], - palevioletred: [0xDB, 0x70, 0x93], - papayawhip: [0xFF, 0xEF, 0xD5], - peachpuff: [0xFF, 0xDA, 0xB9], - peru: [0xCD, 0x85, 0x3F], - pink: [0xFF, 0xC0, 0xCB], - plum: [0xDD, 0xA0, 0xDD], - powderblue: [0xB0, 0xE0, 0xE6], - purple: [0x80, 0x00, 0x80], - rebeccapurple: [0x66, 0x33, 0x99], - red: [0xFF, 0x00, 0x00], - rosybrown: [0xBC, 0x8F, 0x8F], - royalblue: [0x41, 0x69, 0xE1], - saddlebrown: [0x8B, 0x45, 0x13], - salmon: [0xFA, 0x80, 0x72], - sandybrown: [0xF4, 0xA4, 0x60], - seagreen: [0x2E, 0x8B, 0x57], - seashell: [0xFF, 0xF5, 0xEE], - sienna: [0xA0, 0x52, 0x2D], - silver: [0xC0, 0xC0, 0xC0], - skyblue: [0x87, 0xCE, 0xEB], - slateblue: [0x6A, 0x5A, 0xCD], - slategray: [0x70, 0x80, 0x90], - slategrey: [0x70, 0x80, 0x90], - snow: [0xFF, 0xFA, 0xFA], - springgreen: [0x00, 0xFF, 0x7F], - steelblue: [0x46, 0x82, 0xB4], - tan: [0xD2, 0xB4, 0x8C], - teal: [0x00, 0x80, 0x80], - thistle: [0xD8, 0xBF, 0xD8], - tomato: [0xFF, 0x63, 0x47], - turquoise: [0x40, 0xE0, 0xD0], - violet: [0xEE, 0x82, 0xEE], - wheat: [0xF5, 0xDE, 0xB3], - white: [0xFF, 0xFF, 0xFF], - whitesmoke: [0xF5, 0xF5, 0xF5], - yellow: [0xFF, 0xFF, 0x00], - yellowgreen: [0x9A, 0xCD, 0x32] -}; - -// Implements some of https://drafts.csswg.org/css-color-4/#resolving-sRGB-values and -// https://drafts.csswg.org/css-color-4/#serializing-sRGB-values, in a somewhat fragile way since -// we're not using a real parser/serializer. Attempts to cover: -// * hex colors -// * 'rgb()' and 'rgba()' values -// * named colors -// * 'transparent' - -exports.getSpecifiedColor = color => { - const lowercasedColor = color.toLowerCase(); - if (Object.hasOwn(namedColors, lowercasedColor) || lowercasedColor === "transparent") { - return lowercasedColor; - } - - return sharedSpecifiedAndComputedAndUsed(color); -}; - -exports.getComputedOrUsedColor = color => { - const lowercasedColor = color.toLowerCase(); - const fromNamedColors = namedColors[lowercasedColor]; - if (fromNamedColors !== undefined) { - return `rgb(${fromNamedColors.join(", ")})`; - } - - if (lowercasedColor === "transparent") { - return "rgba(0, 0, 0, 0)"; - } - - return sharedSpecifiedAndComputedAndUsed(color); -}; - -function sharedSpecifiedAndComputedAndUsed(color) { - if (/^#[0-9A-Fa-f]{6}$/.test(color) || /^#[0-9A-Fa-f]{3}$/.test(color)) { - return hexToRGB(color.slice(1)); - } - - if (/^#[0-9A-Fa-f]{8}$/.test(color) || /^#[0-9A-Fa-f]{4}$/.test(color)) { - return hexToRGBA(color.slice(1)); - } - - if (/^rgba?\(/.test(color)) { - return color.split(",").map(s => s.trim()).join(", "); - } - - return color; -} - -function hexToRGB(color) { - if (color.length === 6) { - const [r1, r2, g1, g2, b1, b2] = color.split(""); - - return `rgb(${hexesToDecimals([r1, r2], [g1, g2], [b1, b2]).join(", ")})`; - } - - if (color.length === 3) { - const [r1, g1, b1] = color.split(""); - - return `rgb(${hexesToDecimals([r1, r1], [g1, g1], [b1, b1]).join(", ")})`; - } - - return "rgb(0, 0, 0)"; -} - -function hexToRGBA(color) { - if (color.length === 8) { - const [r1, r2, g1, g2, b1, b2, a1, a2] = color.split(""); - - return `rgba(${hexesToDecimals([r1, r2], [g1, g2], [b1, b2]).join(", ")}, ${hexToPercent(a1, a2)})`; - } - - if (color.length === 4) { - const [r1, g1, b1, a1] = color.split(""); - - return `rgba(${hexesToDecimals([r1, r1], [g1, g1], [b1, b1]).join(", ")}, ${hexToPercent(a1, a1)})`; - } - - return "rgba(0, 0, 0, 1)"; -} - -function hexToDecimal(d1, d2) { - return parseInt(d1, 16) * 16 + parseInt(d2, 16); -} - -function hexesToDecimals(...hexes) { - return hexes.map(pair => hexToDecimal(pair[0], pair[1])); -} - -function hexToPercent(d1, d2) { - return Math.floor(1000 * hexToDecimal(d1, d2) / 255) / 1000; -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/create-element.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/create-element.js deleted file mode 100644 index fca473f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/create-element.js +++ /dev/null @@ -1,329 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); - -const interfaces = require("../interfaces"); - -const { implForWrapper } = require("../generated/utils"); - -const { HTML_NS, SVG_NS } = require("./namespaces"); -const { domSymbolTree } = require("./internal-constants"); -const { validateAndExtract } = require("./validate-names"); -const reportException = require("./runtime-script-errors"); -const { - isValidCustomElementName, upgradeElement, lookupCEDefinition, enqueueCEUpgradeReaction -} = require("./custom-elements"); - -const INTERFACE_TAG_MAPPING = { - __proto__: null, - // https://html.spec.whatwg.org/multipage/dom.html#elements-in-the-dom%3Aelement-interface - // https://html.spec.whatwg.org/multipage/indices.html#elements-3 - [HTML_NS]: { - __proto__: null, - HTMLElement: [ - "abbr", "address", "article", "aside", "b", "bdi", "bdo", "cite", "code", "dd", "dfn", "dt", "em", "figcaption", - "figure", "footer", "header", "hgroup", "i", "kbd", "main", "mark", "nav", "noscript", "rp", "rt", "ruby", "s", - "samp", "section", "small", "strong", "sub", "summary", "sup", "u", "var", "wbr" - ], - HTMLAnchorElement: ["a"], - HTMLAreaElement: ["area"], - HTMLAudioElement: ["audio"], - HTMLBaseElement: ["base"], - HTMLBodyElement: ["body"], - HTMLBRElement: ["br"], - HTMLButtonElement: ["button"], - HTMLCanvasElement: ["canvas"], - HTMLDataElement: ["data"], - HTMLDataListElement: ["datalist"], - HTMLDetailsElement: ["details"], - HTMLDialogElement: ["dialog"], - HTMLDirectoryElement: ["dir"], - HTMLDivElement: ["div"], - HTMLDListElement: ["dl"], - HTMLEmbedElement: ["embed"], - HTMLFieldSetElement: ["fieldset"], - HTMLFontElement: ["font"], - HTMLFormElement: ["form"], - HTMLFrameElement: ["frame"], - HTMLFrameSetElement: ["frameset"], - HTMLHeadingElement: ["h1", "h2", "h3", "h4", "h5", "h6"], - HTMLHeadElement: ["head"], - HTMLHRElement: ["hr"], - HTMLHtmlElement: ["html"], - HTMLIFrameElement: ["iframe"], - HTMLImageElement: ["img"], - HTMLInputElement: ["input"], - HTMLLabelElement: ["label"], - HTMLLegendElement: ["legend"], - HTMLLIElement: ["li"], - HTMLLinkElement: ["link"], - HTMLMapElement: ["map"], - HTMLMarqueeElement: ["marquee"], - HTMLMediaElement: [], - HTMLMenuElement: ["menu"], - HTMLMetaElement: ["meta"], - HTMLMeterElement: ["meter"], - HTMLModElement: ["del", "ins"], - HTMLObjectElement: ["object"], - HTMLOListElement: ["ol"], - HTMLOptGroupElement: ["optgroup"], - HTMLOptionElement: ["option"], - HTMLOutputElement: ["output"], - HTMLParagraphElement: ["p"], - HTMLParamElement: ["param"], - HTMLPictureElement: ["picture"], - HTMLPreElement: ["listing", "pre", "xmp"], - HTMLProgressElement: ["progress"], - HTMLQuoteElement: ["blockquote", "q"], - HTMLScriptElement: ["script"], - HTMLSelectElement: ["select"], - HTMLSlotElement: ["slot"], - HTMLSourceElement: ["source"], - HTMLSpanElement: ["span"], - HTMLStyleElement: ["style"], - HTMLTableCaptionElement: ["caption"], - HTMLTableCellElement: ["th", "td"], - HTMLTableColElement: ["col", "colgroup"], - HTMLTableElement: ["table"], - HTMLTimeElement: ["time"], - HTMLTitleElement: ["title"], - HTMLTableRowElement: ["tr"], - HTMLTableSectionElement: ["thead", "tbody", "tfoot"], - HTMLTemplateElement: ["template"], - HTMLTextAreaElement: ["textarea"], - HTMLTrackElement: ["track"], - HTMLUListElement: ["ul"], - HTMLUnknownElement: [], - HTMLVideoElement: ["video"] - }, - [SVG_NS]: { - __proto__: null, - SVGElement: [], - SVGGraphicsElement: [], - SVGDefsElement: ["defs"], - SVGDescElement: ["desc"], - SVGGElement: ["g"], - SVGMetadataElement: ["metadata"], - SVGSVGElement: ["svg"], - SVGSwitchElement: ["switch"], - SVGSymbolElement: ["symbol"], - SVGTitleElement: ["title"] - } -}; - -const TAG_INTERFACE_LOOKUP = Object.create(null); - -for (const namespace of [HTML_NS, SVG_NS]) { - TAG_INTERFACE_LOOKUP[namespace] = Object.create(null); - - const interfaceNames = Object.keys(INTERFACE_TAG_MAPPING[namespace]); - for (const interfaceName of interfaceNames) { - const tagNames = INTERFACE_TAG_MAPPING[namespace][interfaceName]; - - for (const tagName of tagNames) { - TAG_INTERFACE_LOOKUP[namespace][tagName] = interfaceName; - } - } -} - -const UNKNOWN_HTML_ELEMENTS_NAMES = ["applet", "bgsound", "blink", "isindex", "keygen", "multicol", "nextid", "spacer"]; -const HTML_ELEMENTS_NAMES = [ - "acronym", "basefont", "big", "center", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", - "strike", "tt" -]; - -// https://html.spec.whatwg.org/multipage/dom.html#elements-in-the-dom:element-interface -function getHTMLElementInterface(name) { - if (UNKNOWN_HTML_ELEMENTS_NAMES.includes(name)) { - return interfaces.getInterfaceWrapper("HTMLUnknownElement"); - } - - if (HTML_ELEMENTS_NAMES.includes(name)) { - return interfaces.getInterfaceWrapper("HTMLElement"); - } - - const specDefinedInterface = TAG_INTERFACE_LOOKUP[HTML_NS][name]; - if (specDefinedInterface !== undefined) { - return interfaces.getInterfaceWrapper(specDefinedInterface); - } - - if (isValidCustomElementName(name)) { - return interfaces.getInterfaceWrapper("HTMLElement"); - } - - return interfaces.getInterfaceWrapper("HTMLUnknownElement"); -} - -// https://svgwg.org/svg2-draft/types.html#ElementsInTheSVGDOM -function getSVGInterface(name) { - const specDefinedInterface = TAG_INTERFACE_LOOKUP[SVG_NS][name]; - if (specDefinedInterface !== undefined) { - return interfaces.getInterfaceWrapper(specDefinedInterface); - } - - return interfaces.getInterfaceWrapper("SVGElement"); -} - -// Returns the list of valid tag names that can bo associated with a element given its namespace and name. -function getValidTagNames(namespace, name) { - if (INTERFACE_TAG_MAPPING[namespace] && INTERFACE_TAG_MAPPING[namespace][name]) { - return INTERFACE_TAG_MAPPING[namespace][name]; - } - - return []; -} - -// https://dom.spec.whatwg.org/#concept-create-element -function createElement( - document, - localName, - namespace, - prefix = null, - isValue = null, - synchronousCE = false -) { - let result = null; - - const { _globalObject } = document; - const definition = lookupCEDefinition(document, namespace, localName, isValue); - - if (definition !== null && definition.name !== localName) { - const elementInterface = getHTMLElementInterface(localName); - - result = elementInterface.createImpl(_globalObject, [], { - ownerDocument: document, - localName, - namespace: HTML_NS, - prefix, - ceState: "undefined", - ceDefinition: null, - isValue - }); - - if (synchronousCE) { - upgradeElement(definition, result); - } else { - enqueueCEUpgradeReaction(result, definition); - } - } else if (definition !== null) { - if (synchronousCE) { - try { - const C = definition.constructor; - - const resultWrapper = C.construct(); - result = implForWrapper(resultWrapper); - - if (!result._ceState || !result._ceDefinition || result._namespaceURI !== HTML_NS) { - throw new TypeError("Internal error: Invalid custom element."); - } - - if (result._attributeList.length !== 0) { - throw DOMException.create(_globalObject, ["Unexpected attributes.", "NotSupportedError"]); - } - if (domSymbolTree.hasChildren(result)) { - throw DOMException.create(_globalObject, ["Unexpected child nodes.", "NotSupportedError"]); - } - if (domSymbolTree.parent(result)) { - throw DOMException.create(_globalObject, ["Unexpected element parent.", "NotSupportedError"]); - } - if (result._ownerDocument !== document) { - throw DOMException.create(_globalObject, ["Unexpected element owner document.", "NotSupportedError"]); - } - if (result._namespaceURI !== namespace) { - throw DOMException.create(_globalObject, ["Unexpected element namespace URI.", "NotSupportedError"]); - } - if (result._localName !== localName) { - throw DOMException.create(_globalObject, ["Unexpected element local name.", "NotSupportedError"]); - } - - result._prefix = prefix; - result._isValue = isValue; - } catch (error) { - reportException(document._defaultView, error); - - const interfaceWrapper = interfaces.getInterfaceWrapper("HTMLUnknownElement"); - result = interfaceWrapper.createImpl(_globalObject, [], { - ownerDocument: document, - localName, - namespace: HTML_NS, - prefix, - ceState: "failed", - ceDefinition: null, - isValue: null - }); - } - } else { - const interfaceWrapper = interfaces.getInterfaceWrapper("HTMLElement"); - result = interfaceWrapper.createImpl(_globalObject, [], { - ownerDocument: document, - localName, - namespace: HTML_NS, - prefix, - ceState: "undefined", - ceDefinition: null, - isValue: null - }); - - enqueueCEUpgradeReaction(result, definition); - } - } else { - let elementInterface; - - switch (namespace) { - case HTML_NS: - elementInterface = getHTMLElementInterface(localName); - break; - - case SVG_NS: - elementInterface = getSVGInterface(localName); - break; - - default: - elementInterface = interfaces.getInterfaceWrapper("Element"); - break; - } - - result = elementInterface.createImpl(_globalObject, [], { - ownerDocument: document, - localName, - namespace, - prefix, - ceState: "uncustomized", - ceDefinition: null, - isValue - }); - - if (namespace === HTML_NS && (isValidCustomElementName(localName) || isValue !== null)) { - result._ceState = "undefined"; - } - } - - return result; -} - -// https://dom.spec.whatwg.org/#internal-createelementns-steps -function internalCreateElementNSSteps(document, namespace, qualifiedName, options) { - const extracted = validateAndExtract(document._globalObject, namespace, qualifiedName); - - let isValue = null; - if (options && options.is !== undefined) { - isValue = options.is; - } - - return createElement( - document, - extracted.localName, - extracted.namespace, - extracted.prefix, - isValue, - true - ); -} - -module.exports = { - createElement, - internalCreateElementNSSteps, - - getValidTagNames, - getHTMLElementInterface -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js deleted file mode 100644 index 31693f2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js +++ /dev/null @@ -1,188 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils"); -const ErrorEvent = require("../generated/ErrorEvent"); -const BeforeUnloadEvent = require("../generated/BeforeUnloadEvent"); -const EventHandlerNonNull = require("../generated/EventHandlerNonNull.js"); -const OnBeforeUnloadEventHandlerNonNull = require("../generated/OnBeforeUnloadEventHandlerNonNull.js"); -const OnErrorEventHandlerNonNull = require("../generated/OnErrorEventHandlerNonNull.js"); -const reportException = require("./runtime-script-errors"); - -exports.appendHandler = (el, eventName) => { - // tryImplForWrapper() is currently required due to use in Window.js - idlUtils.tryImplForWrapper(el).addEventListener(eventName, event => { - // https://html.spec.whatwg.org/#the-event-handler-processing-algorithm - const callback = exports.getCurrentEventHandlerValue(el, eventName); - if (callback === null) { - return; - } - - const specialError = ErrorEvent.isImpl(event) && event.type === "error" && - event.currentTarget.constructor.name === "Window"; - - let returnValue = null; - // https://heycam.github.io/webidl/#es-invoking-callback-functions - if (typeof callback === "function") { - if (specialError) { - returnValue = callback.call( - event.currentTarget, - event.message, - event.filename, - event.lineno, - event.colno, - event.error - ); - } else { - returnValue = callback.call(event.currentTarget, event); - } - } - - if (event.type === "beforeunload" && BeforeUnloadEvent.isImpl(event)) { - if (returnValue !== null) { - event._canceledFlag = true; - if (event.returnValue === "") { - event.returnValue = returnValue; - } - } - } else if (specialError) { - if (returnValue === true) { - event._canceledFlag = true; - } - } else if (returnValue === false) { - event._canceledFlag = true; - } - }); -}; - -// "Simple" in this case means "no content attributes involved" -exports.setupForSimpleEventAccessors = (prototype, events) => { - prototype._getEventHandlerFor = function (event) { - return this._eventHandlers ? this._eventHandlers[event] : undefined; - }; - - prototype._setEventHandlerFor = function (event, handler) { - if (!this._registeredHandlers) { - this._registeredHandlers = new Set(); - this._eventHandlers = Object.create(null); - } - - if (!this._registeredHandlers.has(event) && handler !== null) { - this._registeredHandlers.add(event); - exports.appendHandler(this, event); - } - this._eventHandlers[event] = handler; - }; - - for (const event of events) { - exports.createEventAccessor(prototype, event); - } -}; - -// https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler -exports.getCurrentEventHandlerValue = (target, event) => { - const value = target._getEventHandlerFor(event); - if (!value) { - return null; - } - - if (value.body !== undefined) { - let element, document, fn; - if (target.constructor.name === "Window") { - element = null; - document = idlUtils.implForWrapper(target.document); - } else { - element = target; - document = element.ownerDocument; - } - const { body } = value; - - const formOwner = element !== null && element.form ? element.form : null; - const window = target.constructor.name === "Window" && target._document ? target : document.defaultView; - - try { - // eslint-disable-next-line no-new-func - Function(body); // properly error out on syntax errors - // Note: this won't execute body; that would require `Function(body)()`. - } catch (e) { - if (window) { - reportException(window, e); - } - target._setEventHandlerFor(event, null); - return null; - } - - // Note: the with (window) { } is not necessary in Node, but is necessary in a browserified environment. - - const createFunction = document.defaultView.Function; - if (event === "error" && element === null) { - const sourceURL = document ? `\n//# sourceURL=${document.URL}` : ""; - - fn = createFunction(`\ -with (arguments[0]) { return function onerror(event, source, lineno, colno, error) { -${body} -}; }${sourceURL}`)(window); - - fn = OnErrorEventHandlerNonNull.convert(window, fn); - } else { - const calls = []; - if (element !== null) { - calls.push(idlUtils.wrapperForImpl(document)); - } - - if (formOwner !== null) { - calls.push(idlUtils.wrapperForImpl(formOwner)); - } - - if (element !== null) { - calls.push(idlUtils.wrapperForImpl(element)); - } - - let wrapperBody = `\ -with (arguments[0]) { return function on${event}(event) { -${body} -}; }`; - - // eslint-disable-next-line no-unused-vars - for (const call of calls) { - wrapperBody = `\ -with (arguments[0]) { return function () { -${wrapperBody} -}; }`; - } - - if (document) { - wrapperBody += `\n//# sourceURL=${document.URL}`; - } - - fn = createFunction(wrapperBody)(window); - for (const call of calls) { - fn = fn(call); - } - - if (event === "beforeunload") { - fn = OnBeforeUnloadEventHandlerNonNull.convert(window, fn); - } else { - fn = EventHandlerNonNull.convert(window, fn); - } - } - - target._setEventHandlerFor(event, fn); - } - - return target._getEventHandlerFor(event); -}; - -// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes -// TODO: Consider replacing this with `[ReflectEvent]` -exports.createEventAccessor = (obj, event) => { - Object.defineProperty(obj, "on" + event, { - configurable: true, - enumerable: true, - get() { - return exports.getCurrentEventHandlerValue(this, event); - }, - set(val) { - this._setEventHandlerFor(event, val); - } - }); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/custom-elements.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/custom-elements.js deleted file mode 100644 index ab31de3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/custom-elements.js +++ /dev/null @@ -1,272 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); -const isPotentialCustomElementName = require("is-potential-custom-element-name"); - -const NODE_TYPE = require("../node-type"); -const { HTML_NS } = require("./namespaces"); -const { shadowIncludingRoot } = require("./shadow-dom"); -const reportException = require("./runtime-script-errors"); - -const { implForWrapper, wrapperForImpl } = require("../generated/utils"); - -// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions-stack -class CEReactionsStack { - constructor() { - this._stack = []; - - // https://html.spec.whatwg.org/multipage/custom-elements.html#backup-element-queue - this.backupElementQueue = []; - - // https://html.spec.whatwg.org/multipage/custom-elements.html#processing-the-backup-element-queue - this.processingBackupElementQueue = false; - } - - push(elementQueue) { - this._stack.push(elementQueue); - } - - pop() { - return this._stack.pop(); - } - - get currentElementQueue() { - const { _stack } = this; - return _stack[_stack.length - 1]; - } - - isEmpty() { - return this._stack.length === 0; - } -} - -// In theory separate cross-origin Windows created by separate JSDOM instances could have separate stacks. But, we would -// need to implement the whole agent architecture. Which is kind of questionable given that we don't run our Windows in -// their own separate threads, which is what agents are meant to represent. -const customElementReactionsStack = new CEReactionsStack(); - -// https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions -function ceReactionsPreSteps() { - customElementReactionsStack.push([]); -} -function ceReactionsPostSteps() { - const queue = customElementReactionsStack.pop(); - invokeCEReactions(queue); -} - -const RESTRICTED_CUSTOM_ELEMENT_NAME = new Set([ - "annotation-xml", - "color-profile", - "font-face", - "font-face-src", - "font-face-uri", - "font-face-format", - "font-face-name", - "missing-glyph" -]); - -// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name -function isValidCustomElementName(name) { - if (RESTRICTED_CUSTOM_ELEMENT_NAME.has(name)) { - return false; - } - - return isPotentialCustomElementName(name); -} - -// https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element -function upgradeElement(definition, element) { - if (element._ceState !== "undefined" || element._ceState === "uncustomized") { - return; - } - - element._ceDefinition = definition; - element._ceState = "failed"; - - for (const attribute of element._attributeList) { - const { _localName, _namespace, _value } = attribute; - enqueueCECallbackReaction(element, "attributeChangedCallback", [_localName, null, _value, _namespace]); - } - - if (shadowIncludingRoot(element).nodeType === NODE_TYPE.DOCUMENT_NODE) { - enqueueCECallbackReaction(element, "connectedCallback", []); - } - - definition.constructionStack.push(element); - - const { constructionStack, constructor: C } = definition; - - let constructionError; - try { - if (definition.disableShadow === true && element._shadowRoot !== null) { - throw DOMException.create(element._globalObject, [ - "Can't upgrade a custom element with a shadow root if shadow is disabled", - "NotSupportedError" - ]); - } - - element._ceState = "precustomized"; - - const constructionResult = C.construct(); - const constructionResultImpl = implForWrapper(constructionResult); - - if (constructionResultImpl !== element) { - throw new TypeError("Invalid custom element constructor return value"); - } - } catch (error) { - constructionError = error; - } - - constructionStack.pop(); - - if (constructionError !== undefined) { - element._ceDefinition = null; - element._ceReactionQueue = []; - - throw constructionError; - } - - element._ceState = "custom"; -} - -// https://html.spec.whatwg.org/#concept-try-upgrade -function tryUpgradeElement(element) { - const { _ownerDocument, _namespaceURI, _localName, _isValue } = element; - const definition = lookupCEDefinition(_ownerDocument, _namespaceURI, _localName, _isValue); - - if (definition !== null) { - enqueueCEUpgradeReaction(element, definition); - } -} - -// https://html.spec.whatwg.org/#look-up-a-custom-element-definition -function lookupCEDefinition(document, namespace, localName, isValue) { - const definition = null; - - if (namespace !== HTML_NS) { - return definition; - } - - if (!document._defaultView) { - return definition; - } - - const registry = implForWrapper(document._globalObject._customElementRegistry); - - const definitionByName = registry._customElementDefinitions.find(def => { - return def.name === def.localName && def.localName === localName; - }); - if (definitionByName !== undefined) { - return definitionByName; - } - - const definitionByIs = registry._customElementDefinitions.find(def => { - return def.name === isValue && def.localName === localName; - }); - if (definitionByIs !== undefined) { - return definitionByIs; - } - - return definition; -} - -// https://html.spec.whatwg.org/multipage/custom-elements.html#invoke-custom-element-reactions -function invokeCEReactions(elementQueue) { - while (elementQueue.length > 0) { - const element = elementQueue.shift(); - - const reactions = element._ceReactionQueue; - - try { - while (reactions.length > 0) { - const reaction = reactions.shift(); - - switch (reaction.type) { - case "upgrade": - upgradeElement(reaction.definition, element); - break; - - case "callback": - reaction.callback.apply(wrapperForImpl(element), reaction.args); - break; - } - } - } catch (error) { - reportException(element._globalObject, error); - } - } -} - -// https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-an-element-on-the-appropriate-element-queue -function enqueueElementOnAppropriateElementQueue(element) { - if (customElementReactionsStack.isEmpty()) { - customElementReactionsStack.backupElementQueue.push(element); - - if (customElementReactionsStack.processingBackupElementQueue) { - return; - } - - customElementReactionsStack.processingBackupElementQueue = true; - - Promise.resolve().then(() => { - const elementQueue = customElementReactionsStack.backupElementQueue; - invokeCEReactions(elementQueue); - - customElementReactionsStack.processingBackupElementQueue = false; - }); - } else { - customElementReactionsStack.currentElementQueue.push(element); - } -} - -// https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction -function enqueueCECallbackReaction(element, callbackName, args) { - const { _ceDefinition: { lifecycleCallbacks, observedAttributes } } = element; - - const callback = lifecycleCallbacks[callbackName]; - if (callback === null) { - return; - } - - if (callbackName === "attributeChangedCallback") { - const attributeName = args[0]; - if (!observedAttributes.includes(attributeName)) { - return; - } - } - - element._ceReactionQueue.push({ - type: "callback", - callback, - args - }); - - enqueueElementOnAppropriateElementQueue(element); -} - -// https://html.spec.whatwg.org/#enqueue-a-custom-element-upgrade-reaction -function enqueueCEUpgradeReaction(element, definition) { - element._ceReactionQueue.push({ - type: "upgrade", - definition - }); - - enqueueElementOnAppropriateElementQueue(element); -} - -module.exports = { - customElementReactionsStack, - - ceReactionsPreSteps, - ceReactionsPostSteps, - - isValidCustomElementName, - - upgradeElement, - tryUpgradeElement, - - lookupCEDefinition, - enqueueCEUpgradeReaction, - enqueueCECallbackReaction, - invokeCEReactions -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/dates-and-times.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/dates-and-times.js deleted file mode 100644 index 15d920b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/dates-and-times.js +++ /dev/null @@ -1,270 +0,0 @@ -"use strict"; - -function isLeapYear(year) { - return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0); -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#number-of-days-in-month-month-of-year-year -const daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; -function numberOfDaysInMonthOfYear(month, year) { - if (month === 2 && isLeapYear(year)) { - return 29; - } - return daysInMonth[month - 1]; -} - -const monthRe = /^([0-9]{4,})-([0-9]{2})$/; - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#parse-a-month-string -function parseMonthString(str) { - const matches = monthRe.exec(str); - if (!matches) { - return null; - } - const year = Number(matches[1]); - if (year <= 0) { - return null; - } - const month = Number(matches[2]); - if (month < 1 || month > 12) { - return null; - } - return { year, month }; -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-month-string -function isValidMonthString(str) { - return parseMonthString(str) !== null; -} -function serializeMonth({ year, month }) { - const yearStr = `${year}`.padStart(4, "0"); - const monthStr = `${month}`.padStart(2, "0"); - return `${yearStr}-${monthStr}`; -} - -const dateRe = /^([0-9]{4,})-([0-9]{2})-([0-9]{2})$/; - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#parse-a-date-string -function parseDateString(str) { - const matches = dateRe.exec(str); - if (!matches) { - return null; - } - const year = Number(matches[1]); - if (year <= 0) { - return null; - } - const month = Number(matches[2]); - if (month < 1 || month > 12) { - return null; - } - const day = Number(matches[3]); - if (day < 1 || day > numberOfDaysInMonthOfYear(month, year)) { - return null; - } - return { year, month, day }; -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string -function isValidDateString(str) { - return parseDateString(str) !== null; -} -function serializeDate(date) { - const dayStr = `${date.day}`.padStart(2, "0"); - return `${serializeMonth(date)}-${dayStr}`; -} - -const yearlessDateRe = /^(?:--)?([0-9]{2})-([0-9]{2})$/; - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#parse-a-yearless-date-string -function parseYearlessDateString(str) { - const matches = yearlessDateRe.exec(str); - if (!matches) { - return null; - } - const month = Number(matches[1]); - if (month < 1 || month > 12) { - return null; - } - const day = Number(matches[2]); - if (day < 1 || day > numberOfDaysInMonthOfYear(month, 4)) { - return null; - } - return { month, day }; -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-yearless-date-string -function isValidYearlessDateString(str) { - return parseYearlessDateString(str) !== null; -} -function serializeYearlessDate({ month, day }) { - const monthStr = `${month}`.padStart(2, "0"); - const dayStr = `${day}`.padStart(2, "0"); - return `${monthStr}-${dayStr}`; -} - -const timeRe = /^([0-9]{2}):([0-9]{2})(?::([0-9]{2}(?:\.([0-9]{1,3}))?))?$/; - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#parse-a-time-string -function parseTimeString(str) { - const matches = timeRe.exec(str); - if (!matches) { - return null; - } - const hour = Number(matches[1]); - if (hour < 0 || hour > 23) { - return null; - } - const minute = Number(matches[2]); - if (minute < 0 || minute > 59) { - return null; - } - const second = matches[3] !== undefined ? Math.trunc(Number(matches[3])) : 0; - if (second < 0 || second >= 60) { - return null; - } - const millisecond = matches[4] !== undefined ? Number(matches[4]) : 0; - return { hour, minute, second, millisecond }; -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-time-string -function isValidTimeString(str) { - return parseTimeString(str) !== null; -} - -function serializeTime({ hour, minute, second, millisecond }) { - const hourStr = `${hour}`.padStart(2, "0"); - const minuteStr = `${minute}`.padStart(2, "0"); - if (second === 0 && millisecond === 0) { - return `${hourStr}:${minuteStr}`; - } - const secondStr = `${second}`.padStart(2, "0"); - const millisecondStr = `${millisecond}`.padStart(3, "0"); - return `${hourStr}:${minuteStr}:${secondStr}.${millisecondStr}`; -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#parse-a-local-date-and-time-string -function parseLocalDateAndTimeString(str, normalized = false) { - let separatorIdx = str.indexOf("T"); - if (separatorIdx < 0 && !normalized) { - separatorIdx = str.indexOf(" "); - } - if (separatorIdx < 0) { - return null; - } - const date = parseDateString(str.slice(0, separatorIdx)); - if (date === null) { - return null; - } - const time = parseTimeString(str.slice(separatorIdx + 1)); - if (time === null) { - return null; - } - return { date, time }; -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-local-date-and-time-string -function isValidLocalDateAndTimeString(str) { - return parseLocalDateAndTimeString(str) !== null; -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-normalised-local-date-and-time-string -function isValidNormalizedLocalDateAndTimeString(str) { - return parseLocalDateAndTimeString(str, true) !== null; -} -function serializeNormalizedDateAndTime({ date, time }) { - return `${serializeDate(date)}T${serializeTime(time)}`; -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#week-number-of-the-last-day -// https://stackoverflow.com/a/18538272/1937836 -function weekNumberOfLastDay(year) { - const jan1 = new Date(year, 0); - return jan1.getDay() === 4 || (isLeapYear(year) && jan1.getDay() === 3) ? 53 : 52; -} - -const weekRe = /^([0-9]{4,5})-W([0-9]{2})$/; - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#parse-a-week-string -function parseWeekString(str) { - const matches = weekRe.exec(str); - if (!matches) { - return null; - } - const year = Number(matches[1]); - if (year <= 0) { - return null; - } - const week = Number(matches[2]); - if (week < 1 || week > weekNumberOfLastDay(year)) { - return null; - } - return { year, week }; -} - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-week-string -function isValidWeekString(str) { - return parseWeekString(str) !== null; -} -function serializeWeek({ year, week }) { - const yearStr = `${year}`.padStart(4, "0"); - const weekStr = `${week}`.padStart(2, "0"); - return `${yearStr}-W${weekStr}`; -} - -// https://stackoverflow.com/a/6117889 -function parseDateAsWeek(originalDate) { - const dayInSeconds = 86400000; - // Copy date so don't modify original - const date = new Date(Date.UTC(originalDate.getUTCFullYear(), originalDate.getUTCMonth(), originalDate.getUTCDate())); - // Set to nearest Thursday: current date + 4 - current day number - // Make Sunday's day number 7 - date.setUTCDate(date.getUTCDate() + 4 - (date.getUTCDay() || 7)); - // Get first day of year - const yearStart = new Date(Date.UTC(date.getUTCFullYear(), 0, 1)); - // Calculate full weeks to nearest Thursday - const week = Math.ceil((((date - yearStart) / dayInSeconds) + 1) / 7); - - return { year: date.getUTCFullYear(), week }; -} - -function isDate(obj) { - try { - Date.prototype.valueOf.call(obj); - return true; - } catch { - return false; - } -} - -module.exports = { - isDate, - numberOfDaysInMonthOfYear, - - parseMonthString, - isValidMonthString, - serializeMonth, - - parseDateString, - isValidDateString, - serializeDate, - - parseYearlessDateString, - isValidYearlessDateString, - serializeYearlessDate, - - parseTimeString, - isValidTimeString, - serializeTime, - - parseLocalDateAndTimeString, - isValidLocalDateAndTimeString, - isValidNormalizedLocalDateAndTimeString, - serializeNormalizedDateAndTime, - - parseDateAsWeek, - weekNumberOfLastDay, - parseWeekString, - isValidWeekString, - serializeWeek -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/details.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/details.js deleted file mode 100644 index 25c5387..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/details.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -const { firstChildWithLocalName } = require("./traversal"); -const { HTML_NS } = require("./namespaces"); - -// https://html.spec.whatwg.org/multipage/interactive-elements.html#summary-for-its-parent-details -exports.isSummaryForParentDetails = summaryElement => { - const parent = summaryElement.parentNode; - if (parent === null) { - return false; - } - if (parent._localName !== "details" || parent._namespaceURI !== HTML_NS) { - return false; - } - return firstChildWithLocalName(parent, "summary") === summaryElement; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/encoding.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/encoding.js deleted file mode 100644 index 8cb3e06..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/encoding.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; -// Small wrapper around Node.js's native `TextEncoder`/`TextDecoder`to expose functions with names matching the -// Encoding Standard, so it's more obvious what to use when implementing specs. See also discussion at -// https://github.com/ExodusOSS/bytes/issues/17. -// -// Note that we could also use `@exodus/bytes` instead of Node.js's native `TextEncoder`/`TextDecoder`. This could give -// benefits on non-Node.js environments. But, on Node.js, `@exodus/bytes` just delegates to the native classes, plus -// adds some extra type checks that we don't want. Per the discussion above, it fixes some bugs, but they are not -// relevant for our use cases. - -const encoder = new TextEncoder(); -const decoder = new TextDecoder("utf-8", { ignoreBOM: false, fatal: false }); -const decoderWithoutBOM = new TextDecoder("utf-8", { ignoreBOM: true, fatal: false }); -const decoderWithoutBOMOrFail = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }); - -/** - * Implements the <https://encoding.spec.whatwg.org/#utf-8-decode> algorithm. If there are three preceding BOM bytes, - * they are discarded, and any lone surrogates become U+FFFD. - * - * @param {Uint8Array} bytes - The bytes to decode. - * @returns {string} - The decoded string. - */ -exports.utf8Decode = bytes => { - return decoder.decode(bytes); -}; - -/** - * Implements the <https://encoding.spec.whatwg.org/#utf-8-decode-without-bom> algorithm. If there are three preceding - * BOM bytes, they become U+FEFF, and any lone surrogates become U+FFFD. - * - * @param {Uint8Array} bytes - The bytes to decode. - * @returns {string} - The decoded string. - */ -exports.utf8DecodeWithoutBOM = bytes => { - return decoderWithoutBOM.decode(bytes); -}; - -/** - * Implements the <https://encoding.spec.whatwg.org/#utf-8-decode-without-bom-or-fail> algorithm. If there are three - * preceding BOM bytes, they become U+FEFF, and any lone surrogates cause an exception. - * - * @param {Uint8Array} bytes - The bytes to decode. - * @returns {string} - The decoded string. - */ -exports.utf8DecodeWithoutBOMOrFail = bytes => { - return decoderWithoutBOMOrFail.decode(bytes); -}; - -/** - * Implements the <https://encoding.spec.whatwg.org/#utf-8-decode> algorithm, but also bundles in `USVString` conversion - * (i.e. lone surrogates become 0xEF 0xBF 0xBD). - * - * @param {string} string - A string, possibly containing lone surrogates. If the string contains no lone surrogates, - * then this behaves as the spec algorithm. Otherwise, it behaves as the composition of the spec algorithm and - * `USVString` conversion. - * @returns {Uint8Array} - The UTF-8 encoded bytes of the input string. - */ -exports.utf8Encode = string => { - return encoder.encode(string); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/events.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/events.js deleted file mode 100644 index cd65a38..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/events.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -const Event = require("../generated/Event"); -const { tryImplForWrapper } = require("../generated/utils"); - -function createAnEvent(e, globalObject, eventInterface = Event, attributes = {}) { - return eventInterface.createImpl( - globalObject, - [e, attributes], - { isTrusted: attributes.isTrusted !== false } - ); -} - -function fireAnEvent(e, target, eventInterface, attributes, legacyTargetOverrideFlag) { - const event = createAnEvent(e, target._globalObject, eventInterface, attributes); - - // tryImplForWrapper() is currently required due to use in Window.js - return tryImplForWrapper(target)._dispatch(event, legacyTargetOverrideFlag); -} - -module.exports = { - createAnEvent, - fireAnEvent -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/focusing.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/focusing.js deleted file mode 100644 index 7d1a38c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/focusing.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; -const FocusEvent = require("../generated/FocusEvent.js"); -const idlUtils = require("../generated/utils.js"); -const { isDisabled } = require("./form-controls.js"); -const { firstChildWithLocalName } = require("./traversal"); -const { createAnEvent } = require("./events"); -const { HTML_NS, SVG_NS } = require("./namespaces"); -const { isRenderedElement } = require("./svg/render"); - -const focusableFormElements = new Set(["input", "select", "textarea", "button"]); - -// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area, but also some of -// https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps and some of -// https://svgwg.org/svg2-draft/interact.html#TermFocusable -exports.isFocusableAreaElement = elImpl => { - // We implemented most of the suggested focusable elements found here: - // https://html.spec.whatwg.org/multipage/interaction.html#tabindex-value - // However, some suggested elements are not focusable in web browsers, as detailed here: - // https://github.com/whatwg/html/issues/5490 - if (elImpl._namespaceURI === HTML_NS) { - if (!elImpl._ownerDocument._defaultView) { - return false; - } - - if (!elImpl.isConnected) { - return false; - } - - if (!Number.isNaN(parseInt(elImpl.getAttributeNS(null, "tabindex")))) { - return true; - } - - if (elImpl._localName === "iframe") { - return true; - } - - if (elImpl._localName === "a" && elImpl.hasAttributeNS(null, "href")) { - return true; - } - - if (elImpl._localName === "summary" && elImpl.parentNode && - elImpl.parentNode._localName === "details" && - elImpl === firstChildWithLocalName(elImpl.parentNode, "summary")) { - return true; - } - - if (focusableFormElements.has(elImpl._localName) && !isDisabled(elImpl)) { - if (elImpl._localName === "input" && elImpl.type === "hidden") { - return false; - } - - return true; - } - - if (elImpl.hasAttributeNS(null, "contenteditable")) { - return true; - } - - return false; - - // This does not check for a designMode Document as specified in - // https://html.spec.whatwg.org/multipage/interaction.html#editing-host because the designMode - // attribute is not implemented. - } - - if (elImpl._namespaceURI === SVG_NS) { - if (!Number.isNaN(parseInt(elImpl.getAttributeNS(null, "tabindex"))) && isRenderedElement(elImpl)) { - return true; - } - - if (elImpl._localName === "a" && elImpl.hasAttributeNS(null, "href")) { - return true; - } - - return false; - } - - return false; -}; - -// https://html.spec.whatwg.org/multipage/interaction.html#fire-a-focus-event plus the steps of -// https://html.spec.whatwg.org/multipage/interaction.html#focus-update-steps that adjust Documents to Windows -// It's extended with the bubbles option to also handle focusin/focusout, which are "defined" in -// https://w3c.github.io/uievents/#event-type-focusin. See https://github.com/whatwg/html/issues/3514. -exports.fireFocusEventWithTargetAdjustment = (name, target, relatedTarget, { bubbles = false } = {}) => { - if (target === null) { - // E.g. firing blur with nothing previously focused. - return; - } - - const event = createAnEvent(name, target._globalObject, FocusEvent, { - bubbles, - composed: true, - relatedTarget, - view: target._ownerDocument._defaultView, - detail: 0 - }); - - if (target._defaultView) { - target = idlUtils.implForWrapper(target._defaultView); - } - - target._dispatch(event); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/form-controls.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/form-controls.js deleted file mode 100644 index 8dee41e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/form-controls.js +++ /dev/null @@ -1,309 +0,0 @@ -"use strict"; - -const { - isValidFloatingPointNumber, - isValidSimpleColor, - parseFloatingPointNumber, - stripLeadingAndTrailingASCIIWhitespace, - stripNewlines, - splitOnCommas -} = require("./strings"); -const { - isValidDateString, - isValidMonthString, - isValidTimeString, - isValidWeekString, - parseLocalDateAndTimeString, - serializeNormalizedDateAndTime -} = require("./dates-and-times"); -const whatwgURL = require("whatwg-url"); - -const NodeList = require("../generated/NodeList"); -const { domSymbolTree } = require("./internal-constants"); -const { closest, firstChildWithLocalName } = require("./traversal"); -const NODE_TYPE = require("../node-type"); -const { HTML_NS } = require("./namespaces"); - -// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fe-disabled -exports.isDisabled = formControl => { - if (formControl.localName === "button" || formControl.localName === "input" || formControl.localName === "select" || - formControl.localName === "textarea") { - if (formControl.hasAttributeNS(null, "disabled")) { - return true; - } - } - - let e = formControl.parentNode; - while (e) { - if (e.localName === "fieldset" && e.hasAttributeNS(null, "disabled")) { - const firstLegendElementChild = firstChildWithLocalName(e, "legend"); - if (!firstLegendElementChild || !firstLegendElementChild.contains(formControl)) { - return true; - } - } - e = e.parentNode; - } - - return false; -}; - -// https://html.spec.whatwg.org/multipage/forms.html#category-listed -const listedElements = new Set(["button", "fieldset", "input", "object", "output", "select", "textarea"]); -exports.isListed = formControl => listedElements.has(formControl._localName) && formControl.namespaceURI === HTML_NS; - -// https://html.spec.whatwg.org/multipage/forms.html#category-submit -const submittableElements = new Set(["button", "input", "object", "select", "textarea"]); -exports.isSubmittable = formControl => { - return submittableElements.has(formControl._localName) && formControl.namespaceURI === HTML_NS; -}; - -// https://html.spec.whatwg.org/multipage/forms.html#concept-submit-button -const submitButtonInputTypes = new Set(["submit", "image"]); -exports.isSubmitButton = formControl => { - return ((formControl._localName === "input" && submitButtonInputTypes.has(formControl.type)) || - (formControl._localName === "button" && formControl.type === "submit")) && - formControl.namespaceURI === HTML_NS; -}; - -// https://html.spec.whatwg.org/multipage/forms.html#concept-button -const buttonInputTypes = new Set([...submitButtonInputTypes, "reset", "button"]); -exports.isButton = formControl => { - return ((formControl._localName === "input" && buttonInputTypes.has(formControl.type)) || - formControl._localName === "button") && - formControl.namespaceURI === HTML_NS; -}; - -// https://html.spec.whatwg.org/multipage/dom.html#interactive-content-2 -exports.isInteractiveContent = node => { - if (node.nodeType !== NODE_TYPE.ELEMENT_NODE) { - return false; - } - if (node.namespaceURI !== HTML_NS) { - return false; - } - if (node.hasAttributeNS(null, "tabindex")) { - return true; - } - switch (node.localName) { - case "a": - return node.hasAttributeNS(null, "href"); - - case "audio": - case "video": - return node.hasAttributeNS(null, "controls"); - - case "img": - case "object": - return node.hasAttributeNS(null, "usemap"); - - case "input": - return node.type !== "hidden"; - - case "button": - case "details": - case "embed": - case "iframe": - case "label": - case "select": - case "textarea": - return true; - } - - return false; -}; - -// https://html.spec.whatwg.org/multipage/forms.html#category-label -exports.isLabelable = node => { - if (node.nodeType !== NODE_TYPE.ELEMENT_NODE) { - return false; - } - if (node.namespaceURI !== HTML_NS) { - return false; - } - switch (node.localName) { - case "button": - case "meter": - case "output": - case "progress": - case "select": - case "textarea": - return true; - - case "input": - return node.type !== "hidden"; - } - if (node._ceDefinition?.formAssociated) { - return true; - } - - return false; -}; - -exports.getLabelsForLabelable = labelable => { - if (!exports.isLabelable(labelable)) { - return null; - } - if (!labelable._labels) { - const root = labelable.getRootNode({}); - labelable._labels = NodeList.createImpl(root._globalObject, [], { - element: root, - query: () => { - const nodes = []; - for (const descendant of domSymbolTree.treeIterator(root)) { - if (descendant.control === labelable) { - nodes.push(descendant); - } - } - return nodes; - } - }); - } - return labelable._labels; -}; - -// https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address -exports.isValidEmailAddress = (emailAddress, multiple = false) => { - const emailAddressRegExp = new RegExp("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9]" + - "(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}" + - "[a-zA-Z0-9])?)*$"); - // A valid e-mail address list is a set of comma-separated tokens, where each token is itself - // a valid e - mail address.To obtain the list of tokens from a valid e - mail address list, - // an implementation must split the string on commas. - if (multiple) { - return splitOnCommas(emailAddress).every(value => emailAddressRegExp.test(value)); - } - return emailAddressRegExp.test(emailAddress); -}; - -exports.isValidAbsoluteURL = url => { - return whatwgURL.parseURL(url) !== null; -}; - -exports.sanitizeValueByType = (input, val) => { - switch (input.type.toLowerCase()) { - case "password": - case "search": - case "tel": - case "text": - val = stripNewlines(val); - break; - - case "color": - // https://html.spec.whatwg.org/multipage/forms.html#color-state-(type=color):value-sanitization-algorithm - val = isValidSimpleColor(val) ? val.toLowerCase() : "#000000"; - break; - - case "date": - // https://html.spec.whatwg.org/multipage/input.html#date-state-(type=date):value-sanitization-algorithm - if (!isValidDateString(val)) { - val = ""; - } - break; - - case "datetime-local": { - // https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type=datetime-local):value-sanitization-algorithm - const dateAndTime = parseLocalDateAndTimeString(val); - val = dateAndTime !== null ? serializeNormalizedDateAndTime(dateAndTime) : ""; - break; - } - - case "email": - // https://html.spec.whatwg.org/multipage/forms.html#e-mail-state-(type=email):value-sanitization-algorithm - // https://html.spec.whatwg.org/multipage/forms.html#e-mail-state-(type=email):value-sanitization-algorithm-2 - if (input.hasAttributeNS(null, "multiple")) { - val = val.split(",").map(token => stripLeadingAndTrailingASCIIWhitespace(token)).join(","); - } else { - val = stripNewlines(val); - val = stripLeadingAndTrailingASCIIWhitespace(val); - } - break; - - case "month": - // https://html.spec.whatwg.org/multipage/input.html#month-state-(type=month):value-sanitization-algorithm - if (!isValidMonthString(val)) { - val = ""; - } - break; - - case "number": - // https://html.spec.whatwg.org/multipage/input.html#number-state-(type=number):value-sanitization-algorithm - // TODO: using parseFloatingPointNumber in addition to isValidFloatingPointNumber to pass number.html WPT. - // Possible spec bug. - if (!isValidFloatingPointNumber(val) || parseFloatingPointNumber(val) === null) { - val = ""; - } - break; - - case "range": - // https://html.spec.whatwg.org/multipage/input.html#range-state-(type=range):value-sanitization-algorithm - // TODO: using parseFloatingPointNumber in addition to isValidFloatingPointNumber to pass number.html WPT. - // Possible spec bug. - if (!isValidFloatingPointNumber(val) || parseFloatingPointNumber(val) === null) { - const minimum = input._minimum; - const maximum = input._maximum; - const defaultValue = maximum < minimum ? minimum : (minimum + maximum) / 2; - val = `${defaultValue}`; - } else if (val < input._minimum) { - val = `${input._minimum}`; - } else if (val > input._maximum) { - val = `${input._maximum}`; - } - break; - - case "time": - // https://html.spec.whatwg.org/multipage/input.html#time-state-(type=time):value-sanitization-algorithm - if (!isValidTimeString(val)) { - val = ""; - } - break; - - case "url": - // https://html.spec.whatwg.org/multipage/forms.html#url-state-(type=url):value-sanitization-algorithm - val = stripNewlines(val); - val = stripLeadingAndTrailingASCIIWhitespace(val); - break; - - case "week": - // https://html.spec.whatwg.org/multipage/input.html#week-state-(type=week):value-sanitization-algorithm - if (!isValidWeekString(val)) { - val = ""; - } - } - - return val; -}; - -// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-owner -// TODO: The spec describes an imperative process for assigning/resetting an element's form -// owner based on activities involving form-associated elements. This simpler implementation -// instead calculates the current form owner only when the property is accessed. This is not -// sufficient to pass all the web platform tests, but is good enough for most purposes. We -// should eventually update it to use the correct version, though. See -// https://github.com/whatwg/html/issues/4050 for some discussion. - -exports.formOwner = formControl => { - const formAttr = formControl.getAttributeNS(null, "form"); - if (formAttr === "") { - return null; - } - if (formAttr === null) { - return closest(formControl, "form"); - } - - const root = formControl.getRootNode({}); - let firstElementWithId; - for (const descendant of domSymbolTree.treeIterator(root)) { - if (descendant.nodeType === NODE_TYPE.ELEMENT_NODE && - descendant.getAttributeNS(null, "id") === formAttr) { - firstElementWithId = descendant; - break; - } - } - - if (firstElementWithId && - firstElementWithId.namespaceURI === HTML_NS && - firstElementWithId.localName === "form") { - return firstElementWithId; - } - return null; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/html-constructor.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/html-constructor.js deleted file mode 100644 index 5543aa7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/html-constructor.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; - -const { HTML_NS } = require("./namespaces"); -const { createElement, getValidTagNames } = require("./create-element"); - -const { implForWrapper, wrapperForImpl } = require("../generated/utils"); - -// https://html.spec.whatwg.org/multipage/custom-elements.html#concept-already-constructed-marker -const ALREADY_CONSTRUCTED_MARKER = Symbol("already-constructed-marker"); - -// https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor -function HTMLConstructor(globalObject, constructorName, newTarget) { - const registry = implForWrapper(globalObject._customElementRegistry); - if (newTarget === HTMLConstructor) { - throw new TypeError("Invalid constructor"); - } - - const definition = registry._customElementDefinitions.find(entry => entry.objectReference === newTarget); - if (definition === undefined) { - throw new TypeError("Invalid constructor, the constructor is not part of the custom element registry"); - } - - let isValue = null; - - if (definition.localName === definition.name) { - if (constructorName !== "HTMLElement") { - throw new TypeError("Invalid constructor, autonomous custom element should extend from HTMLElement"); - } - } else { - const validLocalNames = getValidTagNames(HTML_NS, constructorName); - if (!validLocalNames.includes(definition.localName)) { - throw new TypeError(`${definition.localName} is not valid local name for ${constructorName}`); - } - - isValue = definition.name; - } - - let { prototype } = newTarget; - - if (prototype === null || typeof prototype !== "object") { - // The following line deviates from the specification. The HTMLElement prototype should be retrieved from the realm - // associated with the "new.target". Because it is impossible to get such information in jsdom, we fallback to the - // HTMLElement prototype associated with the current object. - prototype = globalObject.HTMLElement.prototype; - } - - if (definition.constructionStack.length === 0) { - const documentImpl = implForWrapper(globalObject.document); - - const elementImpl = createElement(documentImpl, definition.localName, HTML_NS); - - const element = wrapperForImpl(elementImpl); - Object.setPrototypeOf(element, prototype); - - elementImpl._ceState = "custom"; - elementImpl._ceDefinition = definition; - elementImpl._isValue = isValue; - - return element; - } - - const elementImpl = definition.constructionStack[definition.constructionStack.length - 1]; - const element = wrapperForImpl(elementImpl); - - if (elementImpl === ALREADY_CONSTRUCTED_MARKER) { - throw new TypeError("This instance is already constructed"); - } - - Object.setPrototypeOf(element, prototype); - - definition.constructionStack[definition.constructionStack.length - 1] = ALREADY_CONSTRUCTED_MARKER; - - return element; -} - -module.exports = { - HTMLConstructor -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/internal-constants.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/internal-constants.js deleted file mode 100644 index 707add9..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/internal-constants.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -const SymbolTree = require("symbol-tree"); - -exports.cloningSteps = Symbol("cloning steps"); - -// TODO: the many underscore-prefixed hooks should move here -// E.g. _attrModified (which maybe should be split into its per-spec variants) - -/** - * This SymbolTree is used to build the tree for all Node in a document - */ -exports.domSymbolTree = new SymbolTree("DOM SymbolTree"); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/is-window.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/is-window.js deleted file mode 100644 index a05deb7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/is-window.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -const idlUtils = require("../generated/utils"); - -// Until webidl2js gains support for checking for Window, this would have to do. -module.exports = val => { - if (typeof val !== "object") { - return false; - } - const wrapper = idlUtils.wrapperForImpl(val); - if (typeof wrapper === "object") { - return wrapper === wrapper._globalProxy; - } - - // `val` may be either impl or wrapper currently, because webidl2js currently unwraps Window objects (and their global - // proxies) to their underlying EventTargetImpl during conversion, which is not what we want. But at the same time, - // some internal usage call this constructor with the actual global proxy. - return module.exports(idlUtils.implForWrapper(val)); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/iterable-weak-set.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/iterable-weak-set.js deleted file mode 100644 index 9d5e167..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/iterable-weak-set.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -// An iterable WeakSet implementation inspired by the iterable WeakMap example code in the WeakRefs specification: -// https://github.com/tc39/proposal-weakrefs#iterable-weakmaps -module.exports = class IterableWeakSet { - constructor() { - this._refSet = new Set(); - this._refMap = new WeakMap(); - this._finalizationRegistry = new FinalizationRegistry(({ ref, set }) => set.delete(ref)); - } - - add(value) { - if (!this._refMap.has(value)) { - const ref = new WeakRef(value); - this._refMap.set(value, ref); - this._refSet.add(ref); - this._finalizationRegistry.register(value, { ref, set: this._refSet }, ref); - } - - return this; - } - - delete(value) { - const ref = this._refMap.get(value); - if (!ref) { - return false; - } - - this._refMap.delete(value); - this._refSet.delete(ref); - this._finalizationRegistry.unregister(ref); - return true; - } - - has(value) { - return this._refMap.has(value); - } - - * [Symbol.iterator]() { - for (const ref of this._refSet) { - const value = ref.deref(); - if (value === undefined) { - continue; - } - yield value; - } - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/json.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/json.js deleted file mode 100644 index bee4f80..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/json.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -const { utf8Decode } = require("./encoding"); - -// https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value -exports.parseJSONFromBytes = bytes => { - return JSON.parse(utf8Decode(bytes)); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/mutation-observers.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/mutation-observers.js deleted file mode 100644 index c1c9209..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/mutation-observers.js +++ /dev/null @@ -1,198 +0,0 @@ -"use strict"; - -const { domSymbolTree } = require("./internal-constants"); -const reportException = require("./runtime-script-errors"); - -const Event = require("../generated/Event"); -const idlUtils = require("../generated/utils"); -const MutationRecord = require("../generated/MutationRecord"); - -const MUTATION_TYPE = { - ATTRIBUTES: "attributes", - CHARACTER_DATA: "characterData", - CHILD_LIST: "childList" -}; - -// Note: -// Since jsdom doesn't currently implement the concept of "unit of related similar-origin browsing contexts" -// (https://html.spec.whatwg.org/multipage/browsers.html#unit-of-related-similar-origin-browsing-contexts) -// we will approximate that the following properties are global for now. - -// https://dom.spec.whatwg.org/#mutation-observer-compound-microtask-queued-flag -let mutationObserverMicrotaskQueueFlag = false; - -// Non-spec compliant: List of all the mutation observers with mutation records enqueued. It's a replacement for -// mutation observer list (https://dom.spec.whatwg.org/#mutation-observer-list) but without leaking since it's empty -// before notifying the mutation observers. -const activeMutationObservers = new Set(); - -// https://dom.spec.whatwg.org/#signal-slot-list -const signalSlotList = []; - -// https://dom.spec.whatwg.org/#queue-a-mutation-record -function queueMutationRecord( - type, - target, - name, - namespace, - oldValue, - addedNodes, - removedNodes, - previousSibling, - nextSibling -) { - const interestedObservers = new Map(); - - const nodes = domSymbolTree.ancestorsToArray(target); - - for (const node of nodes) { - for (const registered of node._registeredObserverList) { - const { options, observer: mo } = registered; - - if ( - !(node !== target && options.subtree === false) && - !(type === MUTATION_TYPE.ATTRIBUTES && options.attributes !== true) && - !(type === MUTATION_TYPE.ATTRIBUTES && options.attributeFilter && - !options.attributeFilter.some(value => value === name || value === namespace)) && - !(type === MUTATION_TYPE.CHARACTER_DATA && options.characterData !== true) && - !(type === MUTATION_TYPE.CHILD_LIST && options.childList === false) - ) { - if (!interestedObservers.has(mo)) { - interestedObservers.set(mo, null); - } - - if ( - (type === MUTATION_TYPE.ATTRIBUTES && options.attributeOldValue === true) || - (type === MUTATION_TYPE.CHARACTER_DATA && options.characterDataOldValue === true) - ) { - interestedObservers.set(mo, oldValue); - } - } - } - } - - for (const [observer, mappedOldValue] of interestedObservers.entries()) { - const record = MutationRecord.createImpl(target._globalObject, [], { - type, - target, - attributeName: name, - attributeNamespace: namespace, - oldValue: mappedOldValue, - addedNodes, - removedNodes, - previousSibling, - nextSibling - }); - - observer._recordQueue.push(record); - activeMutationObservers.add(observer); - } - - queueMutationObserverMicrotask(); -} - -// https://dom.spec.whatwg.org/#queue-a-tree-mutation-record -function queueTreeMutationRecord(target, addedNodes, removedNodes, previousSibling, nextSibling) { - queueMutationRecord( - MUTATION_TYPE.CHILD_LIST, - target, - null, - null, - null, - addedNodes, - removedNodes, - previousSibling, - nextSibling - ); -} - -// https://dom.spec.whatwg.org/#queue-an-attribute-mutation-record -function queueAttributeMutationRecord(target, name, namespace, oldValue) { - queueMutationRecord( - MUTATION_TYPE.ATTRIBUTES, - target, - name, - namespace, - oldValue, - [], - [], - null, - null - ); -} - -// https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask -function queueMutationObserverMicrotask() { - if (mutationObserverMicrotaskQueueFlag) { - return; - } - - mutationObserverMicrotaskQueueFlag = true; - - Promise.resolve().then(() => { - notifyMutationObservers(); - }); -} - -// https://dom.spec.whatwg.org/#notify-mutation-observers -function notifyMutationObservers() { - mutationObserverMicrotaskQueueFlag = false; - - const notifyList = [...activeMutationObservers].sort((a, b) => a._id - b._id); - activeMutationObservers.clear(); - - const signalList = [...signalSlotList]; - signalSlotList.splice(0, signalSlotList.length); - - for (const mo of notifyList) { - const records = [...mo._recordQueue]; - mo._recordQueue = []; - - for (const node of mo._nodeList) { - node._registeredObserverList = node._registeredObserverList.filter(registeredObserver => { - return registeredObserver.source !== mo; - }); - } - - if (records.length > 0) { - try { - const moWrapper = idlUtils.wrapperForImpl(mo); - mo._callback.call( - moWrapper, - records.map(idlUtils.wrapperForImpl), - moWrapper - ); - } catch (e) { - const { target } = records[0]; - const window = target._ownerDocument._defaultView; - - reportException(window, e); - } - } - } - - for (const slot of signalList) { - const slotChangeEvent = Event.createImpl( - slot._globalObject, - [ - "slotchange", - { bubbles: true } - ], - { isTrusted: true } - ); - - slot._dispatch(slotChangeEvent); - } -} - -module.exports = { - MUTATION_TYPE, - - queueMutationRecord, - queueTreeMutationRecord, - queueAttributeMutationRecord, - - queueMutationObserverMicrotask, - - signalSlotList -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/namespaces.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/namespaces.js deleted file mode 100644 index bf0611f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/namespaces.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -// Do not require generated files from here, as this file is shared with the Web IDL converter. - -// https://infra.spec.whatwg.org/#namespaces - -exports.HTML_NS = "http://www.w3.org/1999/xhtml"; - -exports.MATHML_NS = "http://www.w3.org/1998/Math/MathML"; - -exports.SVG_NS = "http://www.w3.org/2000/svg"; - -exports.XLINK_NS = "http://www.w3.org/1999/xlink"; - -exports.XML_NS = "http://www.w3.org/XML/1998/namespace"; - -exports.XMLNS_NS = "http://www.w3.org/2000/xmlns/"; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/node.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/node.js deleted file mode 100644 index 40e12bc..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/node.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; - -const NODE_TYPE = require("../node-type"); -const { domSymbolTree } = require("./internal-constants"); - -// https://dom.spec.whatwg.org/#concept-node-length -function nodeLength(node) { - switch (node.nodeType) { - case NODE_TYPE.DOCUMENT_TYPE_NODE: - return 0; - - case NODE_TYPE.TEXT_NODE: - case NODE_TYPE.PROCESSING_INSTRUCTION_NODE: - case NODE_TYPE.COMMENT_NODE: - return node.data.length; - - default: - return domSymbolTree.childrenCount(node); - } -} - -// https://dom.spec.whatwg.org/#concept-tree-root -function nodeRoot(node) { - while (domSymbolTree.parent(node)) { - node = domSymbolTree.parent(node); - } - - return node; -} - -// https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor -function isInclusiveAncestor(ancestorNode, node) { - while (node) { - if (ancestorNode === node) { - return true; - } - - node = domSymbolTree.parent(node); - } - - return false; -} - -// https://dom.spec.whatwg.org/#concept-tree-following -function isFollowing(nodeA, nodeB) { - if (nodeA === nodeB) { - return false; - } - - let current = nodeB; - while (current) { - if (current === nodeA) { - return true; - } - - current = domSymbolTree.following(current); - } - - return false; -} - -module.exports = { - nodeLength, - nodeRoot, - - isInclusiveAncestor, - isFollowing -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/number-and-date-inputs.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/number-and-date-inputs.js deleted file mode 100644 index e29bc74..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/number-and-date-inputs.js +++ /dev/null @@ -1,195 +0,0 @@ -"use strict"; -const { parseFloatingPointNumber } = require("./strings"); -const { - parseDateString, - parseLocalDateAndTimeString, - parseMonthString, - parseTimeString, - parseWeekString, - - serializeDate, - serializeMonth, - serializeNormalizedDateAndTime, - serializeTime, - serializeWeek, - parseDateAsWeek -} = require("./dates-and-times"); - -// Necessary because Date.UTC() treats year within [0, 99] as [1900, 1999]. -function getUTCMs(year, month = 1, day = 1, hour = 0, minute = 0, second = 0, millisecond = 0) { - if (year > 99 || year < 0) { - return Date.UTC(year, month - 1, day, hour, minute, second, millisecond); - } - const d = new Date(0); - d.setUTCFullYear(year); - d.setUTCMonth(month - 1); - d.setUTCDate(day); - d.setUTCHours(hour); - d.setUTCMinutes(minute); - d.setUTCSeconds(second, millisecond); - return d.valueOf(); -} - -const dayOfWeekRelMondayLUT = [-1, 0, 1, 2, 3, -3, -2]; - -exports.convertStringToNumberByType = { - // https://html.spec.whatwg.org/multipage/input.html#date-state-(type=date):concept-input-value-string-number - date(input) { - const date = parseDateString(input); - if (date === null) { - return null; - } - return getUTCMs(date.year, date.month, date.day); - }, - // https://html.spec.whatwg.org/multipage/input.html#month-state-(type=month):concept-input-value-string-number - month(input) { - const date = parseMonthString(input); - if (date === null) { - return null; - } - return (date.year - 1970) * 12 + (date.month - 1); - }, - // https://html.spec.whatwg.org/multipage/input.html#week-state-(type=week):concept-input-value-string-number - week(input) { - const date = parseWeekString(input); - if (date === null) { - return null; - } - const dateObj = new Date(getUTCMs(date.year)); - // An HTML week starts on Monday, while 0 represents Sunday. Account for such. - const dayOfWeekRelMonday = dayOfWeekRelMondayLUT[dateObj.getUTCDay()]; - return dateObj.setUTCDate(1 + 7 * (date.week - 1) - dayOfWeekRelMonday); - }, - // https://html.spec.whatwg.org/multipage/input.html#time-state-(type=time):concept-input-value-string-number - time(input) { - const time = parseTimeString(input); - if (time === null) { - return null; - } - return ((time.hour * 60 + time.minute) * 60 + time.second) * 1000 + time.millisecond; - }, - // https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type=datetime-local):concept-input-value-string-number - "datetime-local"(input) { - const dateAndTime = parseLocalDateAndTimeString(input); - if (dateAndTime === null) { - return null; - } - const { date: { year, month, day }, time: { hour, minute, second, millisecond } } = dateAndTime; - // Doesn't quite matter whether or not UTC is used, since the offset from 1970-01-01 local time is returned. - return getUTCMs(year, month, day, hour, minute, second, millisecond); - }, - // https://html.spec.whatwg.org/multipage/input.html#number-state-(type=number):concept-input-value-string-number - number: parseFloatingPointNumber, - // https://html.spec.whatwg.org/multipage/input.html#range-state-(type=range):concept-input-value-string-number - range: parseFloatingPointNumber -}; - -exports.convertStringToDateByType = { - date(input) { - const parsedInput = exports.convertStringToNumberByType.date(input); - return parsedInput === null ? null : new Date(parsedInput); - }, - // https://html.spec.whatwg.org/multipage/input.html#month-state-(type=month):concept-input-value-string-number - month(input) { - const parsedMonthString = parseMonthString(input); - if (parsedMonthString === null) { - return null; - } - - const date = new Date(0); - date.setUTCFullYear(parsedMonthString.year); - date.setUTCMonth(parsedMonthString.month - 1); - return date; - }, - week(input) { - const parsedInput = exports.convertStringToNumberByType.week(input); - return parsedInput === null ? null : new Date(parsedInput); - }, - time(input) { - const parsedInput = exports.convertStringToNumberByType.time(input); - return parsedInput === null ? null : new Date(parsedInput); - }, - "datetime-local"(input) { - const parsedInput = exports.convertStringToNumberByType["datetime-local"](input); - return parsedInput === null ? null : new Date(parsedInput); - } -}; - -exports.serializeDateByType = { - date(input) { - return serializeDate({ - year: input.getUTCFullYear(), - month: input.getUTCMonth() + 1, - day: input.getUTCDate() - }); - }, - month(input) { - return serializeMonth({ - year: input.getUTCFullYear(), - month: input.getUTCMonth() + 1 - }); - }, - week(input) { - return serializeWeek(parseDateAsWeek(input)); - }, - time(input) { - return serializeTime({ - hour: input.getUTCHours(), - minute: input.getUTCMinutes(), - second: input.getUTCSeconds(), - millisecond: input.getUTCMilliseconds() - }); - }, - "datetime-local"(input) { - return serializeNormalizedDateAndTime({ - date: { - year: input.getUTCFullYear(), - month: input.getUTCMonth() + 1, - day: input.getUTCDate() - }, - time: { - hour: input.getUTCHours(), - minute: input.getUTCMinutes(), - second: input.getUTCSeconds(), - millisecond: input.getUTCMilliseconds() - } - }); - } -}; - -exports.convertNumberToStringByType = { - // https://html.spec.whatwg.org/multipage/input.html#date-state-(type=date):concept-input-value-string-number - date(input) { - return exports.serializeDateByType.date(new Date(input)); - }, - // https://html.spec.whatwg.org/multipage/input.html#month-state-(type=month):concept-input-value-string-date - month(input) { - const year = 1970 + Math.floor(input / 12); - const month = input % 12; - const date = new Date(0); - date.setUTCFullYear(year); - date.setUTCMonth(month); - - return exports.serializeDateByType.month(date); - }, - // https://html.spec.whatwg.org/multipage/input.html#week-state-(type=week):concept-input-value-string-date - week(input) { - return exports.serializeDateByType.week(new Date(input)); - }, - // https://html.spec.whatwg.org/multipage/input.html#time-state-(type=time):concept-input-value-string-date - time(input) { - return exports.serializeDateByType.time(new Date(input)); - }, - // https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type=datetime-local):concept-input-value-number-string - "datetime-local"(input) { - return exports.serializeDateByType["datetime-local"](new Date(input)); - }, - // https://html.spec.whatwg.org/multipage/input.html#number-state-(type=number):concept-input-value-number-string - number(input) { - return input.toString(); - }, - // https://html.spec.whatwg.org/multipage/input.html#range-state-(type=range):concept-input-value-number-string - range(input) { - return input.toString(); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/ordered-set.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/ordered-set.js deleted file mode 100644 index d3e1932..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/ordered-set.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; - -// https://infra.spec.whatwg.org/#sets -// -// Only use this class if a Set cannot be used, e.g. when "replace" operation is needed, since there's no way to replace -// an element while keep the relative order using a Set, only remove and then add something at the end. - -module.exports = class OrderedSet { - constructor() { - this._items = []; - } - - append(item) { - if (!this.contains(item)) { - this._items.push(item); - } - } - - prepend(item) { - if (!this.contains(item)) { - this._items.unshift(item); - } - } - - replace(item, replacement) { - let seen = false; - for (let i = 0; i < this._items.length;) { - const isInstance = this._items[i] === item || this._items[i] === replacement; - if (seen && isInstance) { - this._items.splice(i, 1); - } else { - if (isInstance) { - this._items[i] = replacement; - seen = true; - } - i++; - } - } - } - - remove(...items) { - this.removePredicate(item => items.includes(item)); - } - - removePredicate(predicate) { - for (let i = 0; i < this._items.length;) { - if (predicate(this._items[i])) { - this._items.splice(i, 1); - } else { - i++; - } - } - } - - empty() { - this._items.length = 0; - } - - contains(item) { - return this._items.includes(item); - } - - get size() { - return this._items.length; - } - - isEmpty() { - return this._items.length === 0; - } - - // Useful for other parts of jsdom - - [Symbol.iterator]() { - return this._items[Symbol.iterator](); - } - - keys() { - return this._items.keys(); - } - - get(index) { - return this._items[index]; - } - - some(func) { - return this._items.some(func); - } - - // https://dom.spec.whatwg.org/#concept-ordered-set-parser - static parse(input) { - const tokens = new OrderedSet(); - for (const token of input.split(/[\t\n\f\r ]+/)) { - if (token) { - tokens.append(token); - } - } - return tokens; - } - - // https://dom.spec.whatwg.org/#concept-ordered-set-serializer - serialize() { - return this._items.join(" "); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/page-transition-event.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/page-transition-event.js deleted file mode 100644 index 50c8be1..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/page-transition-event.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -const PageTransitionEvent = require("../generated/PageTransitionEvent.js"); -const { fireAnEvent } = require("./events"); - -// https://html.spec.whatwg.org/multipage/browsing-the-web.html#fire-a-page-transition-event -exports.fireAPageTransitionEvent = (eventName, window, persisted) => { - const attributes = { persisted, cancelable: true, bubbles: true }; - fireAnEvent(eventName, window, PageTransitionEvent, attributes, true); -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js deleted file mode 100644 index 98f5f98..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -const util = require("util"); -const idlUtils = require("../generated/utils"); -const ErrorEvent = require("../generated/ErrorEvent"); -const { createAnEvent } = require("../helpers/events"); - -const errorReportingMode = Symbol("error reporting mode"); - -// https://html.spec.whatwg.org/multipage/webappapis.html#report-the-error -// Omits script parameter and any check for muted errors. -// Takes target as an EventTarget impl. -// Takes error object, message, and location as params, unlike the spec. -// Returns whether the event was handled or not. -function reportAnError(line, col, target, errorObject, message, location) { - if (target[errorReportingMode]) { - return false; - } - - target[errorReportingMode] = true; - - if (typeof message !== "string") { - message = "uncaught exception: " + util.inspect(errorObject); - } - - const event = createAnEvent("error", target._globalObject, ErrorEvent, { - cancelable: true, - message, - filename: location, - lineno: line, - colno: col, - error: errorObject - }); - - try { - target._dispatch(event); - } finally { - target[errorReportingMode] = false; - return event.defaultPrevented; - } -} - -module.exports = function reportException(window, error, filenameHint) { - // This function will give good results on real Error objects with stacks; poor ones otherwise - - const stack = error && error.stack; - const lines = stack && stack.split("\n"); - - // Find the first line that matches; important for multi-line messages - let pieces; - if (lines) { - for (let i = 1; i < lines.length && !pieces; ++i) { - pieces = lines[i].match(/at (?:(.+)\s+)?\(?(?:(.+?):(\d+):(\d+)|([^)]+))\)?/); - } - } - - const fileName = (pieces && pieces[2]) || filenameHint || window._document.URL; - const lineNumber = (pieces && parseInt(pieces[3])) || 0; - const columnNumber = (pieces && parseInt(pieces[4])) || 0; - - const windowImpl = idlUtils.implForWrapper(window); - - const handled = reportAnError(lineNumber, columnNumber, windowImpl, error, error && error.message, fileName); - - if (!handled) { - const errorString = shouldBeDisplayedAsError(error) ? `[${error.name}: ${error.message}]` : util.inspect(error); - const jsdomError = new Error(`Uncaught ${errorString}`, { cause: error }); - jsdomError.type = "unhandled-exception"; - - window._virtualConsole.emit("jsdomError", jsdomError); - } -}; - -function shouldBeDisplayedAsError(x) { - return x && x.name && x.message !== undefined && x.stack; -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/shadow-dom.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/shadow-dom.js deleted file mode 100644 index a88a33e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/shadow-dom.js +++ /dev/null @@ -1,285 +0,0 @@ -"use strict"; - -const NODE_TYPE = require("../node-type"); - -const { nodeRoot } = require("./node"); -const { HTML_NS } = require("./namespaces"); -const { domSymbolTree } = require("./internal-constants"); -const { signalSlotList, queueMutationObserverMicrotask } = require("./mutation-observers"); - -// Valid host element for ShadowRoot. -// Defined in: https://dom.spec.whatwg.org/#dom-element-attachshadow -const VALID_HOST_ELEMENT_NAME = new Set([ - "article", - "aside", - "blockquote", - "body", - "div", - "footer", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "header", - "main", - "nav", - "p", - "section", - "span" -]); - -function isValidHostElementName(name) { - return VALID_HOST_ELEMENT_NAME.has(name); -} - -// Use an approximation by checking the presence of nodeType instead of instead of using the isImpl from -// "../generated/Node" to avoid introduction of circular dependencies. -function isNode(nodeImpl) { - return Boolean(nodeImpl && "nodeType" in nodeImpl); -} - -// Use an approximation by checking the value of nodeType and presence of nodeType host instead of instead -// of using the isImpl from "../generated/ShadowRoot" to avoid introduction of circular dependencies. -function isShadowRoot(nodeImpl) { - return Boolean(nodeImpl && nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE && "host" in nodeImpl); -} - -// https://dom.spec.whatwg.org/#concept-slotable -function isSlotable(nodeImpl) { - return nodeImpl && (nodeImpl.nodeType === NODE_TYPE.ELEMENT_NODE || nodeImpl.nodeType === NODE_TYPE.TEXT_NODE); -} - -function isSlot(nodeImpl) { - return nodeImpl && nodeImpl.localName === "slot" && nodeImpl._namespaceURI === HTML_NS; -} - -// https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor -function isShadowInclusiveAncestor(ancestor, node) { - while (isNode(node)) { - if (node === ancestor) { - return true; - } - - if (isShadowRoot(node)) { - node = node.host; - } else { - node = domSymbolTree.parent(node); - } - } - - return false; -} - -// https://dom.spec.whatwg.org/#retarget -function retarget(a, b) { - while (true) { - if (!isNode(a)) { - return a; - } - - const aRoot = nodeRoot(a); - if ( - !isShadowRoot(aRoot) || - (isNode(b) && isShadowInclusiveAncestor(aRoot, b)) - ) { - return a; - } - - a = nodeRoot(a).host; - } -} - -// https://dom.spec.whatwg.org/#get-the-parent -function getEventTargetParent(eventTarget, event) { - // _getTheParent will be missing for Window, since it doesn't have an impl class and we don't want to pollute the - // user-visible global scope with a _getTheParent value. TODO: remove this entire function and use _getTheParent - // directly, once Window gets split into impl/wrapper. - return eventTarget._getTheParent ? eventTarget._getTheParent(event) : null; -} - -// https://dom.spec.whatwg.org/#concept-shadow-including-root -function shadowIncludingRoot(node) { - const root = nodeRoot(node); - return isShadowRoot(root) ? shadowIncludingRoot(root.host) : root; -} - -// https://dom.spec.whatwg.org/#assign-a-slot -function assignSlot(slotable) { - const slot = findSlot(slotable); - - if (slot) { - assignSlotable(slot); - } -} - -// https://dom.spec.whatwg.org/#assign-slotables -function assignSlotable(slot) { - const slotables = findSlotable(slot); - - let shouldFireSlotChange = false; - - if (slotables.length !== slot._assignedNodes.length) { - shouldFireSlotChange = true; - } else { - for (let i = 0; i < slotables.length; i++) { - if (slotables[i] !== slot._assignedNodes[i]) { - shouldFireSlotChange = true; - break; - } - } - } - - if (shouldFireSlotChange) { - signalSlotChange(slot); - } - - slot._assignedNodes = slotables; - - for (const slotable of slotables) { - slotable._assignedSlot = slot; - } -} - -// https://dom.spec.whatwg.org/#assign-slotables-for-a-tree -function assignSlotableForTree(root) { - for (const slot of domSymbolTree.treeIterator(root)) { - if (isSlot(slot)) { - assignSlotable(slot); - } - } -} - -// https://dom.spec.whatwg.org/#find-slotables -function findSlotable(slot) { - const result = []; - - const root = nodeRoot(slot); - if (!isShadowRoot(root)) { - return result; - } - - for (const slotable of domSymbolTree.treeIterator(root.host)) { - const foundSlot = findSlot(slotable); - - if (foundSlot === slot) { - result.push(slotable); - } - } - - return result; -} - -// https://dom.spec.whatwg.org/#find-flattened-slotables -function findFlattenedSlotables(slot) { - const result = []; - - const root = nodeRoot(slot); - if (!isShadowRoot(root)) { - return result; - } - - const slotables = findSlotable(slot); - - if (slotables.length === 0) { - for (const child of domSymbolTree.childrenIterator(slot)) { - if (isSlotable(child)) { - slotables.push(child); - } - } - } - - for (const node of slotables) { - if (isSlot(node) && isShadowRoot(nodeRoot(node))) { - const temporaryResult = findFlattenedSlotables(node); - result.push(...temporaryResult); - } else { - result.push(node); - } - } - - return result; -} - -// https://dom.spec.whatwg.org/#find-a-slot -function findSlot(slotable, openFlag) { - const { parentNode: parent } = slotable; - - if (!parent) { - return null; - } - - const shadow = parent._shadowRoot; - - if (!shadow || (openFlag && shadow.mode !== "open")) { - return null; - } - - for (const child of domSymbolTree.treeIterator(shadow)) { - if (isSlot(child) && child.name === slotable._slotableName) { - return child; - } - } - - return null; -} - -// https://dom.spec.whatwg.org/#signal-a-slot-change -function signalSlotChange(slot) { - if (!signalSlotList.some(entry => entry === slot)) { - signalSlotList.push(slot); - } - - queueMutationObserverMicrotask(); -} - -// https://dom.spec.whatwg.org/#concept-shadow-including-descendant -function* shadowIncludingInclusiveDescendantsIterator(node) { - yield node; - - if (node._shadowRoot) { - yield* shadowIncludingInclusiveDescendantsIterator(node._shadowRoot); - } - - for (const child of domSymbolTree.childrenIterator(node)) { - yield* shadowIncludingInclusiveDescendantsIterator(child); - } -} - -// https://dom.spec.whatwg.org/#concept-shadow-including-descendant -function* shadowIncludingDescendantsIterator(node) { - if (node._shadowRoot) { - yield* shadowIncludingInclusiveDescendantsIterator(node._shadowRoot); - } - - for (const child of domSymbolTree.childrenIterator(node)) { - yield* shadowIncludingInclusiveDescendantsIterator(child); - } -} - -module.exports = { - isValidHostElementName, - - isNode, - isSlotable, - isSlot, - isShadowRoot, - - isShadowInclusiveAncestor, - retarget, - getEventTargetParent, - shadowIncludingRoot, - - assignSlot, - assignSlotable, - assignSlotableForTree, - - findSlot, - findFlattenedSlotables, - - signalSlotChange, - - shadowIncludingInclusiveDescendantsIterator, - shadowIncludingDescendantsIterator -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/strings.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/strings.js deleted file mode 100644 index a93992a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/strings.js +++ /dev/null @@ -1,168 +0,0 @@ -"use strict"; - -// https://infra.spec.whatwg.org/#ascii-whitespace -const asciiWhitespaceRe = /^[\t\n\f\r ]$/; -exports.asciiWhitespaceRe = asciiWhitespaceRe; - -// https://infra.spec.whatwg.org/#ascii-lowercase -exports.asciiLowercase = s => { - if (!/[^\x00-\x7f]/.test(s)) { - return s.toLowerCase(); - } - const len = s.length; - const out = new Array(len); - for (let i = 0; i < len; i++) { - const code = s.charCodeAt(i); - // If the character is between 'A' (65) and 'Z' (90), convert using bitwise OR with 32 - out[i] = code >= 65 && code <= 90 ? String.fromCharCode(code | 32) : s[i]; - } - return out.join(""); -}; - -// https://infra.spec.whatwg.org/#ascii-uppercase -exports.asciiUppercase = s => { - if (!/[^\x00-\x7f]/.test(s)) { - return s.toUpperCase(); - } - const len = s.length; - const out = new Array(len); - for (let i = 0; i < len; i++) { - const code = s.charCodeAt(i); - // If the character is between 'a' (97) and 'z' (122), convert using bitwise AND with ~32 - out[i] = code >= 97 && code <= 122 ? String.fromCharCode(code & ~32) : s[i]; - } - return out.join(""); -}; - -// https://infra.spec.whatwg.org/#strip-newlines -exports.stripNewlines = s => { - return s.replace(/[\n\r]+/g, ""); -}; - -// https://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace -exports.stripLeadingAndTrailingASCIIWhitespace = s => { - return s.replace(/^[ \t\n\f\r]+/, "").replace(/[ \t\n\f\r]+$/, ""); -}; - -// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace -exports.stripAndCollapseASCIIWhitespace = s => { - return s.replace(/[ \t\n\f\r]+/g, " ").replace(/^[ \t\n\f\r]+/, "").replace(/[ \t\n\f\r]+$/, ""); -}; - -// https://html.spec.whatwg.org/multipage/infrastructure.html#valid-simple-colour -exports.isValidSimpleColor = s => { - return /^#[a-fA-F\d]{6}$/.test(s); -}; - -// https://infra.spec.whatwg.org/#ascii-case-insensitive -exports.asciiCaseInsensitiveMatch = (a, b) => { - if (a.length !== b.length) { - return false; - } - - for (let i = 0; i < a.length; ++i) { - if ((a.charCodeAt(i) | 32) !== (b.charCodeAt(i) | 32)) { - return false; - } - } - - return true; -}; - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-integers -// Error is represented as null. -const parseInteger = exports.parseInteger = input => { - // The implementation here is slightly different from the spec's. We want to use parseInt(), but parseInt() trims - // Unicode whitespace in addition to just ASCII ones, so we make sure that the trimmed prefix contains only ASCII - // whitespace ourselves. - const numWhitespace = input.length - input.trimStart().length; - if (/[^\t\n\f\r ]/.test(input.slice(0, numWhitespace))) { - return null; - } - // We don't allow hexadecimal numbers here. - // eslint-disable-next-line radix - const value = parseInt(input, 10); - if (Number.isNaN(value)) { - return null; - } - // parseInt() returns -0 for "-0". Normalize that here. - return value === 0 ? 0 : value; -}; - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-non-negative-integers -// Error is represented as null. -exports.parseNonNegativeInteger = input => { - const value = parseInteger(input); - if (value === null) { - return null; - } - if (value < 0) { - return null; - } - return value; -}; - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-floating-point-number -const floatingPointNumRe = /^-?(?:\d+|\d*\.\d+)(?:[eE][-+]?\d+)?$/; -exports.isValidFloatingPointNumber = str => floatingPointNumRe.test(str); - -// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-floating-point-number-values -// Error is represented as null. -exports.parseFloatingPointNumber = str => { - // The implementation here is slightly different from the spec's. We need to use parseFloat() in order to retain - // accuracy, but parseFloat() trims Unicode whitespace in addition to just ASCII ones, so we make sure that the - // trimmed prefix contains only ASCII whitespace ourselves. - const numWhitespace = str.length - str.trimStart().length; - if (/[^\t\n\f\r ]/.test(str.slice(0, numWhitespace))) { - return null; - } - const parsed = parseFloat(str); - return isFinite(parsed) ? parsed : null; -}; - -// https://infra.spec.whatwg.org/#split-on-ascii-whitespace -exports.splitOnASCIIWhitespace = str => { - let position = 0; - const tokens = []; - while (position < str.length && asciiWhitespaceRe.test(str[position])) { - position++; - } - if (position === str.length) { - return tokens; - } - while (position < str.length) { - const start = position; - while (position < str.length && !asciiWhitespaceRe.test(str[position])) { - position++; - } - tokens.push(str.slice(start, position)); - while (position < str.length && asciiWhitespaceRe.test(str[position])) { - position++; - } - } - return tokens; -}; - -// https://infra.spec.whatwg.org/#split-on-commas -exports.splitOnCommas = str => { - let position = 0; - const tokens = []; - while (position < str.length) { - let start = position; - while (position < str.length && str[position] !== ",") { - position++; - } - let end = position; - while (start < str.length && asciiWhitespaceRe.test(str[start])) { - start++; - } - while (end > start && asciiWhitespaceRe.test(str[end - 1])) { - end--; - } - tokens.push(str.slice(start, end)); - if (position < str.length) { - position++; - } - } - return tokens; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/style-rules.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/style-rules.js deleted file mode 100644 index 5e97a7f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/style-rules.js +++ /dev/null @@ -1,328 +0,0 @@ -"use strict"; -const cssom = require("@acemir/cssom"); -const path = require("path"); -const fs = require("fs"); -const { CSSStyleDeclaration } = require("cssstyle"); -const { getSpecifiedColor, getComputedOrUsedColor } = require("./colors"); -const { asciiLowercase } = require("./strings"); -const { deprecatedAliases, systemColors } = require("./system-colors"); - -const defaultStyleSheet = fs.readFileSync( - path.resolve(__dirname, "../../browser/default-stylesheet.css"), - { encoding: "utf-8" } -); - -const { forEach, indexOf } = Array.prototype; - -let parsedDefaultStyleSheet; - -// Properties for which getResolvedValue is implemented. This is less than -// every supported property. -// https://drafts.csswg.org/indexes/#properties -exports.propertiesWithResolvedValueImplemented = { - "__proto__": null, - - // https://drafts.csswg.org/css2/visufx.html#visibility - "visibility": { - inherited: true, - initial: "visible", - computedValue: "as-specified" - }, - // https://svgwg.org/svg2-draft/interact.html#PointerEventsProperty - "pointer-events": { - inherited: true, - initial: "auto", - computedValue: "as-specified" - }, - // https://drafts.csswg.org/css-backgrounds-3/#propdef-background-color - "background-color": { - inherited: false, - initial: "transparent", - computedValue: "computed-color" - }, - // https://drafts.csswg.org/css-logical-1/#propdef-border-block-end-color - "border-block-start-color": { - inherited: false, - initial: "currentcolor", - computedValue: "computed-color" - }, - "border-block-end-color": { - inherited: false, - initial: "currentcolor", - computedValue: "computed-color" - }, - "border-inline-start-color": { - inherited: false, - initial: "currentcolor", - computedValue: "computed-color" - }, - "border-inline-end-color": { - inherited: false, - initial: "currentcolor", - computedValue: "computed-color" - }, - // https://drafts.csswg.org/css-backgrounds-3/#propdef-border-bottom-color - "border-top-color": { - inherited: false, - initial: "currentcolor", - computedValue: "computed-color" - }, - "border-right-color": { - inherited: false, - initial: "currentcolor", - computedValue: "computed-color" - }, - "border-bottom-color": { - inherited: false, - initial: "currentcolor", - computedValue: "computed-color" - }, - "border-left-color": { - inherited: false, - initial: "currentcolor", - computedValue: "computed-color" - }, - // https://drafts.csswg.org/css-ui-4/#propdef-caret-color - "caret-color": { - inherited: true, - initial: "auto", - computedValue: "computed-color" - }, - // https://drafts.csswg.org/css-color-4/#propdef-color - "color": { - inherited: true, - initial: "canvastext", - computedValue: "computed-color" - }, - // https://drafts.csswg.org/css-ui-4/#propdef-outline-color - "outline-color": { - inherited: false, - initial: "invert", - computedValue: "computed-color" - }, - // https://drafts.csswg.org/css-display/#the-display-properties - // Currently only "as-specified" is supported as a computed value - "display": { - inherited: false, - initial: "inline", - computedValue: "as-specified" - } -}; - -function forEachMatchingSheetRuleOfElement(elementImpl, handleRule) { - function handleSheet(sheet) { - forEach.call(sheet.cssRules, rule => { - if (rule.media) { - if (rule.constructor.name === "CSSImportRule") { - // Handle @import rules if: - // - imported sheet loaded successfully - // - media is empty or matches "screen" - if (rule.styleSheet !== null && (rule.media.length === 0 || indexOf.call(rule.media, "screen") !== -1)) { - forEach.call(rule.styleSheet.cssRules, innerRule => { - if (matches(innerRule, elementImpl)) { - handleRule(innerRule); - } - }); - } - // Keep handling @media rules only if media matches "screen" - } else if (indexOf.call(rule.media, "screen") !== -1) { - forEach.call(rule.cssRules, innerRule => { - if (matches(innerRule, elementImpl)) { - handleRule(innerRule); - } - }); - } - } else if (matches(rule, elementImpl)) { - handleRule(rule); - } - }); - } - - if (!parsedDefaultStyleSheet) { - parsedDefaultStyleSheet = cssom.parse(defaultStyleSheet); - } - - handleSheet(parsedDefaultStyleSheet); - forEach.call(elementImpl._ownerDocument.styleSheets._list, handleSheet); -} - -exports.invalidateStyleCache = elementImpl => { - if (elementImpl._attached) { - elementImpl._ownerDocument._styleCache = null; - } -}; - -exports.getDeclarationForElement = elementImpl => { - let styleCache = elementImpl._ownerDocument._styleCache; - if (!styleCache) { - styleCache = elementImpl._ownerDocument._styleCache = new WeakMap(); - } - - const cachedDeclaration = styleCache.get(elementImpl); - if (cachedDeclaration) { - return cachedDeclaration; - } - - const declaration = new CSSStyleDeclaration(); - - function handleProperty(style, property) { - const value = style.getPropertyValue(property); - // https://drafts.csswg.org/css-cascade-4/#valdef-all-unset - if (value === "unset") { - declaration.removeProperty(property); - } else { - declaration.setProperty( - property, - value, - style.getPropertyPriority(property) - ); - } - } - - forEachMatchingSheetRuleOfElement(elementImpl, rule => { - forEach.call(rule.style, property => { - handleProperty(rule.style, property); - }); - }); - - forEach.call(elementImpl.style, property => { - handleProperty(elementImpl.style, property); - }); - - styleCache.set(elementImpl, declaration); - - return declaration; -}; - -function matches(rule, elementImpl) { - try { - if (rule.selectorText) { - const domSelector = elementImpl._ownerDocument._domSelector; - const { match, pseudoElement } = domSelector.check(rule.selectorText, elementImpl); - // `pseudoElement` is a pseudo-element selector (e.g. `::before`). - // However, we do not support getComputedStyle(element, pseudoElement), so return `false`. - if (pseudoElement) { - return false; - } - return match; - } - } catch { - // fall through - } - return false; -} - -// Naive implementation of https://drafts.csswg.org/css-cascade-4/#cascading -// based on the previous jsdom implementation of getComputedStyle. -// Does not implement https://drafts.csswg.org/css-cascade-4/#cascade-specificity, -// or rather specificity is only implemented by the order in which the matching -// rules appear. The last rule is the most specific while the first rule is -// the least specific. -function getCascadedPropertyValue(element, property) { - return exports.getDeclarationForElement(element).getPropertyValue(property); -} - -// https://drafts.csswg.org/css-cascade-4/#specified-value -function getSpecifiedValue(element, property) { - const { initial, inherited, computedValue } = exports.propertiesWithResolvedValueImplemented[property]; - const cascade = getCascadedPropertyValue(element, property); - - if (cascade !== "") { - if (computedValue === "computed-color") { - return getSpecifiedColor(cascade); - } - - return cascade; - } - - // Defaulting - if (inherited && element.parentElement !== null) { - return getComputedValue(element.parentElement, property); - } - - // root element without parent element or inherited property - return initial; -} - -// https://drafts.csswg.org/css-cascade-4/#computed-value -function getComputedValue(element, property) { - const { computedValue, inherited, initial } = exports.propertiesWithResolvedValueImplemented[property]; - let specifiedValue = getSpecifiedValue(element, property); - // https://drafts.csswg.org/css-cascade/#defaulting-keywords - switch (specifiedValue) { - case "initial": { - specifiedValue = initial; - break; - } - case "inherit": { - if (element.parentElement !== null) { - specifiedValue = getComputedValue(element.parentElement, property); - } else { - specifiedValue = initial; - } - break; - } - case "unset": { - if (inherited && element.parentElement !== null) { - specifiedValue = getComputedValue(element.parentElement, property); - } else { - specifiedValue = initial; - } - break; - } - // TODO: https://drafts.csswg.org/css-cascade-5/#revert-layer - case "revert-layer": { - break; - } - // TODO: https://drafts.csswg.org/css-cascade-5/#default - case "revert": { - break; - } - default: { - // fall through; specifiedValue is not a CSS-wide keyword. - } - } - if (computedValue === "as-specified") { - return specifiedValue; - } else if (computedValue === "computed-color") { - let value = asciiLowercase(specifiedValue); - // https://drafts.csswg.org/css-color-4/#resolving-other-colors - if (specifiedValue === "currentcolor") { - if (property === "color") { - if (element.parentElement !== null) { - return getComputedValue(element.parentElement, "color"); - } - value = initial; - } else { - return getComputedValue(element, "color"); - } - } - if (systemColors.has(value) || deprecatedAliases.has(value)) { - let key = value; - if (deprecatedAliases.has(value)) { - key = deprecatedAliases.get(value); - } - const { light, dark } = systemColors.get(key); - const colorScheme = getCascadedPropertyValue(element, "color-scheme"); - if (colorScheme === "dark") { - return dark; - } - return light; - } - return getComputedOrUsedColor(specifiedValue); - } - - throw new TypeError(`Internal error: unrecognized computed value instruction '${computedValue}'`); -} - -// https://drafts.csswg.org/cssom/#resolved-value -// Only implements the properties that are defined in propertiesWithResolvedValueImplemented. -exports.getResolvedValue = (element, property) => { - // We can always use the computed value with the current set of propertiesWithResolvedValueImplemented: - // * Color properties end up with the used value, but we don't implement any actual differences between used and - // computed that https://drafts.csswg.org/css-cascade-5/#used-value gestures at. - // * The other properties fall back to the "any other property: The resolved value is the computed value." case. - return getComputedValue(element, property); -}; - -exports.SHADOW_DOM_PSEUDO_REGEXP = /^::(?:part|slotted)\(/i; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/stylesheets.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/stylesheets.js deleted file mode 100644 index bdad32b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/stylesheets.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; -const cssom = require("@acemir/cssom"); -const { legacyHookDecode } = require("@exodus/bytes/encoding.js"); -const whatwgURL = require("whatwg-url"); -const { invalidateStyleCache } = require("./style-rules"); - -// TODO: this should really implement https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet -// It (and the things it calls) is nowhere close right now. -exports.fetchStylesheet = (elementImpl, urlString, importRule) => { - const document = elementImpl._ownerDocument; - let defaultEncodingLabel = document._encoding; - const resourceLoader = document._resourceLoader; - - if (elementImpl.localName === "link" && elementImpl.hasAttributeNS(null, "charset")) { - defaultEncodingLabel = elementImpl.getAttributeNS(null, "charset"); - } - - function onStylesheetLoad(data, response) { - if (!response.ok) { - throw new Error("Status code: " + response.status); - } - - // if the element was detached before the load could finish, don't process the data - if (!elementImpl._attached) { - return; - } - - const css = legacyHookDecode(data, defaultEncodingLabel); - - // TODO: MIME type checking? - if (!importRule && elementImpl.sheet) { - exports.removeStylesheet(elementImpl.sheet, elementImpl); - } - - if (importRule) { - // According to the spec, we don't add the stylesheet to the document's - // stylesheet list when it's loaded via an @import rule. - exports.createStylesheet(css, elementImpl, urlString, { - ownerRule: importRule, - styleSheet: importRule.styleSheet - }); - } else { - const createdSheet = exports.createStylesheet(css, elementImpl, urlString, { - ownerNode: elementImpl - }); - exports.addStylesheet(createdSheet, elementImpl); - } - } - - resourceLoader.fetch(urlString, { - element: elementImpl, - onLoad: onStylesheetLoad - }); -}; - -// https://drafts.csswg.org/cssom/#remove-a-css-style-sheet -exports.removeStylesheet = (sheet, elementImpl) => { - const { styleSheets } = elementImpl._ownerDocument; - styleSheets._remove(sheet); - - // Remove the association explicitly; in the spec it's implicit so this step doesn't exist. - elementImpl.sheet = null; - - invalidateStyleCache(elementImpl); - - // TODO: "Set the CSS style sheet’s parent CSS style sheet, owner node and owner CSS rule to null." - // Probably when we have a real CSSOM implementation. -}; - -// https://drafts.csswg.org/cssom/#create-a-css-style-sheet kinda: -// - Parsing failures are now handled gracefully -// - Like the browser's behaviour, when css.parse() passes trough some invalid CSS -// it will try it's best to ignore the invalid parts without blocking the parsing operations -// returning a stylesheet with the valid parts only. -// - css.parse() now receives a funcion that we can use to handle the error as it's second argument -// - The import rules stuff seems out of place, and probably should affect the load event... -exports.createStylesheet = (sheetText, elementImpl, baseURLString, parserOptions) => { - const sheet = cssom.parse(sheetText, { - globalObject: elementImpl._globalObject, - ...parserOptions - }, err => { - if (elementImpl._ownerDocument._defaultView) { - const error = new Error("Could not parse CSS stylesheet", { cause: err }); - error.sheetText = sheetText; - error.type = "css-parsing"; - - elementImpl._ownerDocument._defaultView._virtualConsole.emit("jsdomError", error); - } - }); - - scanForImportRules(elementImpl, sheet.cssRules, baseURLString); - - return sheet; -}; - -// https://drafts.csswg.org/cssom/#add-a-css-style-sheet -exports.addStylesheet = (sheet, elementImpl) => { - elementImpl._ownerDocument.styleSheets._add(sheet); - - // Set the association explicitly; in the spec it's implicit. - elementImpl.sheet = sheet; - - invalidateStyleCache(elementImpl); - - // TODO: title and disabled stuff -}; - -// Tracking in https://github.com/jsdom/jsdom/issues/2124 -function scanForImportRules(elementImpl, cssRules, baseURLString) { - if (!cssRules) { - return; - } - - for (let i = 0; i < cssRules.length; ++i) { - if (cssRules[i].cssRules) { - // @media rule: keep searching inside it. - scanForImportRules(elementImpl, cssRules[i].cssRules, baseURLString); - } else if (cssRules[i].href) { - // @import rule: fetch the resource and evaluate it. - // See http://dev.w3.org/csswg/cssom/#css-import-rule - // If loading of the style sheet fails its cssRules list is simply - // empty. I.e. an @import rule always has an associated style sheet. - - // Use whatwgURL.URL instead of whatwgURL.parseURL so that we get an error we can use as the cause if the URL - // doesn't parse. - let parsed; - try { - parsed = new whatwgURL.URL(cssRules[i].href, baseURLString); - } catch (cause) { - const window = elementImpl._ownerDocument._defaultView; - if (window) { - // Synthetic cause to ensure that all resource loading errors have causes. - const error = new Error( - `Could not parse CSS @import URL "${cssRules[i].href}" relative to base URL "${baseURLString}"`, - { cause } - ); - error.type = "resource-loading"; - error.url = cssRules[i].href; - window._virtualConsole.emit("jsdomError", error); - } - } - - if (parsed) { - exports.fetchStylesheet(elementImpl, parsed.href, cssRules[i]); - } - } - } -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/svg/basic-types.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/svg/basic-types.js deleted file mode 100644 index 16d0dc1..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/svg/basic-types.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -// https://svgwg.org/svg2-draft/types.html#TermDetach -function detach(value) { - if (typeof value === "string") { - return; - } - - throw new TypeError(`jsdom internal error: detaching object of wrong type ${value}`); -} -exports.detach = detach; - -// https://svgwg.org/svg2-draft/types.html#TermAttach -// listObject corresponds to the parameter taken by the algorithm in the spec, but is currently unused because only -// DOMString type is supported by jsdom (and this function) right now. -// eslint-disable-next-line no-unused-vars -function attach(value, listObject) { - if (typeof value === "string") { - return; - } - - throw new TypeError(`jsdom internal error: attaching object of wrong type ${value}`); -} -exports.attach = attach; - -// https://svgwg.org/svg2-draft/types.html#TermReserialize for DOMString. -function reserializeSpaceSeparatedTokens(elements) { - return elements.join(" "); -} -exports.reserializeSpaceSeparatedTokens = reserializeSpaceSeparatedTokens; - -// Used for systemLanguage attribute, whose value is a set of comma-separated tokens: -// https://svgwg.org/svg2-draft/struct.html#SystemLanguageAttribute -// SVG 2 spec (https://svgwg.org/svg2-draft/types.html#TermReserialize) says any SVGStringList should reserialize the -// same way, as space-separated tokens, but doing so for systemLanguage is illogical and contradicts the Firefox -// behavior. -// I cannot find a description of reserialization of SVGStringList in the SVG 1.1 spec. -function reserializeCommaSeparatedTokens(elements) { - return elements.join(", "); -} -exports.reserializeCommaSeparatedTokens = reserializeCommaSeparatedTokens; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js deleted file mode 100644 index 651568d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -const { SVG_NS } = require("../namespaces"); - -// https://svgwg.org/svg2-draft/render.html#TermNeverRenderedElement -const neverRenderedElements = new Set([ - "clipPath", - "defs", - "desc", - "linearGradient", - "marker", - "mask", - "metadata", - "pattern", - "radialGradient", - "script", - "style", - "title", - "symbol" -]); - -// https://svgwg.org/svg2-draft/render.html#Rendered-vs-NonRendered -exports.isRenderedElement = elImpl => { - if (neverRenderedElements.has(elImpl._localName)) { - return false; - } - - // This does not check for elements excluded because of conditional processing attributes or ‘switch’ structures, - // because conditional processing is not implemented. - // https://svgwg.org/svg2-draft/struct.html#ConditionalProcessing - - // This does not check for computed style of display being none, since that is not yet implemented for HTML - // focusability either (and there are no tests yet). - - if (!elImpl.isConnected) { - return false; - } - - // The spec is unclear about how to deal with non-SVG parents, so we only perform this check for SVG-namespace - // parents. - if (elImpl.parentElement && elImpl.parentElement._namespaceURI === SVG_NS && - !exports.isRenderedElement(elImpl.parentNode)) { - return false; - } - - return true; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/system-colors.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/system-colors.js deleted file mode 100644 index 6791c8e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/system-colors.js +++ /dev/null @@ -1,147 +0,0 @@ -"use strict"; - -// https://drafts.csswg.org/css-color-4/#css-system-colors -module.exports.systemColors = new Map([ - [ - "accentcolor", { - light: "rgb(0, 153, 255)", - dark: "rgb(0, 51, 255)" - } - ], - [ - "accentcolortext", { - light: "rgb(0, 0, 0)", - dark: "rgb(255, 255, 255)" - } - ], - [ - "activetext", { - light: "rgb(255, 0, 0)", - dark: "rgb(255, 102, 102)" - } - ], - [ - "buttonborder", { - light: "rgb(51, 51, 51)", - dark: "rgb(204, 204, 204)" - } - ], - [ - "buttonface", { - light: "rgb(204, 204, 204)", - dark: "rgb(51, 51, 51)" - } - ], - [ - "buttontext", { - light: "rgb(0, 0, 0)", - dark: "rgb(255, 255, 155)" - } - ], - [ - "canvas", { - light: "rgb(255, 255, 255)", - dark: "rgb(0, 0, 0)" - } - ], - [ - "canvastext", { - light: "rgb(0, 0, 0)", - dark: "rgb(255, 255, 255)" - } - ], - [ - "field", { - light: "rgb(255, 255, 255)", - dark: "rgb(0, 0, 0)" - } - ], - [ - "fieldtext", { - light: "rgb(0, 0, 0)", - dark: "rgb(255, 255, 255)" - } - ], - [ - "graytext", { - light: "rgb(102, 102, 102)", - dark: "rgb(153, 153, 153)" - } - ], - [ - "highlight", { - light: "rgb(0, 153, 255)", - dark: "rgb(0, 51, 255)" - } - ], - [ - "highlighttext", { - light: "rgb(255, 255, 255)", - dark: "rgb(0, 0, 0)" - } - ], - [ - "linktext", { - light: "rgb(0, 0, 255)", - dark: "rgb(0, 204, 255)" - } - ], - [ - "mark", { - light: "rgb(255, 255, 0)", - dark: "rgb(204, 0, 153)" - } - ], - [ - "marktext", { - light: "rgb(0, 0, 0)", - dark: "rgb(255, 255, 255)" - } - ], - [ - "selecteditem", { - light: "rgb(0, 153, 255)", - dark: "rgb(0, 51, 255)" - } - ], - [ - "selecteditemtext", { - light: "rgb(255, 255, 255)", - dark: "rgb(0, 0, 0)" - } - ], - [ - "visitedtext", { - light: "rgb(128, 0, 128)", - dark: "rgb(255, 51, 255)" - } - ] -]); - -// Deprecated system colors -// https://drafts.csswg.org/css-color-4/#deprecated-system-colors -module.exports.deprecatedAliases = new Map([ - ["activeborder", "buttonborder"], - ["activecaption", "canvas"], - ["appworkspace", "canvas"], - ["background", "canvas"], - ["buttonhighlight", "buttonface"], - ["buttonshadow", "buttonface"], - ["captiontext", "canvastext"], - ["inactiveborder", "buttonborder"], - ["inactivecaption", "canvas"], - ["inactivecaptiontext", "graytext"], - ["infobackground", "canvas"], - ["infotext", "canvastext"], - ["menu", "canvas"], - ["menutext", "canvastext"], - ["scrollbar", "canvas"], - ["threeddarkshadow", "buttonborder"], - ["threedface", "buttonface"], - ["threedhighlight", "buttonborder"], - ["threedlightshadow", "buttonborder"], - ["threedshadow", "buttonborder"], - ["window", "canvas"], - ["windowframe", "buttonborder"], - ["windowtext", "canvastext"] -]); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/text.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/text.js deleted file mode 100644 index 632c0e5..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/text.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -const { domSymbolTree } = require("./internal-constants"); -const { CDATA_SECTION_NODE, TEXT_NODE } = require("../node-type"); - -// -// https://dom.spec.whatwg.org/#concept-child-text-content -// -exports.childTextContent = node => { - let result = ""; - const iterator = domSymbolTree.childrenIterator(node); - for (const child of iterator) { - if (child.nodeType === TEXT_NODE || - // The CDataSection extends Text. - child.nodeType === CDATA_SECTION_NODE) { - result += child.data; - } - } - return result; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/traversal.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/traversal.js deleted file mode 100644 index 91f7148..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/traversal.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -const { domSymbolTree } = require("./internal-constants"); -const { HTML_NS } = require("./namespaces"); - -// All these operate on and return impls, not wrappers! - -exports.closest = (e, localName, namespace = HTML_NS) => { - while (e) { - if (e.localName === localName && e.namespaceURI === namespace) { - return e; - } - e = domSymbolTree.parent(e); - } - - return null; -}; - -exports.childrenByLocalName = (parent, localName, namespace = HTML_NS) => { - return domSymbolTree.childrenToArray(parent, { filter(node) { - return node._localName === localName && node._namespaceURI === namespace; - } }); -}; - -exports.descendantsByLocalName = (parent, localName, namespace = HTML_NS) => { - return domSymbolTree.treeToArray(parent, { filter(node) { - return node._localName === localName && node._namespaceURI === namespace && node !== parent; - } }); -}; - -exports.childrenByLocalNames = (parent, localNamesSet, namespace = HTML_NS) => { - return domSymbolTree.childrenToArray(parent, { filter(node) { - return localNamesSet.has(node._localName) && node._namespaceURI === namespace; - } }); -}; - -exports.descendantsByLocalNames = (parent, localNamesSet, namespace = HTML_NS) => { - return domSymbolTree.treeToArray(parent, { filter(node) { - return localNamesSet.has(node._localName) && - node._namespaceURI === namespace && - node !== parent; - } }); -}; - -exports.firstChildWithLocalName = (parent, localName, namespace = HTML_NS) => { - const iterator = domSymbolTree.childrenIterator(parent); - for (const child of iterator) { - if (child._localName === localName && child._namespaceURI === namespace) { - return child; - } - } - return null; -}; - -exports.firstChildWithLocalNames = (parent, localNamesSet, namespace = HTML_NS) => { - const iterator = domSymbolTree.childrenIterator(parent); - for (const child of iterator) { - if (localNamesSet.has(child._localName) && child._namespaceURI === namespace) { - return child; - } - } - return null; -}; - -exports.firstDescendantWithLocalName = (parent, localName, namespace = HTML_NS) => { - const iterator = domSymbolTree.treeIterator(parent); - for (const descendant of iterator) { - if (descendant._localName === localName && descendant._namespaceURI === namespace) { - return descendant; - } - } - return null; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/validate-names.js b/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/validate-names.js deleted file mode 100644 index 878cadd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/helpers/validate-names.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -const xnv = require("xml-name-validator"); -const DOMException = require("../generated/DOMException"); -const { XML_NS, XMLNS_NS } = require("../helpers/namespaces"); - -// https://dom.spec.whatwg.org/#validate - -exports.name = (globalObject, name) => { - if (!xnv.name(name)) { - throw DOMException.create(globalObject, [`"${name}" did not match the Name production`, "InvalidCharacterError"]); - } -}; - -exports.qname = (globalObject, qname) => { - if (!xnv.qname(qname)) { - throw DOMException.create(globalObject, [`"${qname}" did not match the QName production`, "InvalidCharacterError"]); - } -}; - -exports.validateAndExtract = (globalObject, namespace, qualifiedName) => { - if (namespace === "") { - namespace = null; - } - - exports.qname(globalObject, qualifiedName); - - let prefix = null; - let localName = qualifiedName; - - const colonIndex = qualifiedName.indexOf(":"); - if (colonIndex !== -1) { - prefix = qualifiedName.substring(0, colonIndex); - localName = qualifiedName.substring(colonIndex + 1); - } - - if (prefix !== null && namespace === null) { - throw DOMException.create(globalObject, [ - "A namespace was given but a prefix was also extracted from the qualifiedName", - "NamespaceError" - ]); - } - - if (prefix === "xml" && namespace !== XML_NS) { - throw DOMException.create(globalObject, [ - "A prefix of \"xml\" was given but the namespace was not the XML namespace", - "NamespaceError" - ]); - } - - if ((qualifiedName === "xmlns" || prefix === "xmlns") && namespace !== XMLNS_NS) { - throw DOMException.create(globalObject, [ - "A prefix or qualifiedName of \"xmlns\" was given but the namespace was not the XMLNS namespace", - "NamespaceError" - ]); - } - - if (namespace === XMLNS_NS && qualifiedName !== "xmlns" && prefix !== "xmlns") { - throw DOMException.create(globalObject, [ - "The XMLNS namespace was given but neither the prefix nor qualifiedName was \"xmlns\"", - "NamespaceError" - ]); - } - - return { namespace, prefix, localName }; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/hr-time/Performance-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/hr-time/Performance-impl.js deleted file mode 100644 index 023931c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/hr-time/Performance-impl.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -const EventTargetImpl = require("../events/EventTarget-impl").implementation; - -class PerformanceImpl extends EventTargetImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this.timeOrigin = privateData.timeOrigin; - this._nowAtTimeOrigin = privateData.nowAtTimeOrigin; - } - - now() { - return performance.now() - this._nowAtTimeOrigin; - } - - toJSON() { - return { timeOrigin: this.timeOrigin }; - } -} - -exports.implementation = PerformanceImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/interfaces.js b/vanilla/node_modules/jsdom/lib/jsdom/living/interfaces.js deleted file mode 100644 index a502ae0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/interfaces.js +++ /dev/null @@ -1,252 +0,0 @@ -"use strict"; - -const style = require("../level2/style"); -const xpath = require("../level3/xpath"); - -// This object defines the mapping between the interface name and the generated interface wrapper code. -// Note: The mapping needs to stay as-is in order due to interface evaluation. -// We cannot "refactor" this to something less duplicative because that would break bundlers which depend on static -// analysis of require()s. -const generatedInterfaces = { - DOMException: require("./generated/DOMException.js"), - - URL: require("whatwg-url/webidl2js-wrapper").URL, - URLSearchParams: require("whatwg-url/webidl2js-wrapper").URLSearchParams, - - EventTarget: require("./generated/EventTarget"), - - NamedNodeMap: require("./generated/NamedNodeMap"), - Node: require("./generated/Node"), - Attr: require("./generated/Attr"), - Element: require("./generated/Element"), - DocumentFragment: require("./generated/DocumentFragment"), - DOMImplementation: require("./generated/DOMImplementation"), - Document: require("./generated/Document"), - XMLDocument: require("./generated/XMLDocument"), - CharacterData: require("./generated/CharacterData"), - Text: require("./generated/Text"), - CDATASection: require("./generated/CDATASection"), - ProcessingInstruction: require("./generated/ProcessingInstruction"), - Comment: require("./generated/Comment"), - DocumentType: require("./generated/DocumentType"), - NodeList: require("./generated/NodeList"), - RadioNodeList: require("./generated/RadioNodeList"), - HTMLCollection: require("./generated/HTMLCollection"), - HTMLOptionsCollection: require("./generated/HTMLOptionsCollection"), - DOMStringMap: require("./generated/DOMStringMap"), - DOMTokenList: require("./generated/DOMTokenList"), - - StyleSheetList: require("./generated/StyleSheetList.js"), - - HTMLElement: require("./generated/HTMLElement.js"), - HTMLHeadElement: require("./generated/HTMLHeadElement.js"), - HTMLTitleElement: require("./generated/HTMLTitleElement.js"), - HTMLBaseElement: require("./generated/HTMLBaseElement.js"), - HTMLLinkElement: require("./generated/HTMLLinkElement.js"), - HTMLMetaElement: require("./generated/HTMLMetaElement.js"), - HTMLStyleElement: require("./generated/HTMLStyleElement.js"), - HTMLBodyElement: require("./generated/HTMLBodyElement.js"), - HTMLHeadingElement: require("./generated/HTMLHeadingElement.js"), - HTMLParagraphElement: require("./generated/HTMLParagraphElement.js"), - HTMLHRElement: require("./generated/HTMLHRElement.js"), - HTMLPreElement: require("./generated/HTMLPreElement.js"), - HTMLUListElement: require("./generated/HTMLUListElement.js"), - HTMLOListElement: require("./generated/HTMLOListElement.js"), - HTMLLIElement: require("./generated/HTMLLIElement.js"), - HTMLMenuElement: require("./generated/HTMLMenuElement.js"), - HTMLDListElement: require("./generated/HTMLDListElement.js"), - HTMLDivElement: require("./generated/HTMLDivElement.js"), - HTMLAnchorElement: require("./generated/HTMLAnchorElement.js"), - HTMLAreaElement: require("./generated/HTMLAreaElement.js"), - HTMLBRElement: require("./generated/HTMLBRElement.js"), - HTMLButtonElement: require("./generated/HTMLButtonElement.js"), - HTMLCanvasElement: require("./generated/HTMLCanvasElement.js"), - HTMLDataElement: require("./generated/HTMLDataElement.js"), - HTMLDataListElement: require("./generated/HTMLDataListElement.js"), - HTMLDetailsElement: require("./generated/HTMLDetailsElement.js"), - HTMLDialogElement: require("./generated/HTMLDialogElement.js"), - HTMLDirectoryElement: require("./generated/HTMLDirectoryElement.js"), - HTMLFieldSetElement: require("./generated/HTMLFieldSetElement.js"), - HTMLFontElement: require("./generated/HTMLFontElement.js"), - HTMLFormElement: require("./generated/HTMLFormElement.js"), - HTMLHtmlElement: require("./generated/HTMLHtmlElement.js"), - HTMLImageElement: require("./generated/HTMLImageElement.js"), - HTMLInputElement: require("./generated/HTMLInputElement.js"), - HTMLLabelElement: require("./generated/HTMLLabelElement.js"), - HTMLLegendElement: require("./generated/HTMLLegendElement.js"), - HTMLMapElement: require("./generated/HTMLMapElement.js"), - HTMLMarqueeElement: require("./generated/HTMLMarqueeElement.js"), - HTMLMediaElement: require("./generated/HTMLMediaElement.js"), - HTMLMeterElement: require("./generated/HTMLMeterElement.js"), - HTMLModElement: require("./generated/HTMLModElement.js"), - HTMLOptGroupElement: require("./generated/HTMLOptGroupElement.js"), - HTMLOptionElement: require("./generated/HTMLOptionElement.js"), - HTMLOutputElement: require("./generated/HTMLOutputElement.js"), - HTMLPictureElement: require("./generated/HTMLPictureElement.js"), - HTMLProgressElement: require("./generated/HTMLProgressElement.js"), - HTMLQuoteElement: require("./generated/HTMLQuoteElement.js"), - HTMLScriptElement: require("./generated/HTMLScriptElement.js"), - HTMLSelectElement: require("./generated/HTMLSelectElement.js"), - HTMLSlotElement: require("./generated/HTMLSlotElement.js"), - HTMLSourceElement: require("./generated/HTMLSourceElement.js"), - HTMLSpanElement: require("./generated/HTMLSpanElement.js"), - HTMLTableCaptionElement: require("./generated/HTMLTableCaptionElement.js"), - HTMLTableCellElement: require("./generated/HTMLTableCellElement.js"), - HTMLTableColElement: require("./generated/HTMLTableColElement.js"), - HTMLTableElement: require("./generated/HTMLTableElement.js"), - HTMLTimeElement: require("./generated/HTMLTimeElement.js"), - HTMLTableRowElement: require("./generated/HTMLTableRowElement.js"), - HTMLTableSectionElement: require("./generated/HTMLTableSectionElement.js"), - HTMLTemplateElement: require("./generated/HTMLTemplateElement.js"), - HTMLTextAreaElement: require("./generated/HTMLTextAreaElement.js"), - HTMLUnknownElement: require("./generated/HTMLUnknownElement.js"), - HTMLFrameElement: require("./generated/HTMLFrameElement.js"), - HTMLFrameSetElement: require("./generated/HTMLFrameSetElement.js"), - HTMLIFrameElement: require("./generated/HTMLIFrameElement.js"), - HTMLEmbedElement: require("./generated/HTMLEmbedElement.js"), - HTMLObjectElement: require("./generated/HTMLObjectElement.js"), - HTMLParamElement: require("./generated/HTMLParamElement.js"), - HTMLVideoElement: require("./generated/HTMLVideoElement.js"), - HTMLAudioElement: require("./generated/HTMLAudioElement.js"), - HTMLTrackElement: require("./generated/HTMLTrackElement.js"), - HTMLFormControlsCollection: require("./generated/HTMLFormControlsCollection.js"), - - SVGElement: require("./generated/SVGElement.js"), - SVGGraphicsElement: require("./generated/SVGGraphicsElement.js"), - SVGSVGElement: require("./generated/SVGSVGElement.js"), - SVGGElement: require("./generated/SVGGElement.js"), - SVGDefsElement: require("./generated/SVGDefsElement.js"), - SVGDescElement: require("./generated/SVGDescElement.js"), - SVGMetadataElement: require("./generated/SVGMetadataElement.js"), - SVGTitleElement: require("./generated/SVGTitleElement.js"), - SVGSymbolElement: require("./generated/SVGSymbolElement.js"), - SVGSwitchElement: require("./generated/SVGSwitchElement.js"), - - SVGAnimatedPreserveAspectRatio: require("./generated/SVGAnimatedPreserveAspectRatio"), - SVGAnimatedRect: require("./generated/SVGAnimatedRect"), - SVGAnimatedString: require("./generated/SVGAnimatedString"), - SVGNumber: require("./generated/SVGNumber"), - SVGPreserveAspectRatio: require("./generated/SVGPreserveAspectRatio"), - SVGRect: require("./generated/SVGRect"), - SVGStringList: require("./generated/SVGStringList"), - - Event: require("./generated/Event"), - BeforeUnloadEvent: require("./generated/BeforeUnloadEvent"), - BlobEvent: require("./generated/BlobEvent"), - CloseEvent: require("./generated/CloseEvent"), - CustomEvent: require("./generated/CustomEvent"), - DeviceOrientationEvent: require("./generated/DeviceOrientationEvent"), - DeviceMotionEvent: require("./generated/DeviceMotionEvent"), - ErrorEvent: require("./generated/ErrorEvent"), - HashChangeEvent: require("./generated/HashChangeEvent"), - MessageEvent: require("./generated/MessageEvent"), - PageTransitionEvent: require("./generated/PageTransitionEvent"), - PopStateEvent: require("./generated/PopStateEvent"), - PromiseRejectionEvent: require("./generated/PromiseRejectionEvent"), - ProgressEvent: require("./generated/ProgressEvent"), - StorageEvent: require("./generated/StorageEvent"), - SubmitEvent: require("./generated/SubmitEvent"), - TransitionEvent: require("./generated/TransitionEvent"), - - UIEvent: require("./generated/UIEvent"), - FocusEvent: require("./generated/FocusEvent"), - InputEvent: require("./generated/InputEvent"), - MouseEvent: require("./generated/MouseEvent"), - PointerEvent: require("./generated/PointerEvent"), - KeyboardEvent: require("./generated/KeyboardEvent"), - TouchEvent: require("./generated/TouchEvent"), - CompositionEvent: require("./generated/CompositionEvent"), - WheelEvent: require("./generated/WheelEvent"), - - BarProp: require("./generated/BarProp"), - External: require("./generated/External"), - Location: require("./generated/Location"), - History: require("./generated/History"), - Screen: require("./generated/Screen"), - Performance: require("./generated/Performance"), - Navigator: require("./generated/Navigator"), - - Crypto: require("./generated/Crypto"), - - PluginArray: require("./generated/PluginArray"), - MimeTypeArray: require("./generated/MimeTypeArray"), - Plugin: require("./generated/Plugin"), - MimeType: require("./generated/MimeType"), - - FileReader: require("./generated/FileReader"), - Blob: require("./generated/Blob"), - File: require("./generated/File"), - FileList: require("./generated/FileList"), - ValidityState: require("./generated/ValidityState"), - - DOMParser: require("./generated/DOMParser"), - XMLSerializer: require("./generated/XMLSerializer"), - - FormData: require("./generated/FormData"), - XMLHttpRequestEventTarget: require("./generated/XMLHttpRequestEventTarget"), - XMLHttpRequestUpload: require("./generated/XMLHttpRequestUpload"), - XMLHttpRequest: require("./generated/XMLHttpRequest"), - WebSocket: require("./generated/WebSocket"), - - NodeFilter: require("./generated/NodeFilter"), - NodeIterator: require("./generated/NodeIterator"), - TreeWalker: require("./generated/TreeWalker"), - - AbstractRange: require("./generated/AbstractRange"), - Range: require("./generated/Range"), - StaticRange: require("./generated/StaticRange"), - Selection: require("./generated/Selection"), - - Storage: require("./generated/Storage"), - - CustomElementRegistry: require("./generated/CustomElementRegistry"), - ElementInternals: require("./generated/ElementInternals"), - ShadowRoot: require("./generated/ShadowRoot"), - - MutationObserver: require("./generated/MutationObserver"), - MutationRecord: require("./generated/MutationRecord"), - - Headers: require("./generated/Headers"), - AbortController: require("./generated/AbortController"), - AbortSignal: require("./generated/AbortSignal"), - - DeviceMotionEventAcceleration: require("./generated/DeviceMotionEventAcceleration"), - DeviceMotionEventRotationRate: require("./generated/DeviceMotionEventRotationRate"), - - DOMRectReadOnly: require("./generated/DOMRectReadOnly"), - DOMRect: require("./generated/DOMRect"), - - TextDecoder: require("./generated/TextDecoder"), - TextEncoder: require("./generated/TextEncoder") -}; - -function install(window, name, interfaceConstructor) { - Object.defineProperty(window, name, { - configurable: true, - writable: true, - value: interfaceConstructor - }); -} - -exports.installInterfaces = (window, globalNames) => { - // Install generated interface. - for (const generatedInterface of Object.values(generatedInterfaces)) { - generatedInterface.install(window, globalNames); - } - - // Install legacy HTMLDocument interface - // https://html.spec.whatwg.org/#htmldocument - install(window, "HTMLDocument", window.Document); - - // https://webidl.spec.whatwg.org/#es-DOMException-specialness - Object.setPrototypeOf(window.DOMException.prototype, window.Error.prototype); - - // These need to be cleaned up... - style.addToCore(window); - xpath(window); -}; - -// Returns an interface webidl2js wrapper given its an interface name. -exports.getInterfaceWrapper = name => { - return generatedInterfaces[name]; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationObserver-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationObserver-impl.js deleted file mode 100644 index 3057da8..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationObserver-impl.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; - -const { wrapperForImpl } = require("../generated/utils"); - -// If we were to implement the MutationObserver by spec, the MutationObservers will not be collected by the GC because -// all the MO are kept in a mutation observer list (https://github.com/jsdom/jsdom/pull/2398/files#r238123889). The -// mutation observer list is primarily used to invoke the mutation observer callback in the same order than the -// mutation observer creation. -// In order to get around this issue, we will assign an increasing id for each mutation observer, this way we would be -// able to invoke the callback in the creation order without having to keep a list of all the mutation observers. -let mutationObserverId = 0; - -// https://dom.spec.whatwg.org/#mutationobserver -class MutationObserverImpl { - // https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver - constructor(globalObject, args) { - const [callback] = args; - - this._callback = callback; - this._nodeList = []; - this._recordQueue = []; - - this._id = ++mutationObserverId; - } - - // https://dom.spec.whatwg.org/#dom-mutationobserver-observe - observe(target, options) { - if (("attributeOldValue" in options || "attributeFilter" in options) && !("attributes" in options)) { - options.attributes = true; - } - - if ("characterDataOldValue" in options & !("characterData" in options)) { - options.characterData = true; - } - - if (!options.childList && !options.attributes && !options.characterData) { - throw new TypeError("The options object must set at least one of 'attributes', 'characterData', or 'childList' " + - "to true."); - } else if (options.attributeOldValue && !options.attributes) { - throw new TypeError("The options object may only set 'attributeOldValue' to true when 'attributes' is true or " + - "not present."); - } else if (("attributeFilter" in options) && !options.attributes) { - throw new TypeError("The options object may only set 'attributeFilter' when 'attributes' is true or not " + - "present."); - } else if (options.characterDataOldValue && !options.characterData) { - throw new TypeError("The options object may only set 'characterDataOldValue' to true when 'characterData' is " + - "true or not present."); - } - - const existingRegisteredObserver = target._registeredObserverList.find(registeredObserver => { - return registeredObserver.observer === this; - }); - - if (existingRegisteredObserver) { - for (const node of this._nodeList) { - node._registeredObserverList = node._registeredObserverList.filter(registeredObserver => { - return registeredObserver.source !== existingRegisteredObserver; - }); - } - - existingRegisteredObserver.options = options; - } else { - target._registeredObserverList.push({ - observer: this, - options - }); - - this._nodeList.push(target); - } - } - - // https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect - disconnect() { - for (const node of this._nodeList) { - node._registeredObserverList = node._registeredObserverList.filter(registeredObserver => { - return registeredObserver.observer !== this; - }); - } - - this._recordQueue = []; - } - - // https://dom.spec.whatwg.org/#dom-mutationobserver-takerecords - takeRecords() { - // TODO: revisit if https://github.com/jsdom/webidl2js/pull/108 gets fixed. - const records = this._recordQueue.map(wrapperForImpl); - this._recordQueue = []; - - return records; - } -} - -module.exports = { - implementation: MutationObserverImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationRecord-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationRecord-impl.js deleted file mode 100644 index fc16f3b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationRecord-impl.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -const NodeList = require("../generated/NodeList"); - -// https://dom.spec.whatwg.org/#mutationrecord -class MutationRecordImpl { - constructor(globalObject, args, privateData) { - this._globalObject = globalObject; - - this.type = privateData.type; - this.target = privateData.target; - this.previousSibling = privateData.previousSibling; - this.nextSibling = privateData.nextSibling; - this.attributeName = privateData.attributeName; - this.attributeNamespace = privateData.attributeNamespace; - this.oldValue = privateData.oldValue; - - this._addedNodes = privateData.addedNodes; - this._removedNodes = privateData.removedNodes; - } - - get addedNodes() { - return NodeList.createImpl(this._globalObject, [], { - nodes: this._addedNodes - }); - } - - get removedNodes() { - return NodeList.createImpl(this._globalObject, [], { - nodes: this._removedNodes - }); - } -} - -module.exports = { - implementation: MutationRecordImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/MimeType-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/MimeType-impl.js deleted file mode 100644 index e251c2a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/MimeType-impl.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -exports.implementation = class MimeType {}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/MimeTypeArray-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/MimeTypeArray-impl.js deleted file mode 100644 index 321ee51..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/MimeTypeArray-impl.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils"); - -exports.implementation = class MimeTypeArray { - get length() { - return 0; - } - - item() { - return null; - } - - namedItem() { - return null; - } - - get [idlUtils.supportedPropertyIndices]() { - return []; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/Navigator-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/Navigator-impl.js deleted file mode 100644 index 72607bf..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/Navigator-impl.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -const { mixin } = require("../../utils"); -const PluginArray = require("../generated/PluginArray"); -const MimeTypeArray = require("../generated/MimeTypeArray"); -const NavigatorIDImpl = require("./NavigatorID-impl").implementation; -const NavigatorLanguageImpl = require("./NavigatorLanguage-impl").implementation; -const NavigatorOnLineImpl = require("./NavigatorOnLine-impl").implementation; -const NavigatorCookiesImpl = require("./NavigatorCookies-impl").implementation; -const NavigatorPluginsImpl = require("./NavigatorPlugins-impl").implementation; -const NavigatorConcurrentHardwareImpl = require("./NavigatorConcurrentHardware-impl").implementation; - -class NavigatorImpl { - constructor(globalObject) { - this._globalObject = globalObject; - this.userAgent = globalObject._userAgent; - this.languages = Object.freeze(["en-US", "en"]); - this.plugins = PluginArray.create(this._globalObject); - this.mimeTypes = MimeTypeArray.create(this._globalObject); - } -} - -mixin(NavigatorImpl.prototype, NavigatorIDImpl.prototype); -mixin(NavigatorImpl.prototype, NavigatorLanguageImpl.prototype); -mixin(NavigatorImpl.prototype, NavigatorOnLineImpl.prototype); -mixin(NavigatorImpl.prototype, NavigatorCookiesImpl.prototype); -mixin(NavigatorImpl.prototype, NavigatorPluginsImpl.prototype); -mixin(NavigatorImpl.prototype, NavigatorConcurrentHardwareImpl.prototype); - -exports.implementation = NavigatorImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorConcurrentHardware-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorConcurrentHardware-impl.js deleted file mode 100644 index 4fd29ad..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorConcurrentHardware-impl.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -const os = require("os"); - -exports.implementation = class NavigatorConcurrentHardwareImpl { - get hardwareConcurrency() { - return os.cpus().length; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorCookies-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorCookies-impl.js deleted file mode 100644 index a66f677..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorCookies-impl.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -exports.implementation = class NavigatorCookiesImpl { - get cookieEnabled() { - return true; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorID-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorID-impl.js deleted file mode 100644 index 50aac66..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorID-impl.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -exports.implementation = class NavigatorIDImpl { - get appCodeName() { - return "Mozilla"; - } - - get appName() { - return "Netscape"; - } - - get appVersion() { - return "4.0"; - } - - get platform() { - return ""; - } - - get product() { - return "Gecko"; - } - - get productSub() { - return "20030107"; - } - - // see Navigator constructor for userAgent - - get vendor() { - return "Apple Computer, Inc."; - } - - get vendorSub() { - return ""; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorLanguage-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorLanguage-impl.js deleted file mode 100644 index 136a3fd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorLanguage-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -exports.implementation = class NavigatorLanguageImpl { - get language() { - return "en-US"; - } - - // See Navigator constructor for languages -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorOnLine-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorOnLine-impl.js deleted file mode 100644 index 44a9779..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorOnLine-impl.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -exports.implementation = class NavigatorOnLineImpl { - get onLine() { - return true; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorPlugins-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorPlugins-impl.js deleted file mode 100644 index 4763ae6..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorPlugins-impl.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -exports.implementation = class NavigatorPluginsImpl { - // plugins and mimeTypes are implemented in Navigator-impl.js - javaEnabled() { - return false; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/Plugin-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/Plugin-impl.js deleted file mode 100644 index eff02fe..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/Plugin-impl.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -exports.implementation = class Plugin {}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/PluginArray-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/PluginArray-impl.js deleted file mode 100644 index 9e72642..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/navigator/PluginArray-impl.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils"); - -exports.implementation = class PluginArray { - refresh() {} - - get length() { - return 0; - } - - item() { - return null; - } - - namedItem() { - return null; - } - - get [idlUtils.supportedPropertyIndices]() { - return []; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/node-document-position.js b/vanilla/node_modules/jsdom/lib/jsdom/living/node-document-position.js deleted file mode 100644 index 06485c0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/node-document-position.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = Object.freeze({ - DOCUMENT_POSITION_DISCONNECTED: 1, - DOCUMENT_POSITION_PRECEDING: 2, - DOCUMENT_POSITION_FOLLOWING: 4, - DOCUMENT_POSITION_CONTAINS: 8, - DOCUMENT_POSITION_CONTAINED_BY: 16, - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32 -}); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/node-type.js b/vanilla/node_modules/jsdom/lib/jsdom/living/node-type.js deleted file mode 100644 index 96f3405..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/node-type.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -module.exports = Object.freeze({ - ELEMENT_NODE: 1, - ATTRIBUTE_NODE: 2, - TEXT_NODE: 3, - CDATA_SECTION_NODE: 4, // historical - ENTITY_REFERENCE_NODE: 5, // historical - ENTITY_NODE: 6, // historical - PROCESSING_INSTRUCTION_NODE: 7, - COMMENT_NODE: 8, - DOCUMENT_NODE: 9, - DOCUMENT_TYPE_NODE: 10, - DOCUMENT_FRAGMENT_NODE: 11, - NOTATION_NODE: 12 // historical -}); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/node.js b/vanilla/node_modules/jsdom/lib/jsdom/living/node.js deleted file mode 100644 index a0e41c0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/node.js +++ /dev/null @@ -1,331 +0,0 @@ -"use strict"; -const { appendAttribute } = require("./attributes"); -const NODE_TYPE = require("./node-type"); - -const orderedSetParse = require("./helpers/ordered-set").parse; -const { createElement } = require("./helpers/create-element"); -const { HTML_NS, XMLNS_NS } = require("./helpers/namespaces"); -const { cloningSteps, domSymbolTree } = require("./helpers/internal-constants"); -const { asciiCaseInsensitiveMatch, asciiLowercase } = require("./helpers/strings"); - -const HTMLCollection = require("./generated/HTMLCollection"); - -exports.clone = (node, document, cloneChildren) => { - if (document === undefined) { - document = node._ownerDocument; - } - - let copy; - switch (node.nodeType) { - case NODE_TYPE.DOCUMENT_NODE: - // Can't use a simple `Document.createImpl` because of circular dependency issues :-/ - copy = node._cloneDocument(); - break; - - case NODE_TYPE.DOCUMENT_TYPE_NODE: - copy = document.implementation.createDocumentType(node.name, node.publicId, node.systemId); - break; - - case NODE_TYPE.ELEMENT_NODE: - copy = createElement( - document, - node._localName, - node._namespaceURI, - node._prefix, - node._isValue, - false - ); - - for (const attribute of node._attributeList) { - appendAttribute(copy, exports.clone(attribute, document)); - } - break; - - case NODE_TYPE.ATTRIBUTE_NODE: - copy = document._createAttribute({ - namespace: node._namespace, - namespacePrefix: node._namespacePrefix, - localName: node._localName, - value: node._value - }); - break; - - case NODE_TYPE.TEXT_NODE: - copy = document.createTextNode(node._data); - break; - - case NODE_TYPE.CDATA_SECTION_NODE: - copy = document.createCDATASection(node._data); - break; - - case NODE_TYPE.COMMENT_NODE: - copy = document.createComment(node._data); - break; - - case NODE_TYPE.PROCESSING_INSTRUCTION_NODE: - copy = document.createProcessingInstruction(node.target, node._data); - break; - - case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: - copy = document.createDocumentFragment(); - break; - } - - if (node[cloningSteps]) { - node[cloningSteps](copy, node, document, cloneChildren); - } - - if (cloneChildren) { - for (const child of domSymbolTree.childrenIterator(node)) { - const childCopy = exports.clone(child, document, true); - copy._append(childCopy); - } - } - - return copy; -}; - -// For the following, memoization is not applied here since the memoized results are stored on `this`. - -exports.listOfElementsWithClassNames = (classNames, root) => { - // https://dom.spec.whatwg.org/#concept-getElementsByClassName - - const classes = orderedSetParse(classNames); - - if (classes.size === 0) { - return HTMLCollection.createImpl(root._globalObject, [], { element: root, query: () => [] }); - } - - return HTMLCollection.createImpl(root._globalObject, [], { - element: root, - query: () => { - const isQuirksMode = root._ownerDocument.compatMode === "BackCompat"; - - return domSymbolTree.treeToArray(root, { filter(node) { - if (node.nodeType !== NODE_TYPE.ELEMENT_NODE || node === root) { - return false; - } - - const { classList } = node; - if (isQuirksMode) { - for (const className of classes) { - if (!classList.tokenSet.some(cur => asciiCaseInsensitiveMatch(cur, className))) { - return false; - } - } - } else { - for (const className of classes) { - if (!classList.tokenSet.contains(className)) { - return false; - } - } - } - - return true; - } }); - } - }); -}; - -exports.listOfElementsWithQualifiedName = (qualifiedName, root) => { - // https://dom.spec.whatwg.org/#concept-getelementsbytagname - - if (qualifiedName === "*") { - return HTMLCollection.createImpl(root._globalObject, [], { - element: root, - query: () => domSymbolTree.treeToArray(root, { - filter: node => node.nodeType === NODE_TYPE.ELEMENT_NODE && node !== root - }) - }); - } - - if (root._ownerDocument._parsingMode === "html") { - const lowerQualifiedName = asciiLowercase(qualifiedName); - - return HTMLCollection.createImpl(root._globalObject, [], { - element: root, - query: () => domSymbolTree.treeToArray(root, { - filter(node) { - if (node.nodeType !== NODE_TYPE.ELEMENT_NODE || node === root) { - return false; - } - - if (node._namespaceURI === HTML_NS) { - return node._qualifiedName === lowerQualifiedName; - } - - return node._qualifiedName === qualifiedName; - } - }) - }); - } - - return HTMLCollection.createImpl(root._globalObject, [], { - element: root, - query: () => domSymbolTree.treeToArray(root, { - filter(node) { - if (node.nodeType !== NODE_TYPE.ELEMENT_NODE || node === root) { - return false; - } - - return node._qualifiedName === qualifiedName; - } - }) - }); -}; - -exports.listOfElementsWithNamespaceAndLocalName = (namespace, localName, root) => { - // https://dom.spec.whatwg.org/#concept-getelementsbytagnamens - - if (namespace === "") { - namespace = null; - } - - if (namespace === "*" && localName === "*") { - return HTMLCollection.createImpl(root._globalObject, [], { - element: root, - query: () => domSymbolTree.treeToArray(root, { - filter: node => node.nodeType === NODE_TYPE.ELEMENT_NODE && node !== root - }) - }); - } - - if (namespace === "*") { - return HTMLCollection.createImpl(root._globalObject, [], { - element: root, - query: () => domSymbolTree.treeToArray(root, { - filter(node) { - if (node.nodeType !== NODE_TYPE.ELEMENT_NODE || node === root) { - return false; - } - - return node._localName === localName; - } - }) - }); - } - - if (localName === "*") { - return HTMLCollection.createImpl(root._globalObject, [], { - element: root, - query: () => domSymbolTree.treeToArray(root, { - filter(node) { - if (node.nodeType !== NODE_TYPE.ELEMENT_NODE || node === root) { - return false; - } - - return node._namespaceURI === namespace; - } - }) - }); - } - - return HTMLCollection.createImpl(root._globalObject, [], { - element: root, - query: () => domSymbolTree.treeToArray(root, { - filter(node) { - if (node.nodeType !== NODE_TYPE.ELEMENT_NODE || node === root) { - return false; - } - - return node._localName === localName && node._namespaceURI === namespace; - } - }) - }); -}; - -// https://dom.spec.whatwg.org/#converting-nodes-into-a-node -// create a fragment (or just return a node for one item) -exports.convertNodesIntoNode = (document, nodes) => { - if (nodes.length === 1) { // note: I'd prefer to check instanceof Node rather than string - return typeof nodes[0] === "string" ? document.createTextNode(nodes[0]) : nodes[0]; - } - const fragment = document.createDocumentFragment(); - for (let i = 0; i < nodes.length; i++) { - fragment._append(typeof nodes[i] === "string" ? document.createTextNode(nodes[i]) : nodes[i]); - } - return fragment; -}; - -// https://dom.spec.whatwg.org/#locate-a-namespace-prefix -exports.locateNamespacePrefix = (element, namespace) => { - if (element._namespaceURI === namespace && element._prefix !== null) { - return element._prefix; - } - - for (const attribute of element._attributeList) { - if (attribute._namespacePrefix === "xmlns" && attribute._value === namespace) { - return attribute._localName; - } - } - - if (element.parentElement !== null) { - return exports.locateNamespacePrefix(element.parentElement, namespace); - } - - return null; -}; - -// https://dom.spec.whatwg.org/#locate-a-namespace -exports.locateNamespace = (node, prefix) => { - switch (node.nodeType) { - case NODE_TYPE.ELEMENT_NODE: { - if (node._namespaceURI !== null && node._prefix === prefix) { - return node._namespaceURI; - } - - if (prefix === null) { - for (const attribute of node._attributeList) { - if (attribute._namespace === XMLNS_NS && - attribute._namespacePrefix === null && - attribute._localName === "xmlns") { - return attribute._value !== "" ? attribute._value : null; - } - } - } else { - for (const attribute of node._attributeList) { - if (attribute._namespace === XMLNS_NS && - attribute._namespacePrefix === "xmlns" && - attribute._localName === prefix) { - return attribute._value !== "" ? attribute._value : null; - } - } - } - - if (node.parentElement === null) { - return null; - } - - return exports.locateNamespace(node.parentElement, prefix); - } - - case NODE_TYPE.DOCUMENT_NODE: { - if (node.documentElement === null) { - return null; - } - - return exports.locateNamespace(node.documentElement, prefix); - } - - case NODE_TYPE.DOCUMENT_TYPE_NODE: - case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: { - return null; - } - - case NODE_TYPE.ATTRIBUTE_NODE: { - if (node._element === null) { - return null; - } - - return exports.locateNamespace(node._element, prefix); - } - - default: { - if (node.parentElement === null) { - return null; - } - - return exports.locateNamespace(node.parentElement, prefix); - } - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/CDATASection-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/CDATASection-impl.js deleted file mode 100644 index d9e6248..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/CDATASection-impl.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -const TextImpl = require("./Text-impl").implementation; -const NODE_TYPE = require("../node-type"); - -class CDATASectionImpl extends TextImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this.nodeType = NODE_TYPE.CDATA_SECTION_NODE; - } -} - -module.exports = { - implementation: CDATASectionImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/CharacterData-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/CharacterData-impl.js deleted file mode 100644 index b36bced..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/CharacterData-impl.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); - -const { mixin } = require("../../utils"); -const NodeImpl = require("./Node-impl").implementation; -const ChildNodeImpl = require("./ChildNode-impl").implementation; -const NonDocumentTypeChildNodeImpl = require("./NonDocumentTypeChildNode-impl").implementation; - -const { TEXT_NODE } = require("../node-type"); -const { MUTATION_TYPE, queueMutationRecord } = require("../helpers/mutation-observers"); - -// https://dom.spec.whatwg.org/#characterdata -class CharacterDataImpl extends NodeImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._data = privateData.data; - } - - // https://dom.spec.whatwg.org/#dom-characterdata-data - get data() { - return this._data; - } - set data(data) { - this.replaceData(0, this.length, data); - } - - // https://dom.spec.whatwg.org/#dom-characterdata-length - get length() { - return this._data.length; - } - - // https://dom.spec.whatwg.org/#dom-characterdata-substringdata - // https://dom.spec.whatwg.org/#concept-cd-substring - substringData(offset, count) { - const { length } = this; - - if (offset > length) { - throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); - } - - if (offset + count > length) { - return this._data.slice(offset); - } - - return this._data.slice(offset, offset + count); - } - - // https://dom.spec.whatwg.org/#dom-characterdata-appenddata - appendData(data) { - this.replaceData(this.length, 0, data); - } - - // https://dom.spec.whatwg.org/#dom-characterdata-insertdata - insertData(offset, data) { - this.replaceData(offset, 0, data); - } - - // https://dom.spec.whatwg.org/#dom-characterdata-deletedata - deleteData(offset, count) { - this.replaceData(offset, count, ""); - } - - // https://dom.spec.whatwg.org/#dom-characterdata-replacedata - // https://dom.spec.whatwg.org/#concept-cd-replace - replaceData(offset, count, data) { - const { length } = this; - - if (offset > length) { - throw DOMException.create(this._globalObject, [ - "The index is not in the allowed range.", - "IndexSizeError" - ]); - } - - if (offset + count > length) { - count = length - offset; - } - - queueMutationRecord(MUTATION_TYPE.CHARACTER_DATA, this, null, null, this._data, [], [], null, null); - - const start = this._data.slice(0, offset); - const end = this._data.slice(offset + count); - this._data = start + data + end; - - for (const range of this._liveRanges()) { - const { _start, _end } = range; - - if (_start.node === this && _start.offset > offset && _start.offset <= offset + count) { - range._setLiveRangeStart(this, offset); - } - - if (_end.node === this && _end.offset > offset && _end.offset <= offset + count) { - range._setLiveRangeEnd(this, offset); - } - - if (_start.node === this && _start.offset > offset + count) { - range._setLiveRangeStart(this, _start.offset + data.length - count); - } - - if (_end.node === this && _end.offset > offset + count) { - range._setLiveRangeEnd(this, _end.offset + data.length - count); - } - } - - if (this.nodeType === TEXT_NODE && this.parentNode) { - this.parentNode._childTextContentChangeSteps(); - } - } -} - -mixin(CharacterDataImpl.prototype, NonDocumentTypeChildNodeImpl.prototype); -mixin(CharacterDataImpl.prototype, ChildNodeImpl.prototype); - -module.exports = { - implementation: CharacterDataImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ChildNode-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ChildNode-impl.js deleted file mode 100644 index 799e44f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ChildNode-impl.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; - -const { convertNodesIntoNode } = require("../node"); - -class ChildNodeImpl { - remove() { - if (!this.parentNode) { - return; - } - - this.parentNode._remove(this); - } - - after(...nodes) { - const parent = this.parentNode; - if (parent) { - let viableNextSibling = this.nextSibling; - let idx = viableNextSibling ? nodes.indexOf(viableNextSibling) : -1; - - while (idx !== -1) { - viableNextSibling = viableNextSibling.nextSibling; - if (!viableNextSibling) { - break; - } - idx = nodes.indexOf(viableNextSibling); - } - - parent._preInsert(convertNodesIntoNode(this._ownerDocument, nodes), viableNextSibling); - } - } - - before(...nodes) { - const parent = this.parentNode; - if (parent) { - let viablePreviousSibling = this.previousSibling; - let idx = viablePreviousSibling ? nodes.indexOf(viablePreviousSibling) : -1; - - while (idx !== -1) { - viablePreviousSibling = viablePreviousSibling.previousSibling; - if (!viablePreviousSibling) { - break; - } - idx = nodes.indexOf(viablePreviousSibling); - } - - parent._preInsert( - convertNodesIntoNode(this._ownerDocument, nodes), - viablePreviousSibling ? viablePreviousSibling.nextSibling : parent.firstChild - ); - } - } - - replaceWith(...nodes) { - const parent = this.parentNode; - if (parent) { - let viableNextSibling = this.nextSibling; - let idx = viableNextSibling ? nodes.indexOf(viableNextSibling) : -1; - - while (idx !== -1) { - viableNextSibling = viableNextSibling.nextSibling; - if (!viableNextSibling) { - break; - } - idx = nodes.indexOf(viableNextSibling); - } - - const node = convertNodesIntoNode(this._ownerDocument, nodes); - - if (this.parentNode === parent) { - parent._replace(node, this); - } else { - parent._preInsert(node, viableNextSibling); - } - } - } -} - -module.exports = { - implementation: ChildNodeImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Comment-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Comment-impl.js deleted file mode 100644 index b0ab40e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Comment-impl.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -const CharacterDataImpl = require("./CharacterData-impl").implementation; -const idlUtils = require("../generated/utils"); -const NODE_TYPE = require("../node-type"); - -class CommentImpl extends CharacterDataImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, { - data: args[0], - ownerDocument: idlUtils.implForWrapper(globalObject._document), - ...privateData - }); - - this.nodeType = NODE_TYPE.COMMENT_NODE; - } -} - -module.exports = { - implementation: CommentImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DOMImplementation-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DOMImplementation-impl.js deleted file mode 100644 index e65255c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DOMImplementation-impl.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; - -const validateNames = require("../helpers/validate-names"); -const { HTML_NS, SVG_NS } = require("../helpers/namespaces"); -const { createElement, internalCreateElementNSSteps } = require("../helpers/create-element"); -const DocumentType = require("../generated/DocumentType"); -const documents = require("../documents.js"); - -class DOMImplementationImpl { - constructor(globalObject, args, privateData) { - this._globalObject = globalObject; - this._ownerDocument = privateData.ownerDocument; - } - - hasFeature() { - return true; - } - - createDocumentType(qualifiedName, publicId, systemId) { - validateNames.qname(this._globalObject, qualifiedName); - - return DocumentType.createImpl(this._globalObject, [], { - ownerDocument: this._ownerDocument, - name: qualifiedName, - publicId, - systemId - }); - } - - // https://dom.spec.whatwg.org/#dom-domimplementation-createdocument - createDocument(namespace, qualifiedName, doctype) { - let contentType = "application/xml"; - - if (namespace === HTML_NS) { - contentType = "application/xhtml+xml"; - } else if (namespace === SVG_NS) { - contentType = "image/svg+xml"; - } - - const document = documents.createImpl(this._globalObject, { - contentType, - parsingMode: "xml", - encoding: "UTF-8" - }); - - let element = null; - if (qualifiedName !== "") { - element = internalCreateElementNSSteps(document, namespace, qualifiedName, {}); - } - - if (doctype !== null) { - document.appendChild(doctype); - } - - if (element !== null) { - document.appendChild(element); - } - - document._origin = this._ownerDocument._origin; - - return document; - } - - // https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument - createHTMLDocument(title) { - // Let doc be a new document that is an HTML document. - // Set doc's content type to "text/html". - const document = documents.createImpl(this._globalObject, { - parsingMode: "html", - encoding: "UTF-8" - }); - - // Create a doctype, with "html" as its name and with its node document set - // to doc. Append the newly created node to doc. - const doctype = DocumentType.createImpl(this._globalObject, [], { - ownerDocument: document, - name: "html", - publicId: "", - systemId: "" - }); - - document.appendChild(doctype); - - // Create an html element in the HTML namespace, and append it to doc. - const htmlElement = createElement(document, "html", HTML_NS); - document.appendChild(htmlElement); - - // Create a head element in the HTML namespace, and append it to the html - // element created in the previous step. - const headElement = createElement(document, "head", HTML_NS); - htmlElement.appendChild(headElement); - - // If the title argument is not omitted: - if (title !== undefined) { - // Create a title element in the HTML namespace, and append it to the head - // element created in the previous step. - const titleElement = createElement(document, "title", HTML_NS); - headElement.appendChild(titleElement); - - // Create a Text node, set its data to title (which could be the empty - // string), and append it to the title element created in the previous step. - titleElement.appendChild(document.createTextNode(title)); - } - - // Create a body element in the HTML namespace, and append it to the html - // element created in the earlier step. - const bodyElement = createElement(document, "body", HTML_NS); - htmlElement.appendChild(bodyElement); - - // doc's origin is an alias to the origin of the context object's associated - // document, and doc's effective script origin is an alias to the effective - // script origin of the context object's associated document. - - return document; - } -} - -module.exports = { - implementation: DOMImplementationImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DOMStringMap-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DOMStringMap-impl.js deleted file mode 100644 index 58a86b2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DOMStringMap-impl.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils.js"); -const { setAttributeValue, removeAttributeByName } = require("../attributes"); -const validateName = require("../helpers/validate-names").name; -const DOMException = require("../generated/DOMException"); - -const dataAttrRe = /^data-([^A-Z]*)$/; - -function attrCamelCase(name) { - return name.replace(/-([a-z])/g, (match, alpha) => alpha.toUpperCase()); -} - -function attrSnakeCase(name) { - return name.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`); -} - -exports.implementation = class DOMStringMapImpl { - constructor(globalObject, args, privateData) { - this._globalObject = globalObject; - this._element = privateData.element; - } - get [idlUtils.supportedPropertyNames]() { - const result = new Set(); - const { attributes } = this._element; - for (let i = 0; i < attributes.length; i++) { - const attr = attributes.item(i); - const matches = dataAttrRe.exec(attr.localName); - if (matches) { - result.add(attrCamelCase(matches[1])); - } - } - return result; - } - [idlUtils.namedGet](name) { - const { attributes } = this._element; - for (let i = 0; i < attributes.length; i++) { - const attr = attributes.item(i); - const matches = dataAttrRe.exec(attr.localName); - if (matches && attrCamelCase(matches[1]) === name) { - return attr.value; - } - } - return undefined; - } - [idlUtils.namedSetNew](name, value) { - if (/-[a-z]/.test(name)) { - throw DOMException.create(this._globalObject, [ - `'${name}' is not a valid property name`, - "SyntaxError" - ]); - } - name = `data-${attrSnakeCase(name)}`; - validateName(this._globalObject, name); - setAttributeValue(this._element, name, value); - } - [idlUtils.namedSetExisting](name, value) { - this[idlUtils.namedSetNew](name, value); - } - [idlUtils.namedDelete](name) { - name = `data-${attrSnakeCase(name)}`; - removeAttributeByName(this._element, name); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DOMTokenList-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DOMTokenList-impl.js deleted file mode 100644 index d6fb02d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DOMTokenList-impl.js +++ /dev/null @@ -1,171 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); -const OrderedSet = require("../helpers/ordered-set.js"); -const { asciiLowercase } = require("../helpers/strings.js"); -const idlUtils = require("../generated/utils.js"); - -const { getAttributeValue, setAttributeValue, hasAttributeByName } = require("../attributes.js"); - -function validateTokens(globalObject, ...tokens) { - for (const token of tokens) { - if (token === "") { - throw DOMException.create(globalObject, ["The token provided must not be empty.", "SyntaxError"]); - } - } - for (const token of tokens) { - if (/[\t\n\f\r ]/.test(token)) { - throw DOMException.create(globalObject, [ - "The token provided contains HTML space characters, which are not valid in tokens.", - "InvalidCharacterError" - ]); - } - } -} - -// https://dom.spec.whatwg.org/#domtokenlist -class DOMTokenListImpl { - constructor(globalObject, args, privateData) { - this._globalObject = globalObject; - - // _syncWithElement() must always be called before any _tokenSet access. - this._tokenSet = new OrderedSet(); - this._element = privateData.element; - this._attributeLocalName = privateData.attributeLocalName; - this._supportedTokens = privateData.supportedTokens; - - // Needs synchronization with element if token set is to be accessed. - this._dirty = true; - } - - attrModified() { - this._dirty = true; - } - - _syncWithElement() { - if (!this._dirty) { - return; - } - - const val = getAttributeValue(this._element, this._attributeLocalName); - if (val === null) { - this._tokenSet.empty(); - } else { - this._tokenSet = OrderedSet.parse(val); - } - - this._dirty = false; - } - - _validationSteps(token) { - if (!this._supportedTokens) { - throw new TypeError(`${this._attributeLocalName} attribute has no supported tokens`); - } - const lowerToken = asciiLowercase(token); - return this._supportedTokens.has(lowerToken); - } - - _updateSteps() { - if (!hasAttributeByName(this._element, this._attributeLocalName) && this._tokenSet.isEmpty()) { - return; - } - setAttributeValue(this._element, this._attributeLocalName, this._tokenSet.serialize()); - } - - _serializeSteps() { - return getAttributeValue(this._element, this._attributeLocalName); - } - - // Used by other parts of jsdom - get tokenSet() { - this._syncWithElement(); - return this._tokenSet; - } - - get length() { - this._syncWithElement(); - return this._tokenSet.size; - } - - get [idlUtils.supportedPropertyIndices]() { - this._syncWithElement(); - return this._tokenSet.keys(); - } - - item(index) { - this._syncWithElement(); - if (index >= this._tokenSet.size) { - return null; - } - return this._tokenSet.get(index); - } - - contains(token) { - this._syncWithElement(); - return this._tokenSet.contains(token); - } - - add(...tokens) { - for (const token of tokens) { - validateTokens(this._globalObject, token); - } - this._syncWithElement(); - for (const token of tokens) { - this._tokenSet.append(token); - } - this._updateSteps(); - } - - remove(...tokens) { - for (const token of tokens) { - validateTokens(this._globalObject, token); - } - this._syncWithElement(); - this._tokenSet.remove(...tokens); - this._updateSteps(); - } - - toggle(token, force = undefined) { - validateTokens(this._globalObject, token); - this._syncWithElement(); - if (this._tokenSet.contains(token)) { - if (force === undefined || force === false) { - this._tokenSet.remove(token); - this._updateSteps(); - return false; - } - return true; - } - if (force === undefined || force === true) { - this._tokenSet.append(token); - this._updateSteps(); - return true; - } - return false; - } - - replace(token, newToken) { - validateTokens(this._globalObject, token, newToken); - this._syncWithElement(); - if (!this._tokenSet.contains(token)) { - return false; - } - this._tokenSet.replace(token, newToken); - this._updateSteps(); - return true; - } - - supports(token) { - return this._validationSteps(token); - } - - get value() { - return this._serializeSteps(); - } - - set value(V) { - setAttributeValue(this._element, this._attributeLocalName, V); - } -} - -exports.implementation = DOMTokenListImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js deleted file mode 100644 index a7b62b4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js +++ /dev/null @@ -1,1013 +0,0 @@ -"use strict"; - -const { CookieJar } = require("tough-cookie"); -const { DOMSelector } = require("@asamuzakjp/dom-selector"); - -const NodeImpl = require("./Node-impl").implementation; -const idlUtils = require("../generated/utils"); -const NODE_TYPE = require("../node-type"); -const { mixin, memoizeQuery } = require("../../utils"); -const { firstChildWithLocalName, firstChildWithLocalNames, firstDescendantWithLocalName } = - require("../helpers/traversal"); -const whatwgURL = require("whatwg-url"); -const StyleSheetList = require("../generated/StyleSheetList.js"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const eventAccessors = require("../helpers/create-event-accessor"); -const { asciiLowercase, stripAndCollapseASCIIWhitespace } = require("../helpers/strings"); -const { childTextContent } = require("../helpers/text"); -const { HTML_NS, SVG_NS } = require("../helpers/namespaces"); -const DOMException = require("../generated/DOMException"); -const { parseIntoDocument } = require("../../browser/parser"); -const History = require("../generated/History"); -const Location = require("../generated/Location"); -const HTMLCollection = require("../generated/HTMLCollection"); -const NodeList = require("../generated/NodeList"); -const validateName = require("../helpers/validate-names").name; -const { validateAndExtract } = require("../helpers/validate-names"); -const { fireAnEvent } = require("../helpers/events"); -const { shadowIncludingInclusiveDescendantsIterator } = require("../helpers/shadow-dom"); -const { enqueueCECallbackReaction } = require("../helpers/custom-elements"); -const { createElement, internalCreateElementNSSteps } = require("../helpers/create-element"); -const IterableWeakSet = require("../helpers/iterable-weak-set"); - -const DocumentOrShadowRootImpl = require("./DocumentOrShadowRoot-impl").implementation; -const GlobalEventHandlersImpl = require("./GlobalEventHandlers-impl").implementation; -const NonElementParentNodeImpl = require("./NonElementParentNode-impl").implementation; -const ParentNodeImpl = require("./ParentNode-impl").implementation; - -const { clone, listOfElementsWithQualifiedName, listOfElementsWithNamespaceAndLocalName, - listOfElementsWithClassNames } = require("../node"); -const generatedAttr = require("../generated/Attr"); -const Comment = require("../generated/Comment"); -const ProcessingInstruction = require("../generated/ProcessingInstruction"); -const CDATASection = require("../generated/CDATASection"); -const Text = require("../generated/Text"); -const DocumentFragment = require("../generated/DocumentFragment"); -const DOMImplementation = require("../generated/DOMImplementation"); -const TreeWalker = require("../generated/TreeWalker"); -const NodeIterator = require("../generated/NodeIterator"); -const ShadowRoot = require("../generated/ShadowRoot"); -const Range = require("../generated/Range"); -const documents = require("../documents.js"); - -const BeforeUnloadEvent = require("../generated/BeforeUnloadEvent"); -const CompositionEvent = require("../generated/CompositionEvent"); -const CustomEvent = require("../generated/CustomEvent"); -const DeviceMotionEvent = require("../generated/DeviceMotionEvent"); -const DeviceOrientationEvent = require("../generated/DeviceOrientationEvent"); -const Event = require("../generated/Event"); -const FocusEvent = require("../generated/FocusEvent"); -const HashChangeEvent = require("../generated/HashChangeEvent"); -const KeyboardEvent = require("../generated/KeyboardEvent"); -const MessageEvent = require("../generated/MessageEvent"); -const MouseEvent = require("../generated/MouseEvent"); -const StorageEvent = require("../generated/StorageEvent"); -const TouchEvent = require("../generated/TouchEvent"); -const UIEvent = require("../generated/UIEvent"); - -const RequestManager = require("../../browser/resources/request-manager"); -const AsyncResourceQueue = require("../../browser/resources/async-resource-queue"); -const ResourceQueue = require("../../browser/resources/resource-queue"); -const PerDocumentResourceLoader = require("../../browser/resources/per-document-resource-loader"); - -function clearChildNodes(node) { - for (let child = domSymbolTree.firstChild(node); child; child = domSymbolTree.firstChild(node)) { - node.removeChild(child); - } -} - -function pad(number) { - if (number < 10) { - return "0" + number; - } - return number; -} - -function toLastModifiedString(date) { - return pad(date.getMonth() + 1) + - "/" + pad(date.getDate()) + - "/" + date.getFullYear() + - " " + pad(date.getHours()) + - ":" + pad(date.getMinutes()) + - ":" + pad(date.getSeconds()); -} - -const eventInterfaceTable = { - beforeunloadevent: BeforeUnloadEvent, - compositionevent: CompositionEvent, - customevent: CustomEvent, - devicemotionevent: DeviceMotionEvent, - deviceorientationevent: DeviceOrientationEvent, - event: Event, - events: Event, - focusevent: FocusEvent, - hashchangeevent: HashChangeEvent, - htmlevents: Event, - keyboardevent: KeyboardEvent, - messageevent: MessageEvent, - mouseevent: MouseEvent, - mouseevents: MouseEvent, - storageevent: StorageEvent, - svgevents: Event, - touchevent: TouchEvent, - uievent: UIEvent, - uievents: UIEvent -}; - -class DocumentImpl extends NodeImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._initGlobalEvents(); - - this._ownerDocument = this; - this.nodeType = NODE_TYPE.DOCUMENT_NODE; - if (!privateData.options) { - privateData.options = {}; - } - if (!privateData.options.parsingMode) { - privateData.options.parsingMode = "xml"; - } - if (!privateData.options.encoding) { - privateData.options.encoding = "UTF-8"; - } - if (!privateData.options.contentType) { - privateData.options.contentType = privateData.options.parsingMode === "xml" ? "application/xml" : "text/html"; - } - - this._parsingMode = privateData.options.parsingMode; - - this._implementation = DOMImplementation.createImpl(this._globalObject, [], { - ownerDocument: this - }); - - this._defaultView = privateData.options.defaultView || null; - this._global = privateData.options.global; - this._ids = Object.create(null); - this._attached = true; - this._currentScript = null; - this._pageShowingFlag = false; - this._cookieJar = privateData.options.cookieJar; - this._parseOptions = privateData.options.parseOptions || {}; - this._scriptingDisabled = privateData.options.scriptingDisabled; - if (this._cookieJar === undefined) { - this._cookieJar = new CookieJar(null, { looseMode: true }); - } - - if (this._scriptingDisabled) { - this._parseOptions.scriptingEnabled = false; - } - - this.contentType = privateData.options.contentType; - this._encoding = privateData.options.encoding; - - const urlOption = privateData.options.url === undefined ? "about:blank" : privateData.options.url; - const parsed = whatwgURL.parseURL(urlOption); - if (parsed === null) { - throw new TypeError(`Could not parse "${urlOption}" as a URL`); - } - - this._URL = parsed; - this._origin = urlOption === "about:blank" && privateData.options.parentOrigin ? - privateData.options.parentOrigin : - whatwgURL.serializeURLOrigin(this._URL); - - this._location = Location.createImpl(this._globalObject, [], { relevantDocument: this }); - this._history = History.createImpl(this._globalObject, [], { - window: this._defaultView, - document: this, - actAsIfLocationReloadCalled: () => this._location.reload() - }); - - this._workingNodeIterators = new IterableWeakSet(); - - this._referrer = privateData.options.referrer || ""; - this._lastModified = toLastModifiedString(privateData.options.lastModified || new Date()); - this._asyncQueue = new AsyncResourceQueue(); - this._queue = new ResourceQueue({ asyncQueue: this._asyncQueue, paused: false }); - this._deferQueue = new ResourceQueue({ paused: true }); - this._requestManager = new RequestManager(); - this._currentDocumentReadiness = privateData.options.readyState || "loading"; - - this._lastFocusedElement = null; - - this._resourceLoader = new PerDocumentResourceLoader(this); - - // Each Document in a browsing context can also have a latest entry. This is the entry for that Document - // to which the browsing context's session history was most recently traversed. When a Document is created, - // it initially has no latest entry. - this._latestEntry = null; - - // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#throw-on-dynamic-markup-insertion-counter - this._throwOnDynamicMarkupInsertionCounter = 0; - - // Create DOMSelector instance - this._domSelector = new DOMSelector(this._globalObject, this._ownerDocument, { - domSymbolTree, - idlUtils - }); - - // Cache of computed element styles - this._styleCache = null; - - // Cache of document base URL - this._baseURLCache = null; - this._baseURLSerializedCache = null; - } - - _clearBaseURLCache() { - this._baseURLCache = null; - this._baseURLSerializedCache = null; - } - - // https://html.spec.whatwg.org/multipage/infrastructure.html#document-base-url - baseURL() { - if (this._baseURLCache) { - return this._baseURLCache; - } - - const firstBase = this.querySelector("base[href]"); - - this._baseURLCache = firstBase === null ? - this._fallbackBaseURL() : - this._frozenBaseURL(firstBase, this._fallbackBaseURL()); - return this._baseURLCache; - } - - baseURLSerialized() { - if (this._baseURLSerializedCache) { - return this._baseURLSerializedCache; - } - - const result = whatwgURL.serializeURL(this.baseURL()); - this._baseURLSerializedCache = result; - return result; - } - - // https://html.spec.whatwg.org/#encoding-parsing-a-url - encodingParseAURL(url) { - return whatwgURL.parseURL(url, { baseURL: this.baseURL(), encoding: this._encoding }); - } - - // https://html.spec.whatwg.org/#frozen-base-url - _frozenBaseURL(baseElement, fallbackBaseURL) { - // The spec is eager (setting the frozen base URL when things change); we are lazy (getting it when we need to). - // - // There is a slight difference, which is when history.pushState() is involved. The frozen base URL does not get - // updated in response to history.pushState() per spec, but since we're lazy, it will get updated. - // - // The test in to-port-to-wpts/history.js checks for the current jsdom behavior (which is incorrect). - // We could make it pass by not invalidating the base URL cache, actually. But that would just make the fallback - // base URL case use the stale base URL. - // - // TODO: implement, with tests for all code paths, the spec's behavior. - - const baseHrefAttribute = baseElement.getAttributeNS(null, "href"); - const result = whatwgURL.parseURL(baseHrefAttribute, { baseURL: fallbackBaseURL }); - return result === null ? fallbackBaseURL : result; - } - - // https://html.spec.whatwg.org/#fallback-base-url - _fallbackBaseURL() { - if (this.URL === "about:blank" && this._defaultView && - this._defaultView._parent !== this._defaultView) { - const parentDocument = idlUtils.implForWrapper(this._defaultView._parent._document); - return parentDocument.baseURL(); - } - - return this._URL; - } - - _getTheParent(event) { - if (event.type === "load" || !this._defaultView) { - return null; - } - - return idlUtils.implForWrapper(this._defaultView); - } - - get compatMode() { - return this._parsingMode === "xml" || this.doctype ? "CSS1Compat" : "BackCompat"; - } - get charset() { - return this._encoding; - } - get characterSet() { - return this._encoding; - } - get inputEncoding() { - return this._encoding; - } - get doctype() { - for (const childNode of domSymbolTree.childrenIterator(this)) { - if (childNode.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE) { - return childNode; - } - } - return null; - } - get URL() { - return whatwgURL.serializeURL(this._URL); - } - get documentURI() { - return whatwgURL.serializeURL(this._URL); - } - get location() { - return this._defaultView ? this._location : null; - } - - // https://dom.spec.whatwg.org/#dom-document-documentelement - get documentElement() { - for (const childNode of domSymbolTree.childrenIterator(this)) { - if (childNode.nodeType === NODE_TYPE.ELEMENT_NODE) { - return childNode; - } - } - - return null; - } - - get implementation() { - return this._implementation; - } - set implementation(implementation) { - this._implementation = implementation; - } - - get defaultView() { - return this._defaultView; - } - - get currentScript() { - return this._currentScript; - } - - get readyState() { - return this._currentDocumentReadiness; - } - - set readyState(state) { - this._currentDocumentReadiness = state; - fireAnEvent("readystatechange", this); - } - - hasFocus() { - return Boolean(this._lastFocusedElement); - } - - _descendantRemoved(parent, child) { - if (child.tagName === "STYLE") { - this.styleSheets._remove(child.sheet); - } - - super._descendantRemoved(parent, child); - } - - write(...args) { - let text = ""; - for (let i = 0; i < args.length; ++i) { - text += args[i]; - } - - if (this._parsingMode === "xml") { - throw DOMException.create(this._globalObject, [ - "Cannot use document.write on XML documents", - "InvalidStateError" - ]); - } - - if (this._throwOnDynamicMarkupInsertionCounter > 0) { - throw DOMException.create(this._globalObject, [ - "Cannot use document.write while a custom element upgrades", - "InvalidStateError" - ]); - } - - if (this._writeAfterElement) { - // If called from an script element directly (during the first tick), - // the new elements are inserted right after that element. - const tempDiv = this.createElement("div"); - tempDiv.innerHTML = text; - - let child = tempDiv.firstChild; - let previous = this._writeAfterElement; - const parent = this._writeAfterElement.parentNode; - - while (child) { - const node = child; - child = child.nextSibling; - - node._isMovingDueToDocumentWrite = true; // hack for script execution - parent.insertBefore(node, previous.nextSibling); - node._isMovingDueToDocumentWrite = false; - - previous = node; - } - } else if (this.readyState === "loading") { - // During page loading, document.write appends to the current element - // Find the last child that has been added to the document. - if (this.lastChild) { - let node = this; - while (node.lastChild && node.lastChild.nodeType === NODE_TYPE.ELEMENT_NODE) { - node = node.lastChild; - } - node.innerHTML = text; - } else { - clearChildNodes(this); - parseIntoDocument(text, this); - } - } else if (text) { - clearChildNodes(this); - parseIntoDocument(text, this); - } - } - - writeln(...args) { - this.write(...args, "\n"); - } - - // This is implemented separately for Document (which has a _ids cache) and DocumentFragment (which does not). - getElementById(id) { - if (!this._ids[id]) { - return null; - } - - // Let's find the first element with where it's root is the document. - const matchElement = this._ids[id].find(candidate => { - let root = candidate; - while (domSymbolTree.parent(root)) { - root = domSymbolTree.parent(root); - } - - return root === this; - }); - - return matchElement || null; - } - - get referrer() { - return this._referrer || ""; - } - get lastModified() { - return this._lastModified; - } - get images() { - return this.getElementsByTagName("IMG"); - } - get embeds() { - return this.getElementsByTagName("EMBED"); - } - get plugins() { - return this.embeds; - } - get links() { - return HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => domSymbolTree.treeToArray(this, { - filter: node => (node._localName === "a" || node._localName === "area") && - node.hasAttributeNS(null, "href") && - node._namespaceURI === HTML_NS - }) - }); - } - get forms() { - return this.getElementsByTagName("FORM"); - } - get scripts() { - return this.getElementsByTagName("SCRIPT"); - } - get anchors() { - return HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => domSymbolTree.treeToArray(this, { - filter: node => node._localName === "a" && - node.hasAttributeNS(null, "name") && - node._namespaceURI === HTML_NS - }) - }); - } - - // The applets attribute must return an - // HTMLCollection rooted at the Document node, - // whose filter matches nothing. - // (It exists for historical reasons.) - get applets() { - return HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => [] - }); - } - - open() { - let child = domSymbolTree.firstChild(this); - while (child) { - this.removeChild(child); - child = domSymbolTree.firstChild(this); - } - this._modified(); - return this; - } - close(noQueue) { - // In some cases like when creating an empty iframe, I want to emit the - // events right away to avoid problems if later I asign the property src. - if (noQueue) { - this.readyState = "complete"; - - fireAnEvent("DOMContentLoaded", this, undefined, { bubbles: true }); - fireAnEvent("load", this); - - return; - } - this._queue.resume(); - - const dummyPromise = Promise.resolve(); - - const onDOMContentLoad = () => { - const doc = this; - function dispatchEvent() { - // https://html.spec.whatwg.org/#the-end - doc.readyState = "interactive"; - fireAnEvent("DOMContentLoaded", doc, undefined, { bubbles: true }); - } - - return new Promise(resolve => { - if (!this._deferQueue.tail) { - dispatchEvent(); - resolve(); - return; - } - - this._deferQueue.setListener(() => { - dispatchEvent(); - resolve(); - }); - - this._deferQueue.resume(); - }); - }; - - const onLoad = () => { - const doc = this; - function dispatchEvent() { - doc.readyState = "complete"; - fireAnEvent("load", doc); - } - - return new Promise(resolve => { - if (this._asyncQueue.count() === 0) { - dispatchEvent(); - resolve(); - return; - } - - this._asyncQueue.setListener(() => { - dispatchEvent(); - resolve(); - }); - }); - }; - - this._queue.push(dummyPromise, onDOMContentLoad, null); - // Set the readyState to 'complete' once all resources are loaded. - // As a side-effect the document's load-event will be dispatched. - this._queue.push(dummyPromise, onLoad, null, true); - } - - getElementsByName(elementName) { - return NodeList.createImpl(this._globalObject, [], { - element: this, - query: () => domSymbolTree.treeToArray(this, { - filter: node => node.getAttributeNS && node.getAttributeNS(null, "name") === elementName - }) - }); - } - - get title() { - const { documentElement } = this; - let value = ""; - - if (documentElement && documentElement._localName === "svg") { - const svgTitleElement = firstChildWithLocalName(documentElement, "title", SVG_NS); - - if (svgTitleElement) { - value = childTextContent(svgTitleElement); - } - } else { - const titleElement = firstDescendantWithLocalName(this, "title"); - - if (titleElement) { - value = childTextContent(titleElement); - } - } - - value = stripAndCollapseASCIIWhitespace(value); - - return value; - } - - set title(value) { - const { documentElement } = this; - let element; - - if (documentElement && documentElement._localName === "svg") { - element = firstChildWithLocalName(documentElement, "title", SVG_NS); - - if (!element) { - element = this.createElementNS(SVG_NS, "title"); - - this._insert(element, documentElement.firstChild); - } - - element.textContent = value; - } else if (documentElement && documentElement._namespaceURI === HTML_NS) { - const titleElement = firstDescendantWithLocalName(this, "title"); - const headElement = this.head; - - if (titleElement === null && headElement === null) { - return; - } - - if (titleElement !== null) { - element = titleElement; - } else { - element = this.createElement("title"); - headElement._append(element); - } - - element.textContent = value; - } - } - - get dir() { - return this.documentElement ? this.documentElement.dir : ""; - } - set dir(value) { - if (this.documentElement) { - this.documentElement.dir = value; - } - } - - get head() { - return this.documentElement ? firstChildWithLocalName(this.documentElement, "head") : null; - } - - get body() { - const { documentElement } = this; - if (!documentElement || documentElement._localName !== "html" || - documentElement._namespaceURI !== HTML_NS) { - return null; - } - - return firstChildWithLocalNames(this.documentElement, new Set(["body", "frameset"])); - } - - set body(value) { - if (value === null || - value._namespaceURI !== HTML_NS || - (value._localName !== "body" && value._localName !== "frameset")) { - throw DOMException.create(this._globalObject, [ - "Cannot set the body to null or a non-body/frameset element", - "HierarchyRequestError" - ]); - } - - const bodyElement = this.body; - if (value === bodyElement) { - return; - } - - if (bodyElement !== null) { - bodyElement.parentNode._replace(value, bodyElement); - return; - } - - const { documentElement } = this; - if (documentElement === null) { - throw DOMException.create(this._globalObject, [ - "Cannot set the body when there is no document element", - "HierarchyRequestError" - ]); - } - - documentElement._append(value); - } - - _runPreRemovingSteps(oldNode) { - // https://html.spec.whatwg.org/#focus-fixup-rule - if (oldNode === this.activeElement) { - this._lastFocusedElement = this.body; - } - for (const activeNodeIterator of this._workingNodeIterators) { - activeNodeIterator._preRemovingSteps(oldNode); - } - } - - createEvent(type) { - const typeLower = type.toLowerCase(); - const eventWrapper = eventInterfaceTable[typeLower] || null; - - if (!eventWrapper) { - throw DOMException.create(this._globalObject, [ - "The provided event type (\"" + type + "\") is invalid", - "NotSupportedError" - ]); - } - - const impl = eventWrapper.createImpl(this._globalObject, [""]); - impl._initializedFlag = false; - return impl; - } - - createRange() { - return Range.createImpl(this._globalObject, [], { - start: { node: this, offset: 0 }, - end: { node: this, offset: 0 } - }); - } - - createProcessingInstruction(target, data) { - validateName(this._globalObject, target); - - if (data.includes("?>")) { - throw DOMException.create(this._globalObject, [ - "Processing instruction data cannot contain the string \"?>\"", - "InvalidCharacterError" - ]); - } - - return ProcessingInstruction.createImpl(this._globalObject, [], { - ownerDocument: this, - target, - data - }); - } - - // https://dom.spec.whatwg.org/#dom-document-createcdatasection - createCDATASection(data) { - if (this._parsingMode === "html") { - throw DOMException.create(this._globalObject, [ - "Cannot create CDATA sections in HTML documents", - "NotSupportedError" - ]); - } - - if (data.includes("]]>")) { - throw DOMException.create(this._globalObject, [ - "CDATA section data cannot contain the string \"]]>\"", - "InvalidCharacterError" - ]); - } - - return CDATASection.createImpl(this._globalObject, [], { - ownerDocument: this, - data - }); - } - - createTextNode(data) { - return Text.createImpl(this._globalObject, [], { - ownerDocument: this, - data - }); - } - - createComment(data) { - return Comment.createImpl(this._globalObject, [], { - ownerDocument: this, - data - }); - } - - // https://dom.spec.whatwg.org/#dom-document-createelement - createElement(localName, options) { - validateName(this._globalObject, localName); - - if (this._parsingMode === "html") { - localName = asciiLowercase(localName); - } - - let isValue = null; - if (options && options.is !== undefined) { - isValue = options.is; - } - - const namespace = this._parsingMode === "html" || this.contentType === "application/xhtml+xml" ? HTML_NS : null; - - return createElement(this, localName, namespace, null, isValue, true); - } - - // https://dom.spec.whatwg.org/#dom-document-createelementns - createElementNS(namespace, qualifiedName, options) { - return internalCreateElementNSSteps(this, namespace, qualifiedName, options); - } - - createDocumentFragment() { - return DocumentFragment.createImpl(this._globalObject, [], { ownerDocument: this }); - } - - createAttribute(localName) { - validateName(this._globalObject, localName); - - if (this._parsingMode === "html") { - localName = asciiLowercase(localName); - } - - return this._createAttribute({ localName }); - } - - createAttributeNS(namespace, name) { - if (namespace === undefined) { - namespace = null; - } - namespace = namespace !== null ? String(namespace) : namespace; - - const extracted = validateAndExtract(this._globalObject, namespace, name); - return this._createAttribute({ - namespace: extracted.namespace, - namespacePrefix: extracted.prefix, - localName: extracted.localName - }); - } - - // Using this helper function rather than directly calling generatedAttr.createImpl may be preferred in some files, - // to avoid introducing a potentially cyclic dependency on generated/Attr.js. - _createAttribute({ - localName, - value, - namespace, - namespacePrefix - }) { - return generatedAttr.createImpl(this._globalObject, [], { - localName, - value, - namespace, - namespacePrefix, - ownerDocument: this - }); - } - - createTreeWalker(root, whatToShow, filter) { - return TreeWalker.createImpl(this._globalObject, [], { root, whatToShow, filter }); - } - - createNodeIterator(root, whatToShow, filter) { - const nodeIterator = NodeIterator.createImpl(this._globalObject, [], { root, whatToShow, filter }); - this._workingNodeIterators.add(nodeIterator); - return nodeIterator; - } - - importNode(node, deep) { - if (node.nodeType === NODE_TYPE.DOCUMENT_NODE) { - throw DOMException.create(this._globalObject, [ - "Cannot import a document node", - "NotSupportedError" - ]); - } else if (ShadowRoot.isImpl(node)) { - throw DOMException.create(this._globalObject, [ - "Cannot adopt a shadow root", - "NotSupportedError" - ]); - } - - return clone(node, this, deep); - } - - // https://dom.spec.whatwg.org/#dom-document-adoptnode - adoptNode(node) { - if (node.nodeType === NODE_TYPE.DOCUMENT_NODE) { - throw DOMException.create(this._globalObject, [ - "Cannot adopt a document node", - "NotSupportedError" - ]); - } else if (ShadowRoot.isImpl(node)) { - throw DOMException.create(this._globalObject, [ - "Cannot adopt a shadow root", - "HierarchyRequestError" - ]); - } - - this._adoptNode(node); - - return node; - } - - // https://dom.spec.whatwg.org/#concept-node-adopt - _adoptNode(node) { - const newDocument = this; - const oldDocument = node._ownerDocument; - - const parent = domSymbolTree.parent(node); - if (parent) { - parent._remove(node); - } - - if (oldDocument !== newDocument) { - for (const inclusiveDescendant of shadowIncludingInclusiveDescendantsIterator(node)) { - inclusiveDescendant._ownerDocument = newDocument; - } - - for (const inclusiveDescendant of shadowIncludingInclusiveDescendantsIterator(node)) { - if (inclusiveDescendant._ceState === "custom") { - enqueueCECallbackReaction(inclusiveDescendant, "adoptedCallback", [ - idlUtils.wrapperForImpl(oldDocument), - idlUtils.wrapperForImpl(newDocument) - ]); - } - } - - for (const inclusiveDescendant of shadowIncludingInclusiveDescendantsIterator(node)) { - if (inclusiveDescendant._adoptingSteps) { - inclusiveDescendant._adoptingSteps(oldDocument); - } - } - } - } - - get cookie() { - return this._cookieJar.getCookieStringSync(this.URL, { http: false }); - } - set cookie(cookieStr) { - cookieStr = String(cookieStr); - this._cookieJar.setCookieSync(cookieStr, this.URL, { - http: false, - ignoreError: true - }); - } - - // The clear(), captureEvents(), and releaseEvents() methods must do nothing - clear() {} - - captureEvents() {} - - releaseEvents() {} - - get styleSheets() { - if (!this._styleSheets) { - this._styleSheets = StyleSheetList.createImpl(this._globalObject); - } - - // TODO: each style and link element should register its sheet on creation - // and remove it on removal. - return this._styleSheets; - } - - get hidden() { - if (this._defaultView && this._defaultView._pretendToBeVisual) { - return false; - } - - return true; - } - - get visibilityState() { - if (this._defaultView && this._defaultView._pretendToBeVisual) { - return "visible"; - } - - return "prerender"; - } - - // https://w3c.github.io/selection-api/#extensions-to-document-interface - getSelection() { - return this._defaultView ? this._defaultView._selection : null; - } - - // Needed to ensure that the resulting document has the correct prototype chain: - // https://dom.spec.whatwg.org/#concept-node-clone says "that implements the same interfaces as node". - _cloneDocument() { - const copy = documents.createImpl( - this._globalObject, - { - contentType: this.contentType, - encoding: this._encoding, - parsingMode: this._parsingMode - } - ); - - copy._URL = this._URL; - copy._origin = this._origin; - return copy; - } -} - -eventAccessors.createEventAccessor(DocumentImpl.prototype, "readystatechange"); -mixin(DocumentImpl.prototype, DocumentOrShadowRootImpl.prototype); -mixin(DocumentImpl.prototype, GlobalEventHandlersImpl.prototype); -mixin(DocumentImpl.prototype, NonElementParentNodeImpl.prototype); -mixin(DocumentImpl.prototype, ParentNodeImpl.prototype); - -DocumentImpl.prototype.getElementsByTagName = memoizeQuery(function (qualifiedName) { - return listOfElementsWithQualifiedName(qualifiedName, this); -}); - -DocumentImpl.prototype.getElementsByTagNameNS = memoizeQuery(function (namespace, localName) { - return listOfElementsWithNamespaceAndLocalName(namespace, localName, this); -}); - -DocumentImpl.prototype.getElementsByClassName = memoizeQuery(function getElementsByClassName(classNames) { - return listOfElementsWithClassNames(classNames, this); -}); - -module.exports = { - implementation: DocumentImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DocumentFragment-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DocumentFragment-impl.js deleted file mode 100644 index a2a3870..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DocumentFragment-impl.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -const { mixin } = require("../../utils"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const NODE_TYPE = require("../node-type"); -const NodeImpl = require("./Node-impl").implementation; -const NonElementParentNodeImpl = require("./NonElementParentNode-impl").implementation; -const ParentNodeImpl = require("./ParentNode-impl").implementation; -const idlUtils = require("../generated/utils"); - -class DocumentFragmentImpl extends NodeImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, { - ownerDocument: idlUtils.implForWrapper(globalObject._document), - ...privateData - }); - - const { host } = privateData; - this._host = host; - - this.nodeType = NODE_TYPE.DOCUMENT_FRAGMENT_NODE; - } - - // This is implemented separately for Document (which has a _ids cache) and DocumentFragment (which does not). - getElementById(id) { - if (id === "") { - return null; - } - - for (const descendant of domSymbolTree.treeIterator(this)) { - if (descendant.nodeType === NODE_TYPE.ELEMENT_NODE && descendant.getAttributeNS(null, "id") === id) { - return descendant; - } - } - - return null; - } -} - -mixin(DocumentFragmentImpl.prototype, NonElementParentNodeImpl.prototype); -mixin(DocumentFragmentImpl.prototype, ParentNodeImpl.prototype); - -module.exports = { - implementation: DocumentFragmentImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DocumentOrShadowRoot-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DocumentOrShadowRoot-impl.js deleted file mode 100644 index 4f85495..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DocumentOrShadowRoot-impl.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -const NODE_TYPE = require("../node-type"); -const { nodeRoot } = require("../helpers/node"); -const { retarget } = require("../helpers/shadow-dom"); - -class DocumentOrShadowRootImpl { - get activeElement() { - let candidate = this._ownerDocument._lastFocusedElement || this._ownerDocument.body; - if (!candidate) { - return null; - } - candidate = retarget(candidate, this); - if (nodeRoot(candidate) !== this) { - return null; - } - if (candidate.nodeType !== NODE_TYPE.DOCUMENT_NODE) { - return candidate; - } - if (candidate.body !== null) { - return candidate.body; - } - return candidate.documentElement; - } -} - -module.exports = { - implementation: DocumentOrShadowRootImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DocumentType-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DocumentType-impl.js deleted file mode 100644 index 77767be..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/DocumentType-impl.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -const { mixin } = require("../../utils"); -const NodeImpl = require("./Node-impl").implementation; -const ChildNodeImpl = require("./ChildNode-impl").implementation; - -const NODE_TYPE = require("../node-type"); - -class DocumentTypeImpl extends NodeImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this.nodeType = NODE_TYPE.DOCUMENT_TYPE_NODE; - - this.name = privateData.name; - this.publicId = privateData.publicId; - this.systemId = privateData.systemId; - } -} - -mixin(DocumentTypeImpl.prototype, ChildNodeImpl.prototype); - -module.exports = { - implementation: DocumentTypeImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js deleted file mode 100644 index 401a2af..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js +++ /dev/null @@ -1,606 +0,0 @@ -"use strict"; -const { HTML_NS } = require("../helpers/namespaces"); -const { mixin, memoizeQuery } = require("../../utils"); -const NodeImpl = require("./Node-impl").implementation; -const ParentNodeImpl = require("./ParentNode-impl").implementation; -const ChildNodeImpl = require("./ChildNode-impl").implementation; -const attributes = require("../attributes"); -const windowProperties = require("../window-properties"); -const NODE_TYPE = require("../node-type"); -const { parseFragment } = require("../../browser/parser"); -const InnerHTMLImpl = require("../domparsing/InnerHTML-impl").implementation; -const { fragmentSerialization } = require("../domparsing/serialization"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const DOMException = require("../generated/DOMException"); -const DOMTokenList = require("../generated/DOMTokenList"); -const NamedNodeMap = require("../generated/NamedNodeMap"); -const validateNames = require("../helpers/validate-names"); -const { asciiLowercase, asciiUppercase } = require("../helpers/strings"); -const { listOfElementsWithQualifiedName, listOfElementsWithNamespaceAndLocalName, - listOfElementsWithClassNames } = require("../node"); -const SlotableMixinImpl = require("./Slotable-impl").implementation; -const NonDocumentTypeChildNode = require("./NonDocumentTypeChildNode-impl").implementation; -const ShadowRoot = require("../generated/ShadowRoot"); -const Text = require("../generated/Text"); -const { isValidHostElementName } = require("../helpers/shadow-dom"); -const { isValidCustomElementName, lookupCEDefinition } = require("../helpers/custom-elements"); - -function attachId(id, elm, doc) { - if (id && elm && doc) { - if (!doc._ids[id]) { - doc._ids[id] = []; - } - doc._ids[id].push(elm); - } -} - -function detachId(id, elm, doc) { - if (id && elm && doc) { - if (doc._ids && doc._ids[id]) { - const elms = doc._ids[id]; - for (let i = 0; i < elms.length; i++) { - if (elms[i] === elm) { - elms.splice(i, 1); - --i; - } - } - if (elms.length === 0) { - delete doc._ids[id]; - } - } - } -} - -class ElementImpl extends NodeImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._initSlotableMixin(); - - this._namespaceURI = privateData.namespace; - this._prefix = privateData.prefix; - this._localName = privateData.localName; - this._ceState = privateData.ceState; - this._ceDefinition = privateData.ceDefinition; - this._isValue = privateData.isValue; - - this._shadowRoot = null; - this._ceReactionQueue = []; - - this.nodeType = NODE_TYPE.ELEMENT_NODE; - this.scrollTop = 0; - this.scrollLeft = 0; - - this._attributeList = []; - // Used for caching. - this._attributesByNameMap = new Map(); - this._attributes = null; - - this._cachedTagName = null; - } - - _attach() { - windowProperties.elementAttached(this); - - const id = this.getAttributeNS(null, "id"); - if (id) { - attachId(id, this, this._ownerDocument); - } - - // If the element is initially in an HTML document but is later - // inserted in another type of document, the tagName should no - // longer be uppercase. Therefore the cached tagName is reset. - this._cachedTagName = null; - super._attach(); - } - - _detach() { - super._detach(); - - windowProperties.elementDetached(this); - - const id = this.getAttributeNS(null, "id"); - if (id) { - detachId(id, this, this._ownerDocument); - } - } - - _attrModified(name, value, oldValue) { - this._modified(); - - windowProperties.elementAttributeModified(this, name, value, oldValue); - - if (name === "id" && this._attached) { - const doc = this._ownerDocument; - detachId(oldValue, this, doc); - attachId(value, this, doc); - } - - // update classList - if (name === "class" && this._classList !== undefined) { - this._classList.attrModified(); - } - - // clear domSelector cached results on attribute change - this._ownerDocument._domSelector.clear(); - - this._attrModifiedSlotableMixin(name, value, oldValue); - } - - get namespaceURI() { - return this._namespaceURI; - } - get prefix() { - return this._prefix; - } - get localName() { - return this._localName; - } - get _qualifiedName() { - return this._prefix !== null ? this._prefix + ":" + this._localName : this._localName; - } - get tagName() { - // This getter can be a hotpath in getComputedStyle. - // All these are invariants during the instance lifetime so we can safely cache the computed tagName. - // We could create it during construction but since we already identified this as potentially slow we do it lazily. - if (this._cachedTagName === null) { - if (this._namespaceURI === HTML_NS && this._ownerDocument._parsingMode === "html") { - this._cachedTagName = asciiUppercase(this._qualifiedName); - } else { - this._cachedTagName = this._qualifiedName; - } - } - return this._cachedTagName; - } - - get attributes() { - if (!this._attributes) { - this._attributes = NamedNodeMap.createImpl(this._globalObject, [], { - element: this - }); - } - - return this._attributes; - } - - // https://w3c.github.io/DOM-Parsing/#dom-element-outerhtml - get outerHTML() { - return fragmentSerialization(this, { - outer: true, - requireWellFormed: true, - globalObject: this._globalObject - }); - } - set outerHTML(markup) { - let parent = domSymbolTree.parent(this); - const document = this._ownerDocument; - - if (!parent) { - return; - } - - if (parent.nodeType === NODE_TYPE.DOCUMENT_NODE) { - throw DOMException.create(this._globalObject, [ - "Modifications are not allowed for this document", - "NoModificationAllowedError" - ]); - } - - if (parent.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE) { - parent = document.createElementNS(HTML_NS, "body"); - } - - const fragment = parseFragment(markup, parent); - - const contextObjectParent = domSymbolTree.parent(this); - contextObjectParent._replace(fragment, this); - } - - get classList() { - if (this._classList === undefined) { - this._classList = DOMTokenList.createImpl(this._globalObject, [], { - element: this, - attributeLocalName: "class" - }); - } - return this._classList; - } - - hasAttributes() { - return attributes.hasAttributes(this); - } - - getAttributeNames() { - return attributes.attributeNames(this); - } - - getAttribute(name) { - const attr = attributes.getAttributeByName(this, name); - if (!attr) { - return null; - } - return attr._value; - } - - getAttributeNS(namespace, localName) { - const attr = attributes.getAttributeByNameNS(this, namespace, localName); - if (!attr) { - return null; - } - return attr._value; - } - - setAttribute(name, value) { - validateNames.name(this._globalObject, name); - - if (this._namespaceURI === HTML_NS && this._ownerDocument._parsingMode === "html") { - name = asciiLowercase(name); - } - - const attribute = attributes.getAttributeByName(this, name); - - if (attribute === null) { - const newAttr = this._ownerDocument._createAttribute({ - localName: name, - value - }); - attributes.appendAttribute(this, newAttr); - return; - } - - attributes.changeAttribute(this, attribute, value); - } - - setAttributeNS(namespace, name, value) { - const extracted = validateNames.validateAndExtract(this._globalObject, namespace, name); - - // Because of widespread use of this method internally, e.g. to manually implement attribute/content reflection, we - // centralize the conversion to a string here, so that all call sites don't have to do it. - value = `${value}`; - - attributes.setAttributeValue(this, extracted.localName, value, extracted.prefix, extracted.namespace); - } - - removeAttribute(name) { - attributes.removeAttributeByName(this, name); - } - - removeAttributeNS(namespace, localName) { - attributes.removeAttributeByNameNS(this, namespace, localName); - } - - toggleAttribute(qualifiedName, force) { - validateNames.name(this._globalObject, qualifiedName); - - if (this._namespaceURI === HTML_NS && this._ownerDocument._parsingMode === "html") { - qualifiedName = asciiLowercase(qualifiedName); - } - - const attribute = attributes.getAttributeByName(this, qualifiedName); - - if (attribute === null) { - if (force === undefined || force === true) { - const newAttr = this._ownerDocument._createAttribute({ - localName: qualifiedName, - value: "" - }); - attributes.appendAttribute(this, newAttr); - return true; - } - return false; - } - - if (force === undefined || force === false) { - attributes.removeAttributeByName(this, qualifiedName); - return false; - } - - return true; - } - - hasAttribute(name) { - if (this._namespaceURI === HTML_NS && this._ownerDocument._parsingMode === "html") { - name = asciiLowercase(name); - } - - return attributes.hasAttributeByName(this, name); - } - - hasAttributeNS(namespace, localName) { - if (namespace === "") { - namespace = null; - } - - return attributes.hasAttributeByNameNS(this, namespace, localName); - } - - getAttributeNode(name) { - return attributes.getAttributeByName(this, name); - } - - getAttributeNodeNS(namespace, localName) { - return attributes.getAttributeByNameNS(this, namespace, localName); - } - - setAttributeNode(attr) { - // eslint-disable-next-line no-restricted-properties - return attributes.setAttribute(this, attr); - } - - setAttributeNodeNS(attr) { - // eslint-disable-next-line no-restricted-properties - return attributes.setAttribute(this, attr); - } - - removeAttributeNode(attr) { - // eslint-disable-next-line no-restricted-properties - if (!attributes.hasAttribute(this, attr)) { - throw DOMException.create(this._globalObject, [ - "Tried to remove an attribute that was not present", - "NotFoundError" - ]); - } - - // eslint-disable-next-line no-restricted-properties - attributes.removeAttribute(this, attr); - - return attr; - } - - getBoundingClientRect() { - return { - x: 0, - y: 0, - bottom: 0, - height: 0, - left: 0, - right: 0, - top: 0, - width: 0 - }; - } - - getClientRects() { - return []; - } - - get scrollWidth() { - return 0; - } - - get scrollHeight() { - return 0; - } - - get clientTop() { - return 0; - } - - get clientLeft() { - return 0; - } - - get clientWidth() { - return 0; - } - - get clientHeight() { - return 0; - } - - // https://dom.spec.whatwg.org/#dom-element-attachshadow - attachShadow(init) { - const { _ownerDocument, _namespaceURI, _localName, _isValue } = this; - - if (this.namespaceURI !== HTML_NS) { - throw DOMException.create(this._globalObject, [ - "This element does not support attachShadow. This element is not part of the HTML namespace.", - "NotSupportedError" - ]); - } - - if (!isValidHostElementName(_localName) && !isValidCustomElementName(_localName)) { - const message = "This element does not support attachShadow. This element is not a custom element nor " + - "a standard element supporting a shadow root."; - throw DOMException.create(this._globalObject, [message, "NotSupportedError"]); - } - - if (isValidCustomElementName(_localName) || _isValue) { - const definition = lookupCEDefinition(_ownerDocument, _namespaceURI, _localName, _isValue); - - if (definition && definition.disableShadow) { - throw DOMException.create(this._globalObject, [ - "Shadow root cannot be create on a custom element with disabled shadow", - "NotSupportedError" - ]); - } - } - - if (this._shadowRoot !== null) { - throw DOMException.create(this._globalObject, [ - "Shadow root cannot be created on a host which already hosts a shadow tree.", - "NotSupportedError" - ]); - } - - const shadow = ShadowRoot.createImpl(this._globalObject, [], { - ownerDocument: this.ownerDocument, - mode: init.mode, - host: this - }); - - if (this._ceState === "precustomized" || this._ceState === "custom") { - shadow._availableToElementInternals = true; - } - - this._shadowRoot = shadow; - - return shadow; - } - - // https://dom.spec.whatwg.org/#dom-element-shadowroot - get shadowRoot() { - const shadow = this._shadowRoot; - - if (shadow === null || shadow.mode === "closed") { - return null; - } - - return shadow; - } - - // https://dom.spec.whatwg.org/#insert-adjacent - _insertAdjacent(element, where, node) { - where = asciiLowercase(where); - - if (where === "beforebegin") { - if (element.parentNode === null) { - return null; - } - return element.parentNode._preInsert(node, element); - } - if (where === "afterbegin") { - return element._preInsert(node, element.firstChild); - } - if (where === "beforeend") { - return element._preInsert(node, null); - } - if (where === "afterend") { - if (element.parentNode === null) { - return null; - } - return element.parentNode._preInsert(node, element.nextSibling); - } - - throw DOMException.create(this._globalObject, [ - 'Must provide one of "beforebegin", "afterbegin", "beforeend", or "afterend".', - "SyntaxError" - ]); - } - - insertAdjacentElement(where, element) { - return this._insertAdjacent(this, where, element); - } - - insertAdjacentText(where, data) { - const text = Text.createImpl(this._globalObject, [], { data, ownerDocument: this._ownerDocument }); - - this._insertAdjacent(this, where, text); - } - - // https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml - insertAdjacentHTML(position, text) { - position = asciiLowercase(position); - - let context; - switch (position) { - case "beforebegin": - case "afterend": { - context = this.parentNode; - if (context === null || context.nodeType === NODE_TYPE.DOCUMENT_NODE) { - throw DOMException.create(this._globalObject, [ - "Cannot insert HTML adjacent to parent-less nodes or children of document nodes.", - "NoModificationAllowedError" - ]); - } - break; - } - case "afterbegin": - case "beforeend": { - context = this; - break; - } - default: { - throw DOMException.create(this._globalObject, [ - 'Must provide one of "beforebegin", "afterbegin", "beforeend", or "afterend".', - "SyntaxError" - ]); - } - } - - if ( - context.nodeType !== NODE_TYPE.ELEMENT_NODE || - ( - context._ownerDocument._parsingMode === "html" && - context._localName === "html" && - context._namespaceURI === HTML_NS - ) - ) { - context = context._ownerDocument.createElement("body"); - } - - const fragment = parseFragment(text, context); - - switch (position) { - case "beforebegin": { - this.parentNode._insert(fragment, this); - break; - } - case "afterbegin": { - this._insert(fragment, this.firstChild); - break; - } - case "beforeend": { - this._append(fragment); - break; - } - case "afterend": { - this.parentNode._insert(fragment, this.nextSibling); - break; - } - } - } - - closest(selectors) { - const domSelector = this._ownerDocument._domSelector; - return domSelector.closest(selectors, this); - } - - matches(selectors) { - const domSelector = this._ownerDocument._domSelector; - return domSelector.matches(selectors, this); - } - - webkitMatchesSelector(selectors) { - return this.matches(selectors); - } - - // https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes - _reflectGetTheElement() { - return this; - } - - _reflectGetTheContentAttribute(reflectedContentAttributeName) { - return this.getAttributeNS(null, reflectedContentAttributeName); - } - - _reflectSetTheContentAttribute(reflectedContentAttributeName, value) { - this.setAttributeNS(null, reflectedContentAttributeName, value); - } - - _reflectDeleteTheContentAttribute(reflectedContentAttributeName) { - this.removeAttributeNS(null, reflectedContentAttributeName); - } -} - -mixin(ElementImpl.prototype, NonDocumentTypeChildNode.prototype); -mixin(ElementImpl.prototype, ParentNodeImpl.prototype); -mixin(ElementImpl.prototype, ChildNodeImpl.prototype); -mixin(ElementImpl.prototype, SlotableMixinImpl.prototype); -mixin(ElementImpl.prototype, InnerHTMLImpl.prototype); - -ElementImpl.prototype.getElementsByTagName = memoizeQuery(function (qualifiedName) { - return listOfElementsWithQualifiedName(qualifiedName, this); -}); - -ElementImpl.prototype.getElementsByTagNameNS = memoizeQuery(function (namespace, localName) { - return listOfElementsWithNamespaceAndLocalName(namespace, localName, this); -}); - -ElementImpl.prototype.getElementsByClassName = memoizeQuery(function (classNames) { - return listOfElementsWithClassNames(classNames, this); -}); - -module.exports = { - implementation: ElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ElementCSSInlineStyle-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ElementCSSInlineStyle-impl.js deleted file mode 100644 index b9dedb4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ElementCSSInlineStyle-impl.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -const cssstyle = require("cssstyle"); - -class ElementCSSInlineStyle { - _initElementCSSInlineStyle() { - this._settingCssText = false; - this._style = new cssstyle.CSSStyleDeclaration(newCssText => { - if (!this._settingCssText) { - this._settingCssText = true; - this.setAttributeNS(null, "style", newCssText); - this._settingCssText = false; - } - }); - } - get style() { - return this._style; - } -} - -module.exports = { - implementation: ElementCSSInlineStyle -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ElementContentEditable-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ElementContentEditable-impl.js deleted file mode 100644 index 8523c9c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ElementContentEditable-impl.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -class ElementContentEditableImpl { } - -module.exports = { - implementation: ElementContentEditableImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/GlobalEventHandlers-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/GlobalEventHandlers-impl.js deleted file mode 100644 index eb131af..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/GlobalEventHandlers-impl.js +++ /dev/null @@ -1,157 +0,0 @@ -"use strict"; - -const { appendHandler, createEventAccessor } = require("../helpers/create-event-accessor"); - -// Must be kept in sync with GlobalEventHandlers.webidl. -const events = new Set([ - "abort", - "auxclick", - "beforeinput", - "beforematch", - "beforetoggle", - "blur", - "cancel", - "canplay", - "canplaythrough", - "change", - "click", - "close", - "contextlost", - "contextmenu", - "contextrestored", - "copy", - "cuechange", - "cut", - "dblclick", - "drag", - "dragend", - "dragenter", - "dragleave", - "dragover", - "dragstart", - "drop", - "durationchange", - "emptied", - "ended", - "error", - "focus", - "formdata", - "input", - "invalid", - "keydown", - "keypress", - "keyup", - "load", - "loadeddata", - "loadedmetadata", - "loadstart", - "mousedown", - "mouseenter", - "mouseleave", - "mousemove", - "mouseout", - "mouseover", - "mouseup", - "paste", - "pause", - "play", - "playing", - "progress", - "ratechange", - "reset", - "resize", - "scroll", - "scrollend", - "securitypolicyviolation", - "seeked", - "seeking", - "select", - "slotchange", - "stalled", - "submit", - "suspend", - "timeupdate", - "toggle", - "volumechange", - "waiting", - "webkitanimationend", - "webkitanimationiteration", - "webkitanimationstart", - "webkittransitionend", - "wheel", - "touchstart", - "touchend", - "touchmove", - "touchcancel", - "pointerover", - "pointerenter", - "pointerdown", - "pointermove", - "pointerrawupdate", - "pointerup", - "pointercancel", - "pointerout", - "pointerleave", - "gotpointercapture", - "lostpointercapture" -]); - -class GlobalEventHandlersImpl { - _initGlobalEvents() { - this._registeredHandlers = new Set(); - this._eventHandlers = Object.create(null); - } - - _getEventHandlerTarget() { - return this; - } - - _getEventHandlerFor(event) { - const target = this._getEventHandlerTarget(event); - if (!target) { - return null; - } - - return target._eventHandlers[event]; - } - - _setEventHandlerFor(event, handler) { - const target = this._getEventHandlerTarget(event); - if (!target) { - return; - } - - if (!target._registeredHandlers.has(event) && handler !== null) { - target._registeredHandlers.add(event); - appendHandler(target, event); - } - target._eventHandlers[event] = handler; - } - - _globalEventChanged(event) { - const propName = "on" + event; - if (!(propName in this)) { - return; - } - - // Only translate attribute changes into properties when runScripts: "dangerously" is set. - // Documents without a browsing context (i.e. without a _defaultView) never run scripts. - const runScripts = "_runScripts" in this ? this._runScripts : (this._ownerDocument._defaultView || {})._runScripts; - if (runScripts !== "dangerously") { - return; - } - - const val = this.getAttributeNS(null, propName); - const handler = val === null ? null : { body: val }; - this._setEventHandlerFor(event, handler); - } -} - -for (const event of events) { - createEventAccessor(GlobalEventHandlersImpl.prototype, event); -} - -module.exports = { - implementation: GlobalEventHandlersImpl, - events -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAnchorElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAnchorElement-impl.js deleted file mode 100644 index 73b6943..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAnchorElement-impl.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -const { mixin } = require("../../utils"); -const DOMTokenList = require("../generated/DOMTokenList"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const HTMLHyperlinkElementUtilsImpl = require("./HTMLHyperlinkElementUtils-impl").implementation; - -class HTMLAnchorElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._htmlHyperlinkElementUtilsSetup(); - - this._hasActivationBehavior = true; - } - - _activationBehavior() { - this._followAHyperlink(); - } - - get relList() { - if (this._relList === undefined) { - this._relList = DOMTokenList.createImpl(this._globalObject, [], { - element: this, - attributeLocalName: "rel" - }); - } - return this._relList; - } - - get text() { - return this.textContent; - } - set text(v) { - this.textContent = v; - } - - _attrModified(name, value, oldValue) { - super._attrModified(name, value, oldValue); - - if (name === "rel" && this._relList !== undefined) { - this._relList.attrModified(); - } - } -} - -mixin(HTMLAnchorElementImpl.prototype, HTMLHyperlinkElementUtilsImpl.prototype); - -module.exports = { - implementation: HTMLAnchorElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAreaElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAreaElement-impl.js deleted file mode 100644 index 58d5fe1..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAreaElement-impl.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -const { mixin } = require("../../utils"); -const DOMTokenList = require("../generated/DOMTokenList"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const HTMLHyperlinkElementUtilsImpl = require("./HTMLHyperlinkElementUtils-impl").implementation; - -class HTMLAreaElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._htmlHyperlinkElementUtilsSetup(); - - this._hasActivationBehavior = true; - } - - _activationBehavior() { - this._followAHyperlink(); - } - - get relList() { - if (this._relList === undefined) { - this._relList = DOMTokenList.createImpl(this._globalObject, [], { - element: this, - attributeLocalName: "rel" - }); - } - return this._relList; - } - - _attrModified(name, value, oldValue) { - super._attrModified(name, value, oldValue); - - if (name === "rel" && this._relList !== undefined) { - this._relList.attrModified(); - } - } -} - -mixin(HTMLAreaElementImpl.prototype, HTMLHyperlinkElementUtilsImpl.prototype); - -module.exports = { - implementation: HTMLAreaElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAudioElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAudioElement-impl.js deleted file mode 100644 index ad65ff5..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAudioElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLMediaElementImpl = require("./HTMLMediaElement-impl").implementation; - -class HTMLAudioElementImpl extends HTMLMediaElementImpl { } - -module.exports = { - implementation: HTMLAudioElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBRElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBRElement-impl.js deleted file mode 100644 index c921613..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBRElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLBRElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLBRElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBaseElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBaseElement-impl.js deleted file mode 100644 index cc5a064..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBaseElement-impl.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -const whatwgURL = require("whatwg-url"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLBaseElementImpl extends HTMLElementImpl { - get href() { - const document = this._ownerDocument; - - const url = this.hasAttributeNS(null, "href") ? this.getAttributeNS(null, "href") : ""; - const parsed = whatwgURL.parseURL(url, { baseURL: document._fallbackBaseURL() }); - - if (parsed === null) { - return url; - } - - return whatwgURL.serializeURL(parsed); - } - - set href(value) { - this.setAttributeNS(null, "href", value); - } - - _attrModified(name, value, oldValue) { - super._attrModified(name, value, oldValue); - - if (name === "href") { - this._ownerDocument._clearBaseURLCache(); - } - } - - _attach() { - super._attach(); - this._ownerDocument._clearBaseURLCache(); - } - - _detach() { - super._detach(); - this._ownerDocument._clearBaseURLCache(); - } -} - -module.exports = { - implementation: HTMLBaseElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBodyElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBodyElement-impl.js deleted file mode 100644 index 1ebd0ea..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBodyElement-impl.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -const { mixin } = require("../../utils"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const WindowEventHandlersImpl = require("./WindowEventHandlers-impl").implementation; - -class HTMLBodyElementImpl extends HTMLElementImpl { - constructor(...args) { - super(...args); - this._proxyWindowEventsToWindow(); - } -} - -mixin(HTMLBodyElementImpl.prototype, WindowEventHandlersImpl.prototype); - -module.exports = { - implementation: HTMLBodyElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLButtonElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLButtonElement-impl.js deleted file mode 100644 index 0bd1c81..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLButtonElement-impl.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const DefaultConstraintValidationImpl = - require("../constraint-validation/DefaultConstraintValidation-impl").implementation; -const { mixin } = require("../../utils"); -const { isDisabled, formOwner, getLabelsForLabelable } = require("../helpers/form-controls"); -const { asciiLowercase } = require("../helpers/strings"); - -class HTMLButtonElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._customValidityErrorMessage = ""; - this._labels = null; - - this._hasActivationBehavior = true; - } - - _activationBehavior() { - const { form } = this; - if (form && !isDisabled(this)) { - if (this.type === "submit") { - form._doRequestSubmit(this); - } - if (this.type === "reset") { - form._doReset(); - } - } - } - - _getValue() { - const valueAttr = this.getAttributeNS(null, "value"); - return valueAttr === null ? "" : valueAttr; - } - - get labels() { - return getLabelsForLabelable(this); - } - - get form() { - return formOwner(this); - } - - get type() { - const typeAttr = asciiLowercase(this.getAttributeNS(null, "type") || ""); - switch (typeAttr) { - case "submit": - case "reset": - case "button": - return typeAttr; - default: - return "submit"; - } - } - - set type(v) { - v = asciiLowercase(String(v)); - switch (v) { - case "submit": - case "reset": - case "button": - this.setAttributeNS(null, "type", v); - break; - default: - this.setAttributeNS(null, "type", "submit"); - break; - } - } - - _barredFromConstraintValidationSpecialization() { - return this.type === "reset" || this.type === "button"; - } -} - -mixin(HTMLButtonElementImpl.prototype, DefaultConstraintValidationImpl.prototype); - -module.exports = { - implementation: HTMLButtonElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js deleted file mode 100644 index 099438d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { notImplementedMethod } = require("../../browser/not-implemented"); -const idlUtils = require("../generated/utils"); -const { Canvas } = require("../../utils"); - -class HTMLCanvasElementImpl extends HTMLElementImpl { - _attrModified(name, value, oldValue) { - if (this._canvas && (name === "width" || name === "height")) { - this._canvas[name] = parseInt(value); - } - - super._attrModified(name, value, oldValue); - } - - _getCanvas() { - if (Canvas && !this._canvas) { - this._canvas = Canvas.createCanvas(this.width, this.height); - } - return this._canvas; - } - - getContext(contextId) { - const canvas = this._getCanvas(); - if (canvas) { - if (!this._context) { - this._context = canvas.getContext(contextId) || null; - if (this._context) { - // Override the native canvas reference with our wrapper. This is the - // reason why we need to locally cache _context, since each call to - // canvas.getContext(contextId) would replace this reference again. - // Perhaps in the longer term, a better solution would be to create a - // full wrapper for the Context object as well. - this._context.canvas = idlUtils.wrapperForImpl(this); - wrapNodeCanvasMethod(this._context, "createPattern"); - wrapNodeCanvasMethod(this._context, "drawImage"); - } - } - return this._context; - } - - notImplementedMethod( - this._ownerDocument._defaultView, - "HTMLCanvasElement", - "getContext", - "without installing the canvas npm package" - ); - return null; - } - - toDataURL(...args) { - const canvas = this._getCanvas(); - if (canvas) { - return canvas.toDataURL(...args); - } - - notImplementedMethod( - this._ownerDocument._defaultView, - "HTMLCanvasElement", - "toDataURL", - "without installing the canvas npm package" - ); - return null; - } - - toBlob(callback, type, qualityArgument) { - const window = this._ownerDocument._defaultView; - const canvas = this._getCanvas(); - if (canvas) { - const options = {}; - switch (type) { - case "image/jpg": - case "image/jpeg": - type = "image/jpeg"; - options.quality = qualityArgument; - break; - default: - type = "image/png"; - } - canvas.toBuffer((err, buff) => { - if (err) { - throw err; - } - callback(new window.Blob([buff], { type })); - }, type, options); - } else { - notImplementedMethod( - this._ownerDocument._defaultView, - "HTMLCanvasElement", - "toBlob", - "without installing the canvas npm package" - ); - } - } - - get width() { - const parsed = parseInt(this.getAttributeNS(null, "width")); - return isNaN(parsed) || parsed < 0 || parsed > 2147483647 ? 300 : parsed; - } - - set width(v) { - v = v > 2147483647 ? 300 : v; - this.setAttributeNS(null, "width", String(v)); - } - - get height() { - const parsed = parseInt(this.getAttributeNS(null, "height")); - return isNaN(parsed) || parsed < 0 || parsed > 2147483647 ? 150 : parsed; - } - - set height(v) { - v = v > 2147483647 ? 150 : v; - this.setAttributeNS(null, "height", String(v)); - } -} - -// We need to wrap the methods that receive an image or canvas object -// (luckily, always as the first argument), so that these objects can be -// unwrapped an the expected types passed. -function wrapNodeCanvasMethod(ctx, name) { - const prev = ctx[name]; - ctx[name] = function (image, ...rest) { - const impl = idlUtils.implForWrapper(image); - if (impl) { - if (impl instanceof HTMLCanvasElementImpl && !impl._canvas) { - impl._getCanvas(); - } - image = impl._image || impl._canvas; - } - return prev.call(ctx, image, ...rest); - }; -} - -module.exports = { - implementation: HTMLCanvasElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCollection-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCollection-impl.js deleted file mode 100644 index 980ebd2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCollection-impl.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils.js"); -const { HTML_NS } = require("../helpers/namespaces"); - -exports.implementation = class HTMLCollectionImpl { - constructor(globalObject, args, privateData) { - this._list = []; - this._version = -1; - this._element = privateData.element; - this._query = privateData.query; - - this._globalObject = globalObject; - - this._update(); - } - get length() { - this._update(); - return this._list.length; - } - item(index) { - this._update(); - return this._list[index] || null; - } - namedItem(key) { - if (key === "") { - return null; - } - this._update(); - for (const element of this._list) { - if (element.getAttributeNS(null, "id") === key) { - return element; - } - if (element._namespaceURI === HTML_NS) { - const name = element.getAttributeNS(null, "name"); - if (name === key) { - return element; - } - } - } - return null; - } - _update() { - if (this._version < this._element._version) { - const snapshot = this._query(); - for (let i = 0; i < snapshot.length; i++) { - this._list[i] = snapshot[i]; - } - this._list.length = snapshot.length; - this._version = this._element._version; - } - } - get [idlUtils.supportedPropertyIndices]() { - this._update(); - return this._list.keys(); - } - get [idlUtils.supportedPropertyNames]() { - this._update(); - const result = new Set(); - for (const element of this._list) { - const id = element.getAttributeNS(null, "id"); - if (id) { - result.add(id); - } - if (element._namespaceURI === HTML_NS) { - const name = element.getAttributeNS(null, "name"); - if (name) { - result.add(name); - } - } - } - return result; - } - - // Inherit some useful functions from Array. - [Symbol.iterator]() { - this._update(); - return this._list[Symbol.iterator](); - } - entries() { - this._update(); - return this._list.entries(); - } - filter(...args) { - this._update(); - return this._list.filter(...args); - } - map(...args) { - this._update(); - return this._list.map(...args); - } - indexOf(...args) { - this._update(); - return this._list.indexOf(...args); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDListElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDListElement-impl.js deleted file mode 100644 index 22ee9bd..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDListElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLDListElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLDListElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataElement-impl.js deleted file mode 100644 index 2d75abc..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLDataElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLDataElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataListElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataListElement-impl.js deleted file mode 100644 index ccd2c4c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataListElement-impl.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -const HTMLCollection = require("../generated/HTMLCollection"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -const { descendantsByLocalName } = require("../helpers/traversal"); - -class HTMLDataListElementImpl extends HTMLElementImpl { - // https://html.spec.whatwg.org/multipage/form-elements.html#dom-datalist-options - get options() { - return HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => descendantsByLocalName(this, "option") - }); - } -} - -module.exports = { - implementation: HTMLDataListElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDetailsElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDetailsElement-impl.js deleted file mode 100644 index 7a934b4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDetailsElement-impl.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -const { fireAnEvent } = require("../helpers/events"); - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLDetailsElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._taskQueue = null; - } - - _dispatchToggleEvent() { - this._taskQueue = null; - - fireAnEvent("toggle", this); - } - - _attrModified(name, value, oldValue) { - super._attrModified(name, value, oldValue); - - if (name === "open" && this._taskQueue === null) { - // Check that the attribute is added or removed, not merely changed - if ((value !== oldValue && value !== null && oldValue === null) || - (value === null && oldValue !== null)) { - this._taskQueue = setTimeout(this._dispatchToggleEvent.bind(this), 0); - } - } - } -} - -module.exports = { - implementation: HTMLDetailsElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDialogElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDialogElement-impl.js deleted file mode 100644 index d020e3c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDialogElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLDialogElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLDialogElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDirectoryElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDirectoryElement-impl.js deleted file mode 100644 index ea05eb3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDirectoryElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLDirectoryElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLDirectoryElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDivElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDivElement-impl.js deleted file mode 100644 index b81a714..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDivElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLDivElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLDivElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js deleted file mode 100644 index efa121f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js +++ /dev/null @@ -1,211 +0,0 @@ -"use strict"; -const { mixin } = require("../../utils"); -const ElementImpl = require("./Element-impl").implementation; -const DOMException = require("../generated/DOMException"); -const PointerEvent = require("../generated/PointerEvent"); -const ElementInternals = require("../generated/ElementInternals"); -const ElementCSSInlineStyleImpl = require("./ElementCSSInlineStyle-impl").implementation; -const GlobalEventHandlersImpl = require("./GlobalEventHandlers-impl").implementation; -const HTMLOrSVGElementImpl = require("./HTMLOrSVGElement-impl").implementation; -const { firstChildWithLocalName } = require("../helpers/traversal"); -const { isDisabled } = require("../helpers/form-controls"); -const { fireAnEvent } = require("../helpers/events"); -const { asciiLowercase } = require("../helpers/strings"); -const { lookupCEDefinition } = require("../helpers/custom-elements"); - -class HTMLElementImpl extends ElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._initHTMLOrSVGElement(); - this._initElementCSSInlineStyle(); - this._initGlobalEvents(); - - this._clickInProgress = false; - - // <summary> uses HTMLElement and has activation behavior - this._hasActivationBehavior = this._localName === "summary"; - - // https://html.spec.whatwg.org/#attached-internals - this._attachedInternals = null; - } - - _activationBehavior() { - const parent = this.parentNode; - if (parent && parent._localName === "details" && - this === firstChildWithLocalName(parent, "summary")) { - if (parent.hasAttributeNS(null, "open")) { - parent.removeAttributeNS(null, "open"); - } else { - parent.setAttributeNS(null, "open", ""); - } - } - } - - // https://html.spec.whatwg.org/multipage/dom.html#the-translate-attribute - get translate() { - const translateAttr = this.getAttributeNS(null, "translate"); - const translateAttrString = asciiLowercase(translateAttr || ""); - - if (translateAttrString === "yes" || (translateAttr && translateAttrString === "")) { - return true; - } else if (translateAttrString === "no") { - return false; - } - - if (this === this.ownerDocument.documentElement) { - return true; - } - - return this.parentElement && this.parentElement.translate; - } - set translate(value) { - if (value === true) { - this.setAttributeNS(null, "translate", "yes"); - } else { - this.setAttributeNS(null, "translate", "no"); - } - } - - click() { - // https://html.spec.whatwg.org/multipage/interaction.html#dom-click - // https://html.spec.whatwg.org/multipage/webappapis.html#fire-a-synthetic-pointer-event - - if (isDisabled(this)) { - return; - } - - if (this._clickInProgress) { - return; - } - - this._clickInProgress = true; - - // https://github.com/whatwg/html/issues/4452 - // https://github.com/whatwg/html/issues/11236 - fireAnEvent("click", this, PointerEvent, { - bubbles: true, - cancelable: true, - composed: true, - isTrusted: false, - pointerId: -1, - view: this.ownerDocument.defaultView - }); - - this._clickInProgress = false; - } - - get draggable() { - const attributeValue = asciiLowercase(this.getAttributeNS(null, "draggable") || ""); - - if (attributeValue === "true") { - return true; - } else if (attributeValue === "false") { - return false; - } - - return this._localName === "img" || (this._localName === "a" && this.hasAttributeNS(null, "href")); - } - set draggable(value) { - this.setAttributeNS(null, "draggable", String(value)); - } - - get dir() { - let dirValue = this.getAttributeNS(null, "dir"); - if (dirValue !== null) { - dirValue = dirValue.toLowerCase(); - - if (["ltr", "rtl", "auto"].includes(dirValue)) { - return dirValue; - } - } - return ""; - } - set dir(value) { - this.setAttributeNS(null, "dir", value); - } - - // https://html.spec.whatwg.org/#dom-attachinternals - attachInternals() { - if (this._isValue !== null) { - throw DOMException.create(this._globalObject, [ - "Unable to attach ElementInternals to a customized built-in element.", - "NotSupportedError" - ]); - } - - const definition = lookupCEDefinition(this._ownerDocument, this._namespaceURI, this._localName, null); - - if (definition === null) { - throw DOMException.create(this._globalObject, [ - "Unable to attach ElementInternals to non-custom elements.", - "NotSupportedError" - ]); - } - - if (definition.disableInternals === true) { - throw DOMException.create(this._globalObject, [ - "ElementInternals is disabled by disabledFeature static field.", - "NotSupportedError" - ]); - } - - if (this._attachedInternals !== null) { - throw DOMException.create(this._globalObject, [ - "ElementInternals for the specified element was already attached.", - "NotSupportedError" - ]); - } - - if (this._ceState !== "precustomized" && this._ceState !== "custom") { - throw DOMException.create(this._globalObject, [ - "The attachInternals() function cannot be called prior to the execution of the custom element constructor.", - "NotSupportedError" - ]); - } - - this._attachedInternals = ElementInternals.createImpl(this._globalObject, [], { targetElement: this }); - - return this._attachedInternals; - } - - // Keep in sync with SVGElement. https://github.com/jsdom/jsdom/issues/2599 - _attrModified(name, value, oldValue) { - if (name === "style" && value !== oldValue && !this._settingCssText) { - this._settingCssText = true; - this._style.cssText = value; - this._settingCssText = false; - } else if (name.startsWith("on")) { - this._globalEventChanged(name.substring(2)); - } - - super._attrModified(name, value, oldValue); - } - - get offsetParent() { - return null; - } - - get offsetTop() { - return 0; - } - - get offsetLeft() { - return 0; - } - - get offsetWidth() { - return 0; - } - - get offsetHeight() { - return 0; - } -} - -mixin(HTMLElementImpl.prototype, ElementCSSInlineStyleImpl.prototype); -mixin(HTMLElementImpl.prototype, GlobalEventHandlersImpl.prototype); -mixin(HTMLElementImpl.prototype, HTMLOrSVGElementImpl.prototype); - -module.exports = { - implementation: HTMLElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLEmbedElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLEmbedElement-impl.js deleted file mode 100644 index c1c9788..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLEmbedElement-impl.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLEmbedElementImpl extends HTMLElementImpl {} - -module.exports = { - implementation: HTMLEmbedElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFieldSetElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFieldSetElement-impl.js deleted file mode 100644 index 360a838..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFieldSetElement-impl.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -const HTMLCollection = require("../generated/HTMLCollection"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const DefaultConstraintValidationImpl = - require("../constraint-validation/DefaultConstraintValidation-impl").implementation; -const { formOwner } = require("../helpers/form-controls"); -const { mixin } = require("../../utils"); -const { descendantsByLocalNames } = require("../helpers/traversal"); - -const listedElements = new Set(["button", "fieldset", "input", "object", "output", "select", "textarea"]); - -class HTMLFieldSetElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._customValidityErrorMessage = ""; - } - - get elements() { - return HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => descendantsByLocalNames(this, listedElements) - }); - } - - get form() { - return formOwner(this); - } - - get type() { - return "fieldset"; - } - - _barredFromConstraintValidationSpecialization() { - return true; - } -} - -mixin(HTMLFieldSetElementImpl.prototype, DefaultConstraintValidationImpl.prototype); - -module.exports = { - implementation: HTMLFieldSetElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFontElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFontElement-impl.js deleted file mode 100644 index 688773a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFontElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLFontElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLFontElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormControlsCollection-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormControlsCollection-impl.js deleted file mode 100644 index 22a7351..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormControlsCollection-impl.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -const HTMLCollectionImpl = require("./HTMLCollection-impl").implementation; -const RadioNodeList = require("../generated/RadioNodeList"); - -exports.implementation = class HTMLFormControlsCollectionImpl extends HTMLCollectionImpl { - namedItem(name) { - if (name === "") { - return null; - } - - this._update(); - - const nodeList = RadioNodeList.createImpl(this._globalObject, [], { - element: this, - query: () => this._list.filter( - e => e.getAttributeNS(null, "id") === name || e.getAttributeNS(null, "name") === name - ) - }); - - switch (nodeList.length) { - case 0: { - return null; - } - case 1: { - return nodeList.item(0); - } - default: { - return nodeList; - } - } - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormElement-impl.js deleted file mode 100644 index a7a9fb2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormElement-impl.js +++ /dev/null @@ -1,248 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils.js"); -const DOMException = require("../generated/DOMException"); -const { serializeURL } = require("whatwg-url"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { domSymbolTree } = require("../helpers/internal-constants"); -const { fireAnEvent } = require("../helpers/events"); -const { formOwner, isListed, isSubmittable, isSubmitButton } = require("../helpers/form-controls"); -const HTMLFormControlsCollection = require("../generated/HTMLFormControlsCollection"); -const { notImplementedMethod } = require("../../browser/not-implemented"); -const SubmitEvent = require("../generated/SubmitEvent"); - -const encTypes = new Set([ - "application/x-www-form-urlencoded", - "multipart/form-data", - "text/plain" -]); - -const methods = new Set([ - "get", - "post", - "dialog" -]); - -const constraintValidationPositiveResult = Symbol("positive"); -const constraintValidationNegativeResult = Symbol("negative"); - -class HTMLFormElementImpl extends HTMLElementImpl { - _descendantAdded(parent, child) { - const form = this; - for (const el of domSymbolTree.treeIterator(child)) { - if (typeof el._changedFormOwner === "function") { - el._changedFormOwner(form); - } - } - - super._descendantAdded(parent, child); - } - - _descendantRemoved(parent, child) { - for (const el of domSymbolTree.treeIterator(child)) { - if (typeof el._changedFormOwner === "function") { - el._changedFormOwner(null); - } - } - - super._descendantRemoved(parent, child); - } - - _getSubmittableElementNodes() { - return domSymbolTree.treeToArray(this.getRootNode({}), { - filter: node => { - if (!isSubmittable(node)) { - return false; - } - - return formOwner(node) === this; - } - }); - } - - _getElementNodes() { - return domSymbolTree.treeToArray(this.getRootNode({}), { - filter: node => { - if (!isListed(node) || (node._localName === "input" && node.type === "image")) { - return false; - } - - return formOwner(node) === this; - } - }); - } - - // https://html.spec.whatwg.org/multipage/forms.html#dom-form-elements - get elements() { - return HTMLFormControlsCollection.createImpl(this._globalObject, [], { - element: this.getRootNode({}), - query: () => this._getElementNodes() - }); - } - - [idlUtils.indexedGet](index) { - return this._getElementNodes()[index] || null; - } - - get [idlUtils.supportedPropertyIndices]() { - return Object.keys(this._getElementNodes()); - } - - get length() { - return this.elements.length; - } - - _doRequestSubmit(submitter) { - if (!this.isConnected) { - return; - } - - this.requestSubmit(submitter); - } - - submit() { - notImplementedMethod(this._ownerDocument._defaultView, "HTMLFormElement", "submit"); - } - - requestSubmit(submitter = null) { - if (submitter !== null) { - if (!isSubmitButton(submitter)) { - throw new TypeError("The specified element is not a submit button"); - } - if (submitter.form !== this) { - throw DOMException.create(this._globalObject, [ - "The specified element is not owned by this form element", - "NotFoundError" - ]); - } - } - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm - // Step 6.3: if form doesn't have the 'novalidate' attribute, validate it and abort submission if form is invalid - if (!this.hasAttributeNS(null, "novalidate") && !this.reportValidity()) { - return; - } - - if (!fireAnEvent("submit", this, SubmitEvent, { bubbles: true, cancelable: true, submitter })) { - return; - } - - notImplementedMethod(this._ownerDocument._defaultView, "HTMLFormElement", "requestSubmit"); - } - - _doReset() { - if (!this.isConnected) { - return; - } - - this.reset(); - } - - reset() { - if (!fireAnEvent("reset", this, undefined, { bubbles: true, cancelable: true })) { - return; - } - - for (const el of this.elements) { - if (typeof el._formReset === "function") { - el._formReset(); - } - } - } - - get method() { - let method = this.getAttributeNS(null, "method"); - if (method) { - method = method.toLowerCase(); - } - - if (methods.has(method)) { - return method; - } - return "get"; - } - - set method(V) { - this.setAttributeNS(null, "method", V); - } - - get enctype() { - let type = this.getAttributeNS(null, "enctype"); - if (type) { - type = type.toLowerCase(); - } - - if (encTypes.has(type)) { - return type; - } - return "application/x-www-form-urlencoded"; - } - - set enctype(V) { - this.setAttributeNS(null, "enctype", V); - } - - get action() { - const attributeValue = this.getAttributeNS(null, "action"); - if (attributeValue === null || attributeValue === "") { - return this._ownerDocument.URL; - } - const urlRecord = this._ownerDocument.encodingParseAURL(attributeValue); - if (urlRecord === null) { - return attributeValue; - } - return serializeURL(urlRecord); - } - - set action(V) { - this.setAttributeNS(null, "action", V); - } - - // If the checkValidity() method is invoked, the user agent must statically validate the - // constraints of the form element, and return true if the constraint validation returned - // a positive result, and false if it returned a negative result. - checkValidity() { - return this._staticallyValidateConstraints().result === constraintValidationPositiveResult; - } - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#interactively-validate-the-constraints - reportValidity() { - return this.checkValidity(); - } - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#statically-validate-the-constraints - _staticallyValidateConstraints() { - const controls = []; - for (const el of this.elements) { - if (el.form === this && isSubmittable(el)) { - controls.push(el); - } - } - - const invalidControls = []; - - for (const control of controls) { - if (control._isCandidateForConstraintValidation() && !control._satisfiesConstraints()) { - invalidControls.push(control); - } - } - - if (invalidControls.length === 0) { - return { result: constraintValidationPositiveResult }; - } - - const unhandledInvalidControls = []; - for (const invalidControl of invalidControls) { - const notCancelled = fireAnEvent("invalid", invalidControl, undefined, { cancelable: true }); - if (notCancelled) { - unhandledInvalidControls.push(invalidControl); - } - } - - return { result: constraintValidationNegativeResult, unhandledInvalidControls }; - } -} - -module.exports = { - implementation: HTMLFormElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameElement-impl.js deleted file mode 100644 index 7163414..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameElement-impl.js +++ /dev/null @@ -1,266 +0,0 @@ -"use strict"; - -const { legacyHookDecode } = require("@exodus/bytes/encoding.js"); -const { parseURL, serializeURL } = require("whatwg-url"); -const sniffHTMLEncoding = require("html-encoding-sniffer"); -const { computedMIMEType } = require("whatwg-mimetype"); - -const window = require("../../browser/Window"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { evaluateJavaScriptURL } = require("../window/navigation"); -const { parseIntoDocument } = require("../../browser/parser"); -const { fireAnEvent } = require("../helpers/events"); -const { getAttributeValue } = require("../attributes"); -const idlUtils = require("../generated/utils"); - -function fireLoadEvent(document, frame, attaching) { - if (attaching) { - fireAnEvent("load", frame); - - return; - } - - const dummyPromise = Promise.resolve(); - - function onLoad() { - fireAnEvent("load", frame); - } - - document._queue.push(dummyPromise, onLoad); -} - -function fetchFrame(serializedURL, frame, document, contentDoc) { - const resourceLoader = document._resourceLoader; - - function onFrameLoaded(data, response) { - const contentType = computedMIMEType(data, { - contentTypeHeader: response.headers.get("content-type") - }); - const xml = contentType.isXML(); - const transportLayerEncodingLabel = contentType.parameters.get("charset"); - - if (xml) { - contentDoc._parsingMode = "xml"; - } - contentDoc.contentType = contentType.essence; - - contentDoc._encoding = sniffHTMLEncoding(data, { - xml, - transportLayerEncodingLabel, - // half-assed implementation of - // https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding step 6 - defaultEncoding: xml ? "UTF-8" : document._encoding - }); - - const html = legacyHookDecode(data, contentDoc._encoding); - - try { - parseIntoDocument(html, contentDoc); - } catch (error) { - const { DOMException } = contentDoc._globalObject; - - if ( - error.constructor.name === "DOMException" && - error.code === DOMException.SYNTAX_ERR && - contentDoc._parsingMode === "xml" - ) { - // As defined (https://html.spec.whatwg.org/#read-xml) parsing error in XML document may be reported inline by - // mutating the document. - const element = contentDoc.createElementNS("http://www.mozilla.org/newlayout/xml/parsererror.xml", "parsererror"); - element.textContent = error.message; - - while (contentDoc.childNodes.length > 0) { - contentDoc.removeChild(contentDoc.lastChild); - } - contentDoc.appendChild(element); - } else { - throw error; - } - } - - contentDoc.close(); - - return new Promise((resolve, reject) => { - contentDoc.addEventListener("load", resolve); - contentDoc.addEventListener("error", reject); - }); - } - - resourceLoader.fetch(serializedURL, { - element: frame, - onLoad: onFrameLoaded - }); -} - -function canDispatchEvents(frame, attaching) { - if (!attaching) { - return false; - } - - return Object.keys(frame._eventListeners).length === 0; -} - -function loadFrame(frame, attaching) { - if (frame._contentDocument) { - if (frame._contentDocument._defaultView) { - // close calls delete on its document. - frame._contentDocument._defaultView.close(); - } else { - delete frame._contentDocument; - } - } - - const parentDoc = frame._ownerDocument; - - // https://html.spec.whatwg.org/#process-the-iframe-attributes - let url; - const srcAttribute = getAttributeValue(frame, "src"); - if (srcAttribute === "") { - url = parseURL("about:blank"); - } else { - url = parseURL(srcAttribute, { baseURL: parentDoc.baseURL() || undefined }) || parseURL("about:blank"); - } - const serializedURL = serializeURL(url); - - const wnd = window.createWindow({ - parsingMode: "html", - url: url.scheme === "javascript" ? parentDoc.URL : serializedURL, - parentOrigin: parentDoc._origin, - dispatcher: parentDoc._defaultView._dispatcher, - loadSubresources: parentDoc._defaultView._loadSubresources, - userAgent: parentDoc._defaultView._userAgent, - referrer: parentDoc.URL, - cookieJar: parentDoc._cookieJar, - pool: parentDoc._pool, - encoding: parentDoc._encoding, - runScripts: parentDoc._defaultView._runScripts, - commonForOrigin: parentDoc._defaultView._commonForOrigin, - pretendToBeVisual: parentDoc._defaultView._pretendToBeVisual - }); - - const contentDoc = frame._contentDocument = idlUtils.implForWrapper(wnd._document); - const parent = parentDoc._defaultView; - const contentWindow = contentDoc._defaultView; - contentWindow._parent = parent; - contentWindow._top = parent.top; - contentWindow._frameElement = frame; - contentWindow._virtualConsole = parent._virtualConsole; - - if (parentDoc._origin === contentDoc._origin) { - contentWindow._currentOriginData.windowsInSameOrigin.push(contentWindow); - } - - const noQueue = canDispatchEvents(frame, attaching); - - // Handle about:blank with a simulated load of an empty document. - if (serializedURL === "about:blank") { - // Cannot be done inside the enqueued callback; the documentElement etc. need to be immediately available. - parseIntoDocument("<html><head></head><body></body></html>", contentDoc); - contentDoc.close(noQueue); - - if (noQueue) { - fireLoadEvent(parentDoc, frame, noQueue); - } else { - contentDoc.addEventListener("load", () => { - fireLoadEvent(parentDoc, frame); - }); - } - } else if (url.scheme === "javascript") { - // Cannot be done inside the enqueued callback; the documentElement etc. need to be immediately available. - parseIntoDocument("<html><head></head><body></body></html>", contentDoc); - contentDoc.close(noQueue); - const result = evaluateJavaScriptURL(contentWindow, url); - if (typeof result === "string") { - contentDoc.body.textContent = result; - } - if (noQueue) { - fireLoadEvent(parentDoc, frame, noQueue); - } else { - contentDoc.addEventListener("load", () => { - fireLoadEvent(parentDoc, frame); - }); - } - } else { - fetchFrame(serializedURL, frame, parentDoc, contentDoc); - } -} - -function refreshAccessors(document) { - const { _defaultView } = document; - - if (!_defaultView) { - return; - } - - const frames = document.querySelectorAll("iframe,frame"); - - // delete accessors for all frames - for (let i = 0; i < _defaultView._length; ++i) { - delete _defaultView[i]; - } - - _defaultView._length = frames.length; - for (let i = 0; i < frames.length; ++i) { - const frame = frames.item(i); - Object.defineProperty(_defaultView, i, { - configurable: true, - enumerable: true, - get() { - return frame.contentWindow; - } - }); - } -} - -class HTMLFrameElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._contentDocument = null; - } - _attrModified(name, value, oldVal) { - super._attrModified(name, value, oldVal); - if (name === "src") { - // iframe should never load in a document without a Window - // (e.g. implementation.createHTMLDocument) - if (this._attached && this._ownerDocument._defaultView) { - loadFrame(this); - } - } - } - - _detach() { - super._detach(); - - if (this.contentWindow) { - // TODO: this is not really correct behavior, because jsdom's window.close() is very aggressive and is meant for - // killing off the whole jsdom, not just moving the Window to a no-browsing-context state. - // - // If we revise this in the future, be sure to also invalidate the base URL cache. - - this.contentWindow.close(); - } - - refreshAccessors(this._ownerDocument); - } - - _attach() { - super._attach(); - - if (this._ownerDocument._defaultView) { - loadFrame(this, true); - } - refreshAccessors(this._ownerDocument); - } - - get contentDocument() { - return this._contentDocument; - } - - get contentWindow() { - return this.contentDocument ? this.contentDocument._defaultView : null; - } -} - -module.exports = { - implementation: HTMLFrameElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameSetElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameSetElement-impl.js deleted file mode 100644 index 89eee2d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameSetElement-impl.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -const { mixin } = require("../../utils"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const WindowEventHandlersImpl = require("./WindowEventHandlers-impl").implementation; - -class HTMLFrameSetElementImpl extends HTMLElementImpl { - constructor(...args) { - super(...args); - this._proxyWindowEventsToWindow(); - } -} - -mixin(HTMLFrameSetElementImpl.prototype, WindowEventHandlersImpl.prototype); - -module.exports = { - implementation: HTMLFrameSetElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHRElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHRElement-impl.js deleted file mode 100644 index 8c5d337..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHRElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLHRElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLHRElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadElement-impl.js deleted file mode 100644 index 6803377..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLHeadElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLHeadElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadingElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadingElement-impl.js deleted file mode 100644 index 4fb4250..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadingElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLHeadingElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLHeadingElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHtmlElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHtmlElement-impl.js deleted file mode 100644 index bda1780..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHtmlElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLHtmlElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLHtmlElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHyperlinkElementUtils-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHyperlinkElementUtils-impl.js deleted file mode 100644 index e2e6156..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHyperlinkElementUtils-impl.js +++ /dev/null @@ -1,368 +0,0 @@ -"use strict"; -const whatwgURL = require("whatwg-url"); -const { asciiCaseInsensitiveMatch } = require("../helpers/strings"); -const { navigate } = require("../window/navigation"); - -exports.implementation = class HTMLHyperlinkElementUtilsImpl { - _htmlHyperlinkElementUtilsSetup() { - this.url = null; - } - - // https://html.spec.whatwg.org/multipage/links.html#cannot-navigate - _cannotNavigate() { - // TODO: Correctly check if the document is fully active - return this._localName !== "a" && !this.isConnected; - } - - // https://html.spec.whatwg.org/multipage/semantics.html#get-an-element's-target - _getAnElementsTarget() { - if (this.hasAttributeNS(null, "target")) { - return this.getAttributeNS(null, "target"); - } - - const baseEl = this._ownerDocument.querySelector("base[target]"); - - if (baseEl) { - return baseEl.getAttributeNS(null, "target"); - } - - return ""; - } - - // https://html.spec.whatwg.org/multipage/browsers.html#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name - _chooseABrowsingContext(name, current) { - let chosen = null; - - if (name === "" || asciiCaseInsensitiveMatch(name, "_self")) { - chosen = current; - } else if (asciiCaseInsensitiveMatch(name, "_parent")) { - chosen = current.parent; - } else if (asciiCaseInsensitiveMatch(name, "_top")) { - chosen = current.top; - } else if (!asciiCaseInsensitiveMatch(name, "_blank")) { - // https://github.com/whatwg/html/issues/1440 - } - - // TODO: Create new browsing context, handle noopener - - return chosen; - } - - // https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks-2 - _followAHyperlink() { - if (this._cannotNavigate()) { - return; - } - - const source = this._ownerDocument._defaultView; - let targetAttributeValue = ""; - - if (this._localName === "a" || this._localName === "area") { - targetAttributeValue = this._getAnElementsTarget(); - } - - const noopener = this.relList.contains("noreferrer") || this.relList.contains("noopener"); - - const target = this._chooseABrowsingContext(targetAttributeValue, source, noopener); - - if (target === null) { - return; - } - - const url = this._ownerDocument.encodingParseAURL(this.href); - - if (url === null) { - return; - } - - // TODO: Handle hyperlink suffix and referrerpolicy - setTimeout(() => { - navigate(target, url, {}); - }, 0); - } - - toString() { - return this.href; - } - - get href() { - reinitializeURL(this); - const { url } = this; - - if (url === null) { - const href = this.getAttributeNS(null, "href"); - return href === null ? "" : href; - } - - return whatwgURL.serializeURL(url); - } - - set href(v) { - this.setAttributeNS(null, "href", v); - } - - get origin() { - reinitializeURL(this); - - if (this.url === null) { - return ""; - } - - return whatwgURL.serializeURLOrigin(this.url); - } - - get protocol() { - reinitializeURL(this); - - if (this.url === null) { - return ":"; - } - - return this.url.scheme + ":"; - } - - set protocol(v) { - reinitializeURL(this); - - if (this.url === null) { - return; - } - - whatwgURL.basicURLParse(v + ":", { url: this.url, stateOverride: "scheme start" }); - updateHref(this); - } - - get username() { - reinitializeURL(this); - - if (this.url === null) { - return ""; - } - - return this.url.username; - } - - set username(v) { - reinitializeURL(this); - const { url } = this; - - if (url === null || whatwgURL.cannotHaveAUsernamePasswordPort(url)) { - return; - } - - whatwgURL.setTheUsername(url, v); - updateHref(this); - } - - get password() { - reinitializeURL(this); - const { url } = this; - - if (url === null) { - return ""; - } - - return url.password; - } - - set password(v) { - reinitializeURL(this); - const { url } = this; - - if (url === null || whatwgURL.cannotHaveAUsernamePasswordPort(url)) { - return; - } - - whatwgURL.setThePassword(url, v); - updateHref(this); - } - - get host() { - reinitializeURL(this); - const { url } = this; - - if (url === null || url.host === null) { - return ""; - } - - if (url.port === null) { - return whatwgURL.serializeHost(url.host); - } - - return whatwgURL.serializeHost(url.host) + ":" + whatwgURL.serializeInteger(url.port); - } - - set host(v) { - reinitializeURL(this); - const { url } = this; - - if (url === null || whatwgURL.hasAnOpaquePath(url)) { - return; - } - - whatwgURL.basicURLParse(v, { url, stateOverride: "host" }); - updateHref(this); - } - - get hostname() { - reinitializeURL(this); - const { url } = this; - - if (url === null || url.host === null) { - return ""; - } - - return whatwgURL.serializeHost(url.host); - } - - set hostname(v) { - reinitializeURL(this); - const { url } = this; - - if (url === null || whatwgURL.hasAnOpaquePath(url)) { - return; - } - - whatwgURL.basicURLParse(v, { url, stateOverride: "hostname" }); - updateHref(this); - } - - get port() { - reinitializeURL(this); - const { url } = this; - - if (url === null || url.port === null) { - return ""; - } - - return whatwgURL.serializeInteger(url.port); - } - - set port(v) { - reinitializeURL(this); - const { url } = this; - - if (url === null || whatwgURL.cannotHaveAUsernamePasswordPort(url)) { - return; - } - - if (v === "") { - url.port = null; - } else { - whatwgURL.basicURLParse(v, { url, stateOverride: "port" }); - } - updateHref(this); - } - - get pathname() { - reinitializeURL(this); - const { url } = this; - - if (url === null) { - return ""; - } - - return whatwgURL.serializePath(url); - } - - set pathname(v) { - reinitializeURL(this); - const { url } = this; - - if (url === null || whatwgURL.hasAnOpaquePath(url)) { - return; - } - - url.path = []; - whatwgURL.basicURLParse(v, { url, stateOverride: "path start" }); - updateHref(this); - } - - get search() { - reinitializeURL(this); - const { url } = this; - - if (url === null || url.query === null || url.query === "") { - return ""; - } - - return "?" + url.query; - } - - set search(v) { - reinitializeURL(this); - const { url } = this; - - if (url === null) { - return; - } - - if (v === "") { - url.query = null; - } else { - const input = v[0] === "?" ? v.substring(1) : v; - url.query = ""; - whatwgURL.basicURLParse(input, { - url, - stateOverride: "query", - encodingOverride: this._ownerDocument.charset - }); - } - updateHref(this); - } - - get hash() { - reinitializeURL(this); - const { url } = this; - - if (url === null || url.fragment === null || url.fragment === "") { - return ""; - } - - return "#" + url.fragment; - } - - set hash(v) { - reinitializeURL(this); - const { url } = this; - - if (url === null) { - return; - } - - if (v === "") { - url.fragment = null; - } else { - const input = v[0] === "#" ? v.substring(1) : v; - url.fragment = ""; - whatwgURL.basicURLParse(input, { url, stateOverride: "fragment" }); - } - updateHref(this); - } -}; - -function reinitializeURL(hheu) { - if (hheu.url !== null && hheu.url.scheme === "blob" && whatwgURL.hasAnOpaquePath(hheu.url)) { - return; - } - - setTheURL(hheu); -} - -function setTheURL(hheu) { - hheu.url = null; - - const href = hheu.getAttributeNS(null, "href"); - if (href === null) { - return; - } - - const parsed = hheu._ownerDocument.encodingParseAURL(href); - if (parsed !== null) { - hheu.url = parsed; - } -} - -function updateHref(hheu) { - hheu.setAttributeNS(null, "href", whatwgURL.serializeURL(hheu.url)); -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLIFrameElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLIFrameElement-impl.js deleted file mode 100644 index 643e989..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLIFrameElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLFrameElementImpl = require("./HTMLFrameElement-impl").implementation; - -class HTMLIFrameElementImpl extends HTMLFrameElementImpl { } - -module.exports = { - implementation: HTMLIFrameElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLImageElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLImageElement-impl.js deleted file mode 100644 index 80bee05..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLImageElement-impl.js +++ /dev/null @@ -1,127 +0,0 @@ -"use strict"; -const conversions = require("webidl-conversions"); -const { serializeURL } = require("whatwg-url"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { Canvas } = require("../../utils"); - -class HTMLImageElementImpl extends HTMLElementImpl { - constructor(...args) { - super(...args); - this._currentRequestState = "unavailable"; - } - - _attrModified(name, value, oldVal) { - // TODO: handle crossorigin - if (name === "src" || ((name === "srcset" || name === "width" || name === "sizes") && value !== oldVal)) { - this._updateTheImageData(); - } - - super._attrModified(name, value, oldVal); - } - - get _accept() { - return "image/png,image/*;q=0.8,*/*;q=0.5"; - } - - get height() { - // Just like on browsers, if no width / height is defined, we fall back on the - // dimensions of the internal image data. - return this.hasAttributeNS(null, "height") ? - conversions["unsigned long"](this.getAttributeNS(null, "height")) : - this.naturalHeight; - } - - set height(V) { - this.setAttributeNS(null, "height", String(V)); - } - - get width() { - return this.hasAttributeNS(null, "width") ? - conversions["unsigned long"](this.getAttributeNS(null, "width")) : - this.naturalWidth; - } - - set width(V) { - this.setAttributeNS(null, "width", String(V)); - } - - get naturalHeight() { - return this._image ? this._image.naturalHeight : 0; - } - - get naturalWidth() { - return this._image ? this._image.naturalWidth : 0; - } - - get complete() { - const srcAttributeValue = this.getAttributeNS(null, "src"); - return srcAttributeValue === null || - srcAttributeValue === "" || - this._currentRequestState === "broken" || - this._currentRequestState === "completely available"; - } - - get currentSrc() { - return this._currentSrc || ""; - } - - // https://html.spec.whatwg.org/multipage/images.html#updating-the-image-data - _updateTheImageData() { - const document = this._ownerDocument; - - if (!document._defaultView) { - return; - } - - if (!Canvas) { - return; - } - - if (!this._image) { - this._image = new Canvas.Image(); - } - this._currentSrc = null; - this._currentRequestState = "unavailable"; - const srcAttributeValue = this.getAttributeNS(null, "src"); - let urlString = null; - if (srcAttributeValue !== null && srcAttributeValue !== "") { - const urlRecord = this._ownerDocument.encodingParseAURL(srcAttributeValue); - if (urlRecord === null) { - return; - } - urlString = serializeURL(urlRecord); - } - if (urlString !== null) { - const resourceLoader = document._resourceLoader; - - const onLoadImage = data => { - let error = null; - this._image.onerror = err => { - error = err; - }; - - // eslint-disable-next-line no-restricted-globals -- The canvas package expects a Node.js `Buffer`. - this._image.src = Buffer.from(data.buffer, data.byteOffset, data.byteLength); - if (error) { - throw new Error(error); - } - this._currentSrc = srcAttributeValue; - this._currentRequestState = "completely available"; - }; - - resourceLoader.fetch(urlString, { - element: this, - onLoad: onLoadImage, - onError: () => { - this._currentRequestState = "broken"; - } - }); - } else { - this._image.src = ""; - } - } -} - -module.exports = { - implementation: HTMLImageElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLInputElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLInputElement-impl.js deleted file mode 100644 index 7968fef..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLInputElement-impl.js +++ /dev/null @@ -1,1097 +0,0 @@ -"use strict"; -const DOMException = require("../generated/DOMException"); -const FileList = require("../generated/FileList"); -const Decimal = require("decimal.js"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const idlUtils = require("../generated/utils"); -const DefaultConstraintValidationImpl = - require("../constraint-validation/DefaultConstraintValidation-impl").implementation; -const ValidityState = require("../generated/ValidityState"); -const { mixin } = require("../../utils"); -const { domSymbolTree, cloningSteps } = require("../helpers/internal-constants"); -const { getLabelsForLabelable, formOwner } = require("../helpers/form-controls"); -const { fireAnEvent } = require("../helpers/events"); -const { - isDisabled, - isValidEmailAddress, - isValidAbsoluteURL, - sanitizeValueByType -} = require("../helpers/form-controls"); -const { - asciiCaseInsensitiveMatch, - asciiLowercase, - parseFloatingPointNumber, - splitOnCommas -} = require("../helpers/strings"); -const { isDate } = require("../helpers/dates-and-times"); -const { - convertStringToNumberByType, - convertStringToDateByType, - serializeDateByType, - convertNumberToStringByType -} = require("../helpers/number-and-date-inputs"); - -const filesSymbol = Symbol("files"); - -// https://html.spec.whatwg.org/multipage/input.html#attr-input-type -const inputAllowedTypes = new Set([ - "hidden", "text", "search", "tel", "url", "email", "password", "date", - "month", "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio", - "file", "submit", "image", "reset", "button" -]); - -// https://html.spec.whatwg.org/multipage/input.html#concept-input-apply - -const variableLengthSelectionAllowedTypes = new Set(["text", "search", "url", "tel", "password"]); -const numericTypes = new Set(["date", "month", "week", "time", "datetime-local", "number", "range"]); - -const applicableTypesForIDLMember = { - valueAsDate: new Set(["date", "month", "week", "time"]), - valueAsNumber: numericTypes, - - select: new Set([ - "text", "search", "url", "tel", "email", "password", "date", "month", "week", - "time", "datetime-local", "number", "color", "file" - ]), - selectionStart: variableLengthSelectionAllowedTypes, - selectionEnd: variableLengthSelectionAllowedTypes, - selectionDirection: variableLengthSelectionAllowedTypes, - setRangeText: variableLengthSelectionAllowedTypes, - setSelectionRange: variableLengthSelectionAllowedTypes, - stepDown: numericTypes, - stepUp: numericTypes -}; - -const lengthPatternSizeTypes = new Set(["text", "search", "url", "tel", "email", "password"]); -const readonlyTypes = - new Set([...lengthPatternSizeTypes, "date", "month", "week", "time", "datetime-local", "number"]); - -const applicableTypesForContentAttribute = { - list: new Set(["text", "search", "url", "tel", "email", ...numericTypes, "color"]), - max: numericTypes, - maxlength: lengthPatternSizeTypes, - min: numericTypes, - minlength: lengthPatternSizeTypes, - multiple: new Set(["email", "file"]), - pattern: lengthPatternSizeTypes, - readonly: readonlyTypes, - required: new Set([...readonlyTypes, "checkbox", "radio", "file"]), - step: numericTypes -}; - -const valueAttributeDefaultMode = new Set(["hidden", "submit", "image", "reset", "button"]); -const valueAttributeDefaultOnMode = new Set(["checkbox", "radio"]); - -function valueAttributeMode(type) { - if (valueAttributeDefaultMode.has(type)) { - return "default"; - } - if (valueAttributeDefaultOnMode.has(type)) { - return "default/on"; - } - if (type === "file") { - return "filename"; - } - return "value"; -} - -function getTypeFromAttribute(typeAttribute) { - if (typeof typeAttribute !== "string") { - return "text"; - } - const type = asciiLowercase(typeAttribute); - return inputAllowedTypes.has(type) ? type : "text"; -} - -class HTMLInputElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._selectionStart = this._selectionEnd = 0; - this._selectionDirection = "none"; - this._value = ""; - this._dirtyValue = false; - this._checkedness = false; - this._dirtyCheckedness = false; - - this._preCheckedRadioState = null; - this._legacyActivationBehaviorPreviousIndeterminateState = false; - - this.indeterminate = false; - - this._customValidityErrorMessage = ""; - - this._labels = null; - - this._hasActivationBehavior = true; - } - - // https://html.spec.whatwg.org/multipage/input.html#concept-input-value-string-number - get _convertStringToNumber() { - return convertStringToNumberByType[this.type]; - } - - get _convertNumberToString() { - return convertNumberToStringByType[this.type]; - } - - get _convertDateToString() { - return serializeDateByType[this.type]; - } - - get _convertStringToDate() { - return convertStringToDateByType[this.type]; - } - - _isStepAligned(v) { - return new Decimal(v).minus(this._stepBase) - .modulo(this._allowedValueStep) - .isZero(); - } - - // Returns a Decimal. - _stepAlign(v, roundUp) { - const allowedValueStep = this._allowedValueStep; - const stepBase = this._stepBase; - - return new Decimal(v).minus(stepBase) - .toNearest(allowedValueStep, roundUp ? Decimal.ROUND_UP : Decimal.ROUND_DOWN) - .add(stepBase); - } - - // For <input>, https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fe-value - // is a simple value that is gotten and set, not computed. - _getValue() { - return this._value; - } - - _legacyPreActivationBehavior() { - if (this.type === "checkbox") { - this.checked = !this.checked; - this._legacyActivationBehaviorPreviousIndeterminateState = this.indeterminate; - this.indeterminate = false; - } else if (this.type === "radio") { - this._preCheckedRadioState = this.checked; - this.checked = true; - } - } - - _legacyCanceledActivationBehavior() { - if (this.type === "checkbox") { - this.checked = !this.checked; - this.indeterminate = this._legacyActivationBehaviorPreviousIndeterminateState; - } else if (this.type === "radio") { - if (this._preCheckedRadioState !== null) { - this.checked = this._preCheckedRadioState; - this._preCheckedRadioState = null; - } - } - } - - _activationBehavior(event) { - if (!this._mutable && this.type !== "checkbox" && this.type !== "radio") { - return; - } - - const { form } = this; - - if (this.type === "checkbox" || (this.type === "radio" && !this._preCheckedRadioState)) { - if (this.isConnected) { - fireAnEvent("input", this, undefined, { bubbles: true }); - fireAnEvent("change", this, undefined, { bubbles: true }); - } - } else if (form && this.type === "image") { - // https://html.spec.whatwg.org/multipage/input.html#image-button-state-(type=image):input-activation-behavior - - // TODO: if/when layout is implemented, record the selected coordinate at the start of dispatch and use it here, - // rather than relying on these getters that just mirror pageX/Y outside of dispatch - this._selectedCoordinate = { x: event.offsetX, y: event.offsetY }; - form._doRequestSubmit(this); - } else if (form && this.type === "submit") { - form._doRequestSubmit(this); - } else if (form && this.type === "reset") { - form._doReset(); - } - } - - _attrModified(name, value, oldVal) { - const wrapper = idlUtils.wrapperForImpl(this); - if (!this._dirtyValue && name === "value") { - this._value = sanitizeValueByType(this, wrapper.defaultValue); - } - if (!this._dirtyCheckedness && name === "checked") { - this._checkedness = wrapper.defaultChecked; - if (this._checkedness) { - this._removeOtherRadioCheckedness(); - } - } - - if (name === "name" || name === "type") { - if (this._checkedness) { - this._removeOtherRadioCheckedness(); - } - } - - if (name === "type") { - const prevType = getTypeFromAttribute(oldVal); - const curType = getTypeFromAttribute(value); - // When an input element's type attribute changes state… - if (prevType !== curType) { - const prevValueMode = valueAttributeMode(prevType); - const curValueMode = valueAttributeMode(curType); - if (prevValueMode === "value" && this._value !== "" && - (curValueMode === "default" || curValueMode === "default/on")) { - this.setAttributeNS(null, "value", this._value); - } else if (prevValueMode !== "value" && curValueMode === "value") { - this._value = this.getAttributeNS(null, "value") || ""; - this._dirtyValue = false; - } else if (prevValueMode !== "filename" && curValueMode === "filename") { - this._value = ""; - } - - this._signalATypeChange(); - - this._value = sanitizeValueByType(this, this._value); - - const previouslySelectable = this._idlMemberApplies("setRangeText", prevType); - const nowSelectable = this._idlMemberApplies("setRangeText", curType); - if (!previouslySelectable && nowSelectable) { - this._selectionStart = 0; - this._selectionEnd = 0; - this._selectionDirection = "none"; - } - } - } - - super._attrModified(name, value, oldVal); - } - - // https://html.spec.whatwg.org/multipage/input.html#signal-a-type-change - _signalATypeChange() { - if (this._checkedness) { - this._removeOtherRadioCheckedness(); - } - } - - _formReset() { - const wrapper = idlUtils.wrapperForImpl(this); - this._value = sanitizeValueByType(this, wrapper.defaultValue); - this._dirtyValue = false; - this._checkedness = wrapper.defaultChecked; - this._dirtyCheckedness = false; - if (this._checkedness) { - this._removeOtherRadioCheckedness(); - } - } - - _changedFormOwner() { - if (this._checkedness) { - this._removeOtherRadioCheckedness(); - } - } - - get _otherRadioGroupElements() { - const wrapper = idlUtils.wrapperForImpl(this); - const root = this._radioButtonGroupRoot; - if (!root) { - return []; - } - - const result = []; - - const descendants = domSymbolTree.treeIterator(root); - for (const candidate of descendants) { - if (candidate._radioButtonGroupRoot !== root) { - continue; - } - - const candidateWrapper = idlUtils.wrapperForImpl(candidate); - if (!candidateWrapper.name || candidateWrapper.name !== wrapper.name) { - continue; - } - - if (candidate !== this) { - result.push(candidate); - } - } - return result; - } - - _removeOtherRadioCheckedness() { - for (const radioGroupElement of this._otherRadioGroupElements) { - radioGroupElement._checkedness = false; - } - } - - get _radioButtonGroupRoot() { - const wrapper = idlUtils.wrapperForImpl(this); - if (this.type !== "radio" || !wrapper.name) { - return null; - } - - let e = domSymbolTree.parent(this); - while (e) { - // root node of this home sub tree - // or the form element we belong to - if (!domSymbolTree.parent(e) || e._localName === "form") { - return e; - } - e = domSymbolTree.parent(e); - } - return null; - } - - _someInRadioGroup(name) { - if (this[name]) { - return true; - } - return this._otherRadioGroupElements.some(radioGroupElement => radioGroupElement[name]); - } - - get _mutable() { - return !isDisabled(this) && !this._hasAttributeAndApplies("readonly"); - } - - get labels() { - return getLabelsForLabelable(this); - } - - get form() { - return formOwner(this); - } - - get checked() { - return this._checkedness; - } - - set checked(checked) { - this._checkedness = Boolean(checked); - this._dirtyCheckedness = true; - if (this._checkedness) { - this._removeOtherRadioCheckedness(); - } - } - - get value() { - switch (valueAttributeMode(this.type)) { - // https://html.spec.whatwg.org/multipage/input.html#dom-input-value-value - case "value": - return this._getValue(); - // https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default - case "default": { - const attr = this.getAttributeNS(null, "value"); - return attr !== null ? attr : ""; - } - // https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on - case "default/on": { - const attr = this.getAttributeNS(null, "value"); - return attr !== null ? attr : "on"; - } - // https://html.spec.whatwg.org/multipage/input.html#dom-input-value-filename - case "filename": - return this.files.length ? "C:\\fakepath\\" + this.files[0].name : ""; - default: - throw new Error("jsdom internal error: unknown value attribute mode"); - } - } - - set value(val) { - switch (valueAttributeMode(this.type)) { - // https://html.spec.whatwg.org/multipage/input.html#dom-input-value-value - case "value": { - const oldValue = this._value; - this._value = sanitizeValueByType(this, val); - this._dirtyValue = true; - - if (oldValue !== this._value) { - this._selectionStart = this._selectionEnd = this._getValueLength(); - this._selectionDirection = "none"; - } - break; - } - - // https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default - // https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on - case "default": - case "default/on": - this.setAttributeNS(null, "value", val); - break; - - // https://html.spec.whatwg.org/multipage/input.html#dom-input-value-filename - case "filename": - if (val === "") { - this.files.length = 0; - } else { - throw DOMException.create(this._globalObject, [ - "This input element accepts a filename, which may only be programmatically set to the empty string.", - "InvalidStateError" - ]); - } - break; - - default: - throw new Error("jsdom internal error: unknown value attribute mode"); - } - } - - // https://html.spec.whatwg.org/multipage/input.html#dom-input-valueasdate - get valueAsDate() { - if (!this._idlMemberApplies("valueAsDate")) { - return null; - } - - const window = this._ownerDocument._defaultView; - const convertedValue = this._convertStringToDate(this._value); - - if (convertedValue instanceof Date) { - return new window.Date(convertedValue.getTime()); - } - - return null; - } - - set valueAsDate(v) { - if (!this._idlMemberApplies("valueAsDate")) { - throw DOMException.create(this._globalObject, [ - "Failed to set the 'valueAsDate' property on 'HTMLInputElement': This input element does not support Date " + - "values.", - "InvalidStateError" - ]); - } - - if (v !== null && !isDate(v)) { - throw new TypeError("Failed to set the 'valueAsDate' property on 'HTMLInputElement': The provided value is " + - "not a Date."); - } - - if (v === null || isNaN(v)) { - this._value = ""; - return; - } - - this._value = this._convertDateToString(v); - } - - // https://html.spec.whatwg.org/multipage/input.html#dom-input-valueasnumber - get valueAsNumber() { - if (!this._idlMemberApplies("valueAsNumber")) { - return NaN; - } - - const parsedValue = this._convertStringToNumber(this._value); - return parsedValue !== null ? parsedValue : NaN; - } - - set valueAsNumber(v) { - if (!isFinite(v) && !isNaN(v)) { - throw new TypeError("Failed to set infinite value as Number"); - } - - if (!this._idlMemberApplies("valueAsNumber")) { - throw DOMException.create(this._globalObject, [ - "Failed to set the 'valueAsNumber' property on 'HTMLInputElement': This input element does not support " + - "Number values.", - "InvalidStateError" - ]); - } - - if (isNaN(v)) { - this._value = ""; - } else { - this._value = this._convertNumberToString(v); - } - } - - // https://html.spec.whatwg.org/multipage/input.html#dom-input-stepup - _stepUpdate(n, isUp) { - const methodName = isUp ? "stepUp" : "stepDown"; - if (!this._idlMemberApplies(methodName)) { - throw DOMException.create(this._globalObject, [ - `Failed to invoke '${methodName}' method on 'HTMLInputElement': ` + - "This input element does not support Number values.", - "InvalidStateError" - ]); - } - - const allowedValueStep = this._allowedValueStep; - if (allowedValueStep === null) { - throw DOMException.create(this._globalObject, [ - `Failed to invoke '${methodName}' method on 'HTMLInputElement': ` + - "This input element does not support value step.", - "InvalidStateError" - ]); - } - - const min = this._minimum; - const max = this._maximum; - - if (min !== null && max !== null) { - if (min > max) { - return; - } - - const candidateStepValue = this._stepAlign(Decimal.add(min, allowedValueStep), /* roundUp = */ false); - if (candidateStepValue.lt(min) || candidateStepValue.gt(max)) { - return; - } - } - - let value = 0; - try { - value = this.valueAsNumber; - if (isNaN(value)) { // Empty value is parsed as NaN. - value = 0; - } - } catch { - // Step 5. Default value is 0. - } - value = new Decimal(value); - - const valueBeforeStepping = value; - - if (!this._isStepAligned(value)) { - value = this._stepAlign(value, /* roundUp = */ isUp); - } else { - let delta = Decimal.mul(n, allowedValueStep); - if (!isUp) { - delta = delta.neg(); - } - value = value.add(delta); - } - - if (min !== null && value.lt(min)) { - value = this._stepAlign(min, /* roundUp = */ true); - } - - if (max !== null && value.gt(max)) { - value = this._stepAlign(max, /* roundUp = */ false); - } - - if (isUp ? value.lt(valueBeforeStepping) : value.gt(valueBeforeStepping)) { - return; - } - - this._value = this._convertNumberToString(value.toNumber()); - } - - stepDown(n = 1) { - return this._stepUpdate(n, false); - } - - stepUp(n = 1) { - return this._stepUpdate(n, true); - } - - get files() { - if (this.type === "file") { - this[filesSymbol] ||= FileList.createImpl(this._globalObject); - } else { - this[filesSymbol] = null; - } - return this[filesSymbol]; - } - - set files(value) { - if (this.type === "file" && value !== null) { - this[filesSymbol] = value; - } - } - - get type() { - const typeAttribute = this.getAttributeNS(null, "type"); - return getTypeFromAttribute(typeAttribute); - } - - set type(type) { - this.setAttributeNS(null, "type", type); - } - - _dispatchSelectEvent() { - setTimeout(() => fireAnEvent("select", this, undefined, { bubbles: true, cancelable: false }), 0); - } - - _getValueLength() { - return typeof this.value === "string" ? this.value.length : 0; - } - - select() { - if (!this._idlMemberApplies("select")) { - return; - } - - this._selectionStart = 0; - this._selectionEnd = this._getValueLength(); - this._selectionDirection = "none"; - this._dispatchSelectEvent(); - } - - get selectionStart() { - if (!this._idlMemberApplies("selectionStart")) { - return null; - } - - return this._selectionStart; - } - - set selectionStart(start) { - if (!this._idlMemberApplies("selectionStart")) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - - this.setSelectionRange(start, Math.max(start, this._selectionEnd), this._selectionDirection); - } - - get selectionEnd() { - if (!this._idlMemberApplies("selectionEnd")) { - return null; - } - - return this._selectionEnd; - } - - set selectionEnd(end) { - if (!this._idlMemberApplies("selectionEnd")) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - - this.setSelectionRange(this._selectionStart, end, this._selectionDirection); - } - - get selectionDirection() { - if (!this._idlMemberApplies("selectionDirection")) { - return null; - } - - return this._selectionDirection; - } - - set selectionDirection(dir) { - if (!this._idlMemberApplies("selectionDirection")) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - - this.setSelectionRange(this._selectionStart, this._selectionEnd, dir); - } - - setSelectionRange(start, end, dir) { - if (!this._idlMemberApplies("setSelectionRange")) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - - this._selectionEnd = Math.min(end, this._getValueLength()); - this._selectionStart = Math.min(start, this._selectionEnd); - this._selectionDirection = dir === "forward" || dir === "backward" ? dir : "none"; - this._dispatchSelectEvent(); - } - - setRangeText(repl, start, end, selectionMode = "preserve") { - if (!this._idlMemberApplies("setRangeText")) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - - if (arguments.length < 2) { - start = this._selectionStart; - end = this._selectionEnd; - } else if (start > end) { - throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); - } - - start = Math.min(start, this._getValueLength()); - end = Math.min(end, this._getValueLength()); - - const val = this.value; - let selStart = this._selectionStart; - let selEnd = this._selectionEnd; - - this.value = val.slice(0, start) + repl + val.slice(end); - - const newEnd = start + repl.length; - - if (selectionMode === "select") { - this.setSelectionRange(start, newEnd); - } else if (selectionMode === "start") { - this.setSelectionRange(start, start); - } else if (selectionMode === "end") { - this.setSelectionRange(newEnd, newEnd); - } else { // preserve - const delta = repl.length - (end - start); - - if (selStart > end) { - selStart += delta; - } else if (selStart > start) { - selStart = start; - } - - if (selEnd > end) { - selEnd += delta; - } else if (selEnd > start) { - selEnd = newEnd; - } - - this.setSelectionRange(selStart, selEnd); - } - } - - // https://html.spec.whatwg.org/multipage/input.html#the-list-attribute - get list() { - const id = this._getAttributeIfApplies("list"); - if (!id) { - return null; - } - - const el = this.getRootNode({}).getElementById(id); - - if (el && el.localName === "datalist") { - return el; - } - - return null; - } - - // https://html.spec.whatwg.org/multipage/input.html#the-min-and-max-attributes - get _minimum() { - let min = this._defaultMinimum; - const attr = this._getAttributeIfApplies("min"); - if (attr !== null && this._convertStringToNumber !== undefined) { - const parsed = this._convertStringToNumber(attr); - if (parsed !== null) { - min = parsed; - } - } - return min; - } - - get _maximum() { - let max = this._defaultMaximum; - const attr = this._getAttributeIfApplies("max"); - if (attr !== null && this._convertStringToNumber !== undefined) { - const parsed = this._convertStringToNumber(attr); - if (parsed !== null) { - max = parsed; - } - } - return max; - } - - get _defaultMinimum() { - if (this.type === "range") { - return 0; - } - return null; - } - - get _defaultMaximum() { - if (this.type === "range") { - return 100; - } - return null; - } - - // https://html.spec.whatwg.org/multipage/input.html#concept-input-step - get _allowedValueStep() { - if (!this._contentAttributeApplies("step")) { - return null; - } - const attr = this.getAttributeNS(null, "step"); - if (attr === null) { - return this._defaultStep * this._stepScaleFactor; - } - if (asciiCaseInsensitiveMatch(attr, "any")) { - return null; - } - const parsedStep = parseFloatingPointNumber(attr); - if (parsedStep === null || parsedStep <= 0) { - return this._defaultStep * this._stepScaleFactor; - } - return parsedStep * this._stepScaleFactor; - } - - // https://html.spec.whatwg.org/multipage/input.html#concept-input-step-scale - get _stepScaleFactor() { - const dayInMilliseconds = 24 * 60 * 60 * 1000; - switch (this.type) { - case "week": - return 7 * dayInMilliseconds; - case "date": - return dayInMilliseconds; - case "datetime-local": - case "datetime": - case "time": - return 1000; - } - return 1; - } - - // https://html.spec.whatwg.org/multipage/input.html#concept-input-step-default - get _defaultStep() { - if (this.type === "datetime-local" || this.type === "datetime" || this.type === "time") { - return 60; - } - return 1; - } - - // https://html.spec.whatwg.org/multipage/input.html#concept-input-min-zero - get _stepBase() { - if (this._hasAttributeAndApplies("min")) { - const min = this._convertStringToNumber(this.getAttributeNS(null, "min")); - if (min !== null) { - return min; - } - } - if (this.hasAttributeNS(null, "value")) { - const value = this._convertStringToNumber(this.getAttributeNS(null, "value")); - if (value !== null) { - return value; - } - } - if (this._defaultStepBase !== null) { - return this._defaultStepBase; - } - return 0; - } - - // https://html.spec.whatwg.org/multipage/input.html#concept-input-step-default-base - get _defaultStepBase() { - if (this.type === "week") { - // The start of week 1970-W01 - return -259200000; - } - return null; - } - - // https://html.spec.whatwg.org/multipage/input.html#common-input-element-attributes - // When an attribute doesn't apply to an input element, user agents must ignore the attribute. - _contentAttributeApplies(attribute) { - return applicableTypesForContentAttribute[attribute].has(this.type); - } - - _hasAttributeAndApplies(attribute) { - return this._contentAttributeApplies(attribute) && this.hasAttributeNS(null, attribute); - } - - _getAttributeIfApplies(attribute) { - if (this._contentAttributeApplies(attribute)) { - return this.getAttributeNS(null, attribute); - } - return null; - } - - _idlMemberApplies(member, type = this.type) { - return applicableTypesForIDLMember[member].has(type); - } - - _barredFromConstraintValidationSpecialization() { - // https://html.spec.whatwg.org/multipage/input.html#hidden-state-(type=hidden) - // https://html.spec.whatwg.org/multipage/input.html#reset-button-state-(type=reset) - // https://html.spec.whatwg.org/multipage/input.html#button-state-(type=button) - const willNotValidateTypes = new Set(["hidden", "reset", "button"]); - // https://html.spec.whatwg.org/multipage/input.html#attr-input-readonly - const readOnly = this._hasAttributeAndApplies("readonly"); - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-disabled - return willNotValidateTypes.has(this.type) || readOnly; - } - - // https://html.spec.whatwg.org/multipage/input.html#concept-input-required - get _required() { - return this._hasAttributeAndApplies("required"); - } - - // https://html.spec.whatwg.org/multipage/input.html#has-a-periodic-domain - get _hasAPeriodicDomain() { - return this.type === "time"; - } - - // https://html.spec.whatwg.org/multipage/input.html#has-a-reversed-range - get _hasAReversedRange() { - return this._hasAPeriodicDomain && this._maximum < this._minimum; - } - - get validity() { - if (!this._validity) { - // Constraint validation: When an element has a reversed range, and the result of applying - // the algorithm to convert a string to a number to the string given by the element's value - // is a number, and the number obtained from that algorithm is more than the maximum and less - // than the minimum, the element is simultaneously suffering from an underflow and suffering - // from an overflow. - const reversedRangeSufferingOverUnderflow = () => { - const parsedValue = this._convertStringToNumber(this._value); - return parsedValue !== null && parsedValue > this._maximum && parsedValue < this._minimum; - }; - - const state = { - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-being-missing - valueMissing: () => { - // https://html.spec.whatwg.org/multipage/input.html#the-required-attribute - // Constraint validation: If the element is required, and its value IDL attribute applies - // and is in the mode value, and the element is mutable, and the element's value is the - // empty string, then the element is suffering from being missing. - // - // Note: As of today, the value IDL attribute always applies. - if (this._required && valueAttributeMode(this.type) === "value" && this._mutable && this._value === "") { - return true; - } - - switch (this.type) { - // https://html.spec.whatwg.org/multipage/input.html#checkbox-state-(type=checkbox) - // Constraint validation: If the element is required and its checkedness is - // false, then the element is suffering from being missing. - case "checkbox": - if (this._required && !this._checkedness) { - return true; - } - break; - - // https://html.spec.whatwg.org/multipage/input.html#radio-button-state-(type=radio) - // Constraint validation: If an element in the radio button group is required, - // and all of the input elements in the radio button group have a checkedness - // that is false, then the element is suffering from being missing. - case "radio": - if (this._someInRadioGroup("_required") && !this._someInRadioGroup("checked")) { - return true; - } - break; - - // https://html.spec.whatwg.org/multipage/input.html#file-upload-state-(type=file) - // Constraint validation: If the element is required and the list of selected files is - // empty, then the element is suffering from being missing. - case "file": - if (this._required && this.files.length === 0) { - return true; - } - break; - } - - return false; - }, - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-being-too-long - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-maxlength - // jsdom has no way at the moment to emulate a user interaction, so tooLong/tooShort have - // to be set to false. - tooLong: () => false, - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-being-too-short - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-minlength - tooShort: () => false, - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-an-overflow - rangeOverflow: () => { - // https://html.spec.whatwg.org/multipage/input.html#the-min-and-max-attributes - if (this._hasAReversedRange) { - return reversedRangeSufferingOverUnderflow(); - } - // Constraint validation: When the element has a maximum and does not have a reversed - // range, and the result of applying the algorithm to convert a string to a number to the - // string given by the element's value is a number, and the number obtained from that - // algorithm is more than the maximum, the element is suffering from an overflow. - if (this._maximum !== null) { - const parsedValue = this._convertStringToNumber(this._value); - if (parsedValue !== null && parsedValue > this._maximum) { - return true; - } - } - return false; - }, - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-an-underflow - rangeUnderflow: () => { - // https://html.spec.whatwg.org/multipage/input.html#the-min-and-max-attributes - if (this._hasAReversedRange) { - return reversedRangeSufferingOverUnderflow(); - } - // Constraint validation: When the element has a minimum and does not have a reversed - // range, and the result of applying the algorithm to convert a string to a number to the - // string given by the element's value is a number, and the number obtained from that - // algorithm is less than the minimum, the element is suffering from an underflow. - if (this._minimum !== null) { - const parsedValue = this._convertStringToNumber(this._value); - if (parsedValue !== null && parsedValue < this._minimum) { - return true; - } - } - return false; - }, - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-a-pattern-mismatch - patternMismatch: () => { - // https://html.spec.whatwg.org/multipage/input.html#the-pattern-attribute - if (this._value === "" || !this._hasAttributeAndApplies("pattern")) { - return false; - } - let regExp; - try { - const pattern = this.getAttributeNS(null, "pattern"); - // The pattern attribute should be matched against the entire value, not just any - // subset, so add ^ and $ anchors. But also check the validity of the regex itself - // first. - new RegExp(pattern, "v"); // eslint-disable-line no-new - regExp = new RegExp("^(?:" + pattern + ")$", "v"); - } catch { - return false; - } - if (this._hasAttributeAndApplies("multiple")) { - return !splitOnCommas(this._value).every(value => regExp.test(value)); - } - return !regExp.test(this._value); - }, - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-a-step-mismatch - // https://html.spec.whatwg.org/multipage/input.html#attr-input-step - stepMismatch: () => { - const allowedValueStep = this._allowedValueStep; - if (allowedValueStep === null) { - return false; - } - const number = this._convertStringToNumber(this._value); - return number !== null && !this._isStepAligned(number); - }, - - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-a-type-mismatch - typeMismatch: () => { - switch (this.type) { - // https://html.spec.whatwg.org/multipage/input.html#url-state-(type=url) - // Constraint validation: While the value of the element is neither the empty string - // nor a valid absolute URL, the element is suffering from a type mismatch. - case "url": - if (this._value !== "" && !isValidAbsoluteURL(this._value)) { - return true; - } - break; - - // https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type=email) - // Constraint validation [multiple=false]: While the value of the element is neither the empty - // string nor a single valid e - mail address, the element is suffering from a type mismatch. - // Constraint validation [multiple=true]: While the value of the element is not a valid e-mail address list, - // the element is suffering from a type mismatch. - case "email": - if (this._value !== "" && !isValidEmailAddress(this._getValue(), this.hasAttributeNS(null, "multiple"))) { - return true; - } - break; - } - return false; - } - }; - - this._validity = ValidityState.createImpl(this._globalObject, [], { - element: this, - state - }); - } - return this._validity; - } - - [cloningSteps](copy, node) { - copy._value = node._value; - copy._checkedness = node._checkedness; - copy._dirtyValue = node._dirtyValue; - copy._dirtyCheckedness = node._dirtyCheckedness; - } -} - -mixin(HTMLInputElementImpl.prototype, DefaultConstraintValidationImpl.prototype); - -module.exports = { - implementation: HTMLInputElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLIElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLIElement-impl.js deleted file mode 100644 index e592582..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLIElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLLIElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLLIElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLabelElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLabelElement-impl.js deleted file mode 100644 index ba6bcb4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLabelElement-impl.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const MouseEvent = require("../generated/MouseEvent"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const NODE_TYPE = require("../node-type"); -const { isLabelable, isDisabled, isInteractiveContent } = require("../helpers/form-controls"); -const { isInclusiveAncestor } = require("../helpers/node"); -const { fireAnEvent } = require("../helpers/events"); - -function sendClickToAssociatedNode(node) { - fireAnEvent("click", node, MouseEvent, { - bubbles: true, - cancelable: true, - view: node.ownerDocument ? node.ownerDocument.defaultView : null, - screenX: 0, - screenY: 0, - clientX: 0, - clientY: 0, - button: 0, - detail: 1, - relatedTarget: null - }); -} - -class HTMLLabelElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._hasActivationBehavior = true; - } - - get control() { - if (this.hasAttributeNS(null, "for")) { - const forValue = this.getAttributeNS(null, "for"); - if (forValue === "") { - return null; - } - const root = this.getRootNode({}); - for (const descendant of domSymbolTree.treeIterator(root)) { - if (descendant.nodeType === NODE_TYPE.ELEMENT_NODE && - descendant.getAttributeNS(null, "id") === forValue) { - return isLabelable(descendant) ? descendant : null; - } - } - return null; - } - for (const descendant of domSymbolTree.treeIterator(this)) { - if (isLabelable(descendant)) { - return descendant; - } - } - return null; - } - - get form() { - const node = this.control; - if (node) { - return node.form; - } - return null; - } - - _activationBehavior(event) { - // Check if the event's target is an inclusive descendant of any interactive content descendant of this <label>. - // If so, do nothing. - if (event.target && event.target !== this && isInclusiveAncestor(this, event.target)) { - for (const ancestor of domSymbolTree.ancestorsIterator(event.target)) { - if (ancestor === this) { - break; - } - if (isInteractiveContent(ancestor)) { - return; - } - } - } - - const node = this.control; - if (node && !isDisabled(node)) { - // Check if the control is an inclusive ancestor of the event's target (and has already received this event). - // If so, do nothing. - // See https://github.com/whatwg/html/issues/5415. - if (event.target && isInclusiveAncestor(node, event.target)) { - return; - } - - sendClickToAssociatedNode(node); - } - } -} - -module.exports = { - implementation: HTMLLabelElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLegendElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLegendElement-impl.js deleted file mode 100644 index e4d23dc..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLegendElement-impl.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { formOwner } = require("../helpers/form-controls"); -const { HTML_NS } = require("../helpers/namespaces"); - -class HTMLLegendElementImpl extends HTMLElementImpl { - get form() { - const parent = this.parentNode; - if (parent && parent._localName === "fieldset" && parent.namespaceURI === HTML_NS) { - return formOwner(parent); - } - return null; - } -} - -module.exports = { - implementation: HTMLLegendElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLinkElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLinkElement-impl.js deleted file mode 100644 index 81813a9..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLinkElement-impl.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; -const DOMTokenList = require("../generated/DOMTokenList"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const idlUtils = require("../generated/utils"); -const { fetchStylesheet, removeStylesheet } = require("../helpers/stylesheets"); -const whatwgURL = require("whatwg-url"); - -// Important reading: "appropriate times to obtain the resource" in -// https://html.spec.whatwg.org/multipage/semantics.html#link-type-stylesheet - -class HTMLLinkElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this.sheet = null; - } - - get relList() { - if (this._relList === undefined) { - this._relList = DOMTokenList.createImpl(this._globalObject, [], { - element: this, - attributeLocalName: "rel", - supportedTokens: new Set(["stylesheet"]) - }); - } - return this._relList; - } - - _attach() { - super._attach(); - maybeFetchAndProcess(this); - } - - _detach() { - super._detach(); - if (this.sheet) { - removeStylesheet(this.sheet, this); - } - } - - _attrModified(name, value, oldValue) { - super._attrModified(name, value, oldValue); - - if (name === "href") { // TODO crossorigin="" or type="" - maybeFetchAndProcess(this); - } - - if (name === "rel" && this._relList !== undefined) { - this._relList.attrModified(); - } - } - - get _accept() { - return "text/css,*/*;q=0.1"; - } -} - -module.exports = { - implementation: HTMLLinkElementImpl -}; - -// https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet -function maybeFetchAndProcess(el) { - if (!isExternalResourceLink(el)) { - return; - } - - // Browsing-context connected - if (!el.isConnected || !el._ownerDocument._defaultView) { - return; - } - - fetchAndProcess(el); -} - -// https://html.spec.whatwg.org/multipage/semantics.html#default-fetch-and-process-the-linked-resource -// TODO: refactor into general link-fetching like the spec. -function fetchAndProcess(el) { - const href = el.getAttributeNS(null, "href"); - - if (href === null || href === "") { - return; - } - - const url = el._ownerDocument.encodingParseAURL(href); - if (url === null) { - return; - } - - // TODO handle crossorigin="", nonce, integrity="", referrerpolicy="" - - const serialized = whatwgURL.serializeURL(url); - - fetchStylesheet(el, serialized); -} - -function isExternalResourceLink(el) { - // for our purposes, only stylesheets can be external resource links - const wrapper = idlUtils.wrapperForImpl(el); - if (!/(?:[ \t\n\r\f]|^)stylesheet(?:[ \t\n\r\f]|$)/i.test(wrapper.rel)) { - // rel is a space-separated list of tokens, and the original rel types - // are case-insensitive. - return false; - } - - return el.hasAttributeNS(null, "href"); -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMapElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMapElement-impl.js deleted file mode 100644 index b431dad..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMapElement-impl.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLMapElementImpl extends HTMLElementImpl { - get areas() { - return this.getElementsByTagName("AREA"); - } -} - -module.exports = { - implementation: HTMLMapElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMarqueeElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMarqueeElement-impl.js deleted file mode 100644 index 66371cb..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMarqueeElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLMarqueeElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLMarqueeElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMediaElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMediaElement-impl.js deleted file mode 100644 index 228803f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMediaElement-impl.js +++ /dev/null @@ -1,138 +0,0 @@ -"use strict"; -const DOMException = require("../generated/DOMException"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { notImplementedMethod } = require("../../browser/not-implemented"); -const { fireAnEvent } = require("../helpers/events"); - -function getTimeRangeDummy() { - return { - length: 0, - start() { - return 0; - }, - end() { - return 0; - } - }; -} - -class HTMLMediaElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._muted = false; - this._volume = 1.0; - this.readyState = 0; - this.networkState = 0; - this.currentTime = 0; - this.currentSrc = ""; - this.buffered = getTimeRangeDummy(); - this.seeking = false; - this.duration = NaN; - this.paused = true; - this.played = getTimeRangeDummy(); - this.seekable = getTimeRangeDummy(); - this.ended = false; - this.audioTracks = []; - this.videoTracks = []; - this.textTracks = []; - } - - get defaultPlaybackRate() { - if (this._defaultPlaybackRate === undefined) { - return 1.0; - } - return this._defaultPlaybackRate; - } - - set defaultPlaybackRate(v) { - if (v === 0.0) { - throw DOMException.create(this._globalObject, ["The operation is not supported.", "NotSupportedError"]); - } - if (this._defaultPlaybackRate !== v) { - this._defaultPlaybackRate = v; - this._dispatchRateChange(); - } - } - - get playbackRate() { - if (this._playbackRate === undefined) { - return 1.0; - } - return this._playbackRate; - } - - set playbackRate(v) { - if (v !== this._playbackRate) { - this._playbackRate = v; - this._dispatchRateChange(); - } - } - - get muted() { - return this._muted; - } - - set muted(v) { - if (v !== this._muted) { - this._muted = v; - this._dispatchVolumeChange(); - } - } - - get defaultMuted() { - return this.getAttributeNS(null, "muted") !== null; - } - - set defaultMuted(v) { - if (v) { - this.setAttributeNS(null, "muted", v); - } else { - this.removeAttributeNS(null, "muted"); - } - } - - get volume() { - return this._volume; - } - - set volume(v) { - if (v < 0 || v > 1) { - throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); - } - if (this._volume !== v) { - this._volume = v; - this._dispatchVolumeChange(); - } - } - - // Not (yet) implemented according to spec - // Should return sane default values - load() { - notImplementedMethod(this._ownerDocument._defaultView, "HTMLMediaElement", "load"); - } - canPlayType() { - return ""; - } - play() { - notImplementedMethod(this._ownerDocument._defaultView, "HTMLMediaElement", "play"); - } - pause() { - notImplementedMethod(this._ownerDocument._defaultView, "HTMLMediaElement", "pause"); - } - addTextTrack() { - notImplementedMethod(this._ownerDocument._defaultView, "HTMLMediaElement", "addTextTrack"); - } - - _dispatchRateChange() { - fireAnEvent("ratechange", this); - } - - _dispatchVolumeChange() { - fireAnEvent("volumechange", this); - } -} - -module.exports = { - implementation: HTMLMediaElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMenuElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMenuElement-impl.js deleted file mode 100644 index 4faf848..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMenuElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLMenuElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLMenuElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMetaElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMetaElement-impl.js deleted file mode 100644 index ff038f2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMetaElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLMetaElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLMetaElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMeterElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMeterElement-impl.js deleted file mode 100644 index 25aeef0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMeterElement-impl.js +++ /dev/null @@ -1,180 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { parseFloatingPointNumber } = require("../helpers/strings"); -const { getLabelsForLabelable } = require("../helpers/form-controls"); - -class HTMLMeterElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._labels = null; - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-meter-minimum - get _minimumValue() { - const min = this.getAttributeNS(null, "min"); - if (min !== null) { - const parsed = parseFloatingPointNumber(min); - if (parsed !== null) { - return parsed; - } - } - return 0; - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-meter-maximum - get _maximumValue() { - let candidate = 1.0; - - const max = this.getAttributeNS(null, "max"); - if (max !== null) { - const parsed = parseFloatingPointNumber(max); - if (parsed !== null) { - candidate = parsed; - } - } - - const minimumValue = this._minimumValue; - return candidate >= minimumValue ? candidate : minimumValue; - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-meter-actual - get _actualValue() { - let candidate = 0; - - const value = this.getAttributeNS(null, "value"); - if (value !== null) { - const parsed = parseFloatingPointNumber(value); - if (parsed !== null) { - candidate = parsed; - } - } - - const minimumValue = this._minimumValue; - if (candidate < minimumValue) { - return minimumValue; - } - - const maximumValue = this._maximumValue; - return candidate > maximumValue ? maximumValue : candidate; - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-meter-low - get _lowBoundary() { - const minimumValue = this._minimumValue; - let candidate = minimumValue; - - const low = this.getAttributeNS(null, "low"); - if (low !== null) { - const parsed = parseFloatingPointNumber(low); - if (parsed !== null) { - candidate = parsed; - } - } - - if (candidate < minimumValue) { - return minimumValue; - } - - const maximumValue = this._maximumValue; - return candidate > maximumValue ? maximumValue : candidate; - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-meter-high - get _highBoundary() { - const maximumValue = this._maximumValue; - let candidate = maximumValue; - - const high = this.getAttributeNS(null, "high"); - if (high !== null) { - const parsed = parseFloatingPointNumber(high); - if (parsed !== null) { - candidate = parsed; - } - } - - const lowBoundary = this._lowBoundary; - if (candidate < lowBoundary) { - return lowBoundary; - } - - return candidate > maximumValue ? maximumValue : candidate; - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-meter-optimum - get _optimumPoint() { - const minimumValue = this._minimumValue; - const maximumValue = this._maximumValue; - let candidate = (minimumValue + maximumValue) / 2; - - const optimum = this.getAttributeNS(null, "optimum"); - if (optimum !== null) { - const parsed = parseFloatingPointNumber(optimum); - if (parsed !== null) { - candidate = parsed; - } - } - - if (candidate < minimumValue) { - return minimumValue; - } - - return candidate > maximumValue ? maximumValue : candidate; - } - - get labels() { - return getLabelsForLabelable(this); - } - - get value() { - return this._actualValue; - } - - set value(val) { - this.setAttributeNS(null, "value", String(val)); - } - - get min() { - return this._minimumValue; - } - - set min(val) { - this.setAttributeNS(null, "min", String(val)); - } - - get max() { - return this._maximumValue; - } - - set max(val) { - this.setAttributeNS(null, "max", String(val)); - } - - get low() { - return this._lowBoundary; - } - - set low(val) { - this.setAttributeNS(null, "low", String(val)); - } - - get high() { - return this._highBoundary; - } - - set high(val) { - this.setAttributeNS(null, "high", String(val)); - } - - get optimum() { - return this._optimumPoint; - } - - set optimum(val) { - this.setAttributeNS(null, "optimum", String(val)); - } -} - -module.exports = { - implementation: HTMLMeterElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLModElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLModElement-impl.js deleted file mode 100644 index a6cb046..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLModElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLModElementImpl extends HTMLElementImpl {} - -module.exports = { - implementation: HTMLModElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOListElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOListElement-impl.js deleted file mode 100644 index b7d207f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOListElement-impl.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLOListElementImpl extends HTMLElementImpl { - get start() { - const value = parseInt(this.getAttributeNS(null, "start")); - - if (!isNaN(value)) { - return value; - } - - return 1; - } - set start(value) { - this.setAttributeNS(null, "start", value); - } -} - -module.exports = { - implementation: HTMLOListElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLObjectElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLObjectElement-impl.js deleted file mode 100644 index f9e2249..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLObjectElement-impl.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const DefaultConstraintValidationImpl = - require("../constraint-validation/DefaultConstraintValidation-impl").implementation; -const { mixin } = require("../../utils"); -const { formOwner } = require("../helpers/form-controls"); - -class HTMLObjectElementImpl extends HTMLElementImpl { - get form() { - return formOwner(this); - } - - get contentDocument() { - return null; - } - - _barredFromConstraintValidationSpecialization() { - return true; - } -} - -mixin(HTMLObjectElementImpl.prototype, DefaultConstraintValidationImpl.prototype); - -module.exports = { - implementation: HTMLObjectElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptGroupElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptGroupElement-impl.js deleted file mode 100644 index 28d9348..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptGroupElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLOptGroupElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLOptGroupElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionElement-impl.js deleted file mode 100644 index 4448127..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionElement-impl.js +++ /dev/null @@ -1,146 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const NODE_TYPE = require("../node-type"); -const { stripAndCollapseASCIIWhitespace } = require("../helpers/strings"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const { HTML_NS, SVG_NS } = require("../helpers/namespaces"); -const { closest } = require("../helpers/traversal"); -const { formOwner } = require("../helpers/form-controls"); - -class HTMLOptionElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - // whenever selectedness is set to true, make sure all - // other options set selectedness to false - this._selectedness = false; - this._dirtyness = false; - } - - _removeOtherSelectedness() { - // Remove the selectedness flag from all other options in this select - const select = this._selectNode; - - if (select && !select.hasAttributeNS(null, "multiple")) { - for (const option of select.options) { - if (option !== this) { - option._selectedness = false; - } - } - } - } - - _askForAReset() { - const select = this._selectNode; - if (select) { - select._askedForAReset(); - } - } - - _attrModified(name, value, oldValue) { - if (!this._dirtyness && name === "selected") { - this._selectedness = this.hasAttributeNS(null, "selected"); - if (this._selectedness) { - this._removeOtherSelectedness(); - } - this._askForAReset(); - } - super._attrModified(name, value, oldValue); - } - - get _selectNode() { - let select = domSymbolTree.parent(this); - if (!select) { - return null; - } - - if (select._localName !== "select") { - select = domSymbolTree.parent(select); - if (!select || select._localName !== "select") { - return null; - } - } - return select; - } - - get form() { - return formOwner(this); - } - - get text() { - return stripAndCollapseASCIIWhitespace(childTextContentExcludingDescendantsOfScript(this)); - } - set text(value) { - this.textContent = value; - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-value - _getValue() { - if (this.hasAttributeNS(null, "value")) { - return this.getAttributeNS(null, "value"); - } - - return this.text; - } - - get value() { - return this._getValue(); - } - set value(value) { - this.setAttributeNS(null, "value", value); - } - - get index() { - const select = closest(this, "select"); - if (select === null) { - return 0; - } - - return select.options.indexOf(this); - } - - get selected() { - return this._selectedness; - } - set selected(s) { - this._dirtyness = true; - this._selectedness = Boolean(s); - if (this._selectedness) { - this._removeOtherSelectedness(); - } - this._askForAReset(); - this._modified(); - } - - get label() { - if (this.hasAttributeNS(null, "label")) { - return this.getAttributeNS(null, "label"); - } - - return this.text; - } - set label(value) { - this.setAttributeNS(null, "label", value); - } -} - -function childTextContentExcludingDescendantsOfScript(root) { - let text = ""; - for (const child of domSymbolTree.childrenIterator(root)) { - if (child._localName === "script" && (child._namespaceURI === HTML_NS || child._namespaceURI === SVG_NS)) { - continue; - } - - if (child.nodeType === NODE_TYPE.TEXT_NODE || child.nodeType === NODE_TYPE.CDATA_SECTION_NODE) { - text += child.nodeValue; - } else { - text += childTextContentExcludingDescendantsOfScript(child); - } - } - return text; -} - -module.exports = { - implementation: HTMLOptionElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionsCollection-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionsCollection-impl.js deleted file mode 100644 index c414f68..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionsCollection-impl.js +++ /dev/null @@ -1,110 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils.js"); -const DOMException = require("../generated/DOMException"); -const { DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_CONTAINED_BY } = require("../node-document-position"); -const Element = require("../generated/Element"); -const Node = require("../generated/Node"); -const HTMLCollectionImpl = require("./HTMLCollection-impl").implementation; - -exports.implementation = class HTMLOptionsCollectionImpl extends HTMLCollectionImpl { - // inherits supported property indices - get length() { - this._update(); - return this._list.length; - } - set length(value) { - this._update(); - if (value > this._list.length) { - const doc = this._element._ownerDocument; - for (let i = this._list.length; i < value; i++) { - const el = doc.createElement("option"); - this._element.appendChild(el); - } - } else if (value < this._list.length) { - for (let i = this._list.length - 1; i >= value; i--) { - const el = this._list[i]; - this._element.removeChild(el); - } - } - } - - get [idlUtils.supportedPropertyNames]() { - this._update(); - const result = new Set(); - for (const element of this._list) { - result.add(element.getAttributeNS(null, "id")); - result.add(element.getAttributeNS(null, "name")); - } - return result; - } - [idlUtils.indexedSetNew](index, value) { - if (value === null) { - this.remove(index); - return; - } - this._update(); - const { length } = this._list; - const n = index - length; - if (n > 0) { - const doc = this._element._ownerDocument; - const frag = doc.createDocumentFragment(); - // Spec says n - 1, but n seems to be the right number here. - for (let i = 0; i < n; i++) { - const el = doc.createElement("option"); - frag.appendChild(el); - } - this._element._append(frag); - } - if (n >= 0) { - this._element._append(value); - } else { - this._element._replace(value, this._list[index]); - } - } - [idlUtils.indexedSetExisting](index, value) { - return this[idlUtils.indexedSetNew](index, value); - } - add(element, before) { - if (this._element.compareDocumentPosition(element) & DOCUMENT_POSITION_CONTAINS) { - throw DOMException.create(this._globalObject, [ - "The operation would yield an incorrect node tree.", - "HierarchyRequestError" - ]); - } - if (Element.isImpl(before) && !(this._element.compareDocumentPosition(before) & DOCUMENT_POSITION_CONTAINED_BY)) { - throw DOMException.create(this._globalObject, ["The object can not be found here.", "NotFoundError"]); - } - if (element === before) { - return; - } - - let reference = null; - if (Node.isImpl(before)) { - reference = before; - } else if (typeof before === "number") { - this._update(); - reference = this._list[before] || null; - } - - const parent = reference !== null ? reference.parentNode : this._element; - parent._preInsert(element, reference); - } - remove(index) { - this._update(); - if (this._list.length === 0) { - return; - } - if (index < 0 || index >= this._list.length) { - return; - } - const element = this._list[index]; - element.parentNode._remove(element); - } - get selectedIndex() { - return this._element.selectedIndex; - } - set selectedIndex(value) { - this._element.selectedIndex = value; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOrSVGElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOrSVGElement-impl.js deleted file mode 100644 index a0fd169..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOrSVGElement-impl.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); -const { isSummaryForParentDetails } = require("../helpers/details"); -const focusing = require("../helpers/focusing"); -const { HTML_NS, SVG_NS } = require("../helpers/namespaces"); -const DOMStringMap = require("../generated/DOMStringMap"); - -const tabIndexReflectAllowedHTMLElements = new Set([ - "a", "area", "button", "frame", "iframe", - "input", "object", "select", "textarea" -]); - -class HTMLOrSVGElementImpl { - _initHTMLOrSVGElement() { - this._tabIndex = 0; - this._dataset = null; - } - - get dataset() { - if (!this._dataset) { - this._dataset = DOMStringMap.createImpl(this._globalObject, [], { element: this }); - } - return this._dataset; - } - - // TODO this should be [Reflect]able if we added default value support to webidl2js's [Reflect] - get tabIndex() { - if (!this.hasAttributeNS(null, "tabindex")) { - if ((this.namespaceURI === HTML_NS && (tabIndexReflectAllowedHTMLElements.has(this._localName) || - (this._localName === "summary" && isSummaryForParentDetails(this)))) || - (this.namespaceURI === SVG_NS && this._localName === "a")) { - return 0; - } - return -1; - } - return conversions.long(this.getAttributeNS(null, "tabindex")); - } - - set tabIndex(value) { - this.setAttributeNS(null, "tabindex", String(value)); - } - - focus() { - if (!focusing.isFocusableAreaElement(this)) { - return; - } - const ownerDocument = this._ownerDocument; - const previous = ownerDocument._lastFocusedElement; - - if (previous === this) { - return; - } - - ownerDocument._lastFocusedElement = null; - if (previous) { - focusing.fireFocusEventWithTargetAdjustment("blur", previous, this); - focusing.fireFocusEventWithTargetAdjustment("focusout", previous, this, { bubbles: true }); - } else { - const frameElement = ownerDocument._defaultView._frameElement; - if (frameElement) { - const frameLastFocusedElement = frameElement.ownerDocument._lastFocusedElement; - frameElement.ownerDocument._lastFocusedElement = null; - focusing.fireFocusEventWithTargetAdjustment("blur", frameLastFocusedElement, null); - focusing.fireFocusEventWithTargetAdjustment("focusout", frameLastFocusedElement, null, { bubbles: true }); - frameElement.ownerDocument._lastFocusedElement = frameElement; - } - } - - ownerDocument._lastFocusedElement = this; - focusing.fireFocusEventWithTargetAdjustment("focus", this, previous); - focusing.fireFocusEventWithTargetAdjustment("focusin", this, previous, { bubbles: true }); - ownerDocument.getSelection().collapse(this, 0); - } - - blur() { - if (this._ownerDocument._lastFocusedElement !== this || !focusing.isFocusableAreaElement(this)) { - return; - } - - this._ownerDocument._lastFocusedElement = null; - focusing.fireFocusEventWithTargetAdjustment("blur", this, null); - focusing.fireFocusEventWithTargetAdjustment("focusout", this, null, { bubbles: true }); - this._ownerDocument.getSelection().empty(); - } -} - -exports.implementation = HTMLOrSVGElementImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOutputElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOutputElement-impl.js deleted file mode 100644 index 9752bdb..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOutputElement-impl.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; - -const DOMTokenList = require("../generated/DOMTokenList"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const DefaultConstraintValidationImpl = - require("../constraint-validation/DefaultConstraintValidation-impl").implementation; -const { mixin } = require("../../utils"); -const { getLabelsForLabelable, formOwner } = require("../helpers/form-controls"); - -class HTMLOutputElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._labels = null; - this._defaultValueOverride = null; - - this._customValidityErrorMessage = ""; - } - - _attrModified(name, value, oldValue) { - super._attrModified(name, value, oldValue); - - if (name === "for" && this._htmlFor !== undefined) { - this._htmlFor.attrModified(); - } - } - - _barredFromConstraintValidationSpecialization() { - return true; - } - - _formReset() { - this.textContent = this.defaultValue; - this._defaultValueOverride = null; - } - - get htmlFor() { - if (this._htmlFor === undefined) { - this._htmlFor = DOMTokenList.createImpl(this._globalObject, [], { - element: this, - attributeLocalName: "for" - }); - } - return this._htmlFor; - } - - get type() { - return "output"; - } - - get labels() { - return getLabelsForLabelable(this); - } - - get form() { - return formOwner(this); - } - - get value() { - return this.textContent; - } - - set value(val) { - this._defaultValueOverride = this.defaultValue; - this.textContent = val; - } - - get defaultValue() { - if (this._defaultValueOverride !== null) { - return this._defaultValueOverride; - } - return this.textContent; - } - - set defaultValue(val) { - if (this._defaultValueOverride === null) { - this.textContent = val; - return; - } - - this._defaultValueOverride = val; - } -} - -mixin(HTMLOutputElementImpl.prototype, DefaultConstraintValidationImpl.prototype); - -module.exports = { - implementation: HTMLOutputElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLParagraphElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLParagraphElement-impl.js deleted file mode 100644 index 01495c6..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLParagraphElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLParagraphElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLParagraphElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLParamElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLParamElement-impl.js deleted file mode 100644 index 05e4f8c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLParamElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLParamElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLParamElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLPictureElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLPictureElement-impl.js deleted file mode 100644 index 6d2062f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLPictureElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLPictureElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLPictureElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLPreElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLPreElement-impl.js deleted file mode 100644 index 85b11db..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLPreElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLPreElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLPreElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLProgressElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLProgressElement-impl.js deleted file mode 100644 index 7291628..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLProgressElement-impl.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { getLabelsForLabelable } = require("../helpers/form-controls"); -const { parseFloatingPointNumber } = require("../helpers/strings"); - -class HTMLProgressElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._labels = null; - } - - get _isDeterminate() { - return this.hasAttributeNS(null, "value"); - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-progress-value - get _value() { - const valueAttr = this.getAttributeNS(null, "value"); - if (valueAttr !== null) { - const parsedValue = parseFloatingPointNumber(valueAttr); - if (parsedValue !== null && parsedValue > 0) { - return parsedValue; - } - } - return 0; - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-progress-current-value - get _currentValue() { - const value = this._value; - return value > this._maximumValue ? this._maximumValue : value; - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#concept-progress-maximum - get _maximumValue() { - const maxAttr = this.getAttributeNS(null, "max"); - if (maxAttr !== null) { - const parsedMax = parseFloatingPointNumber(maxAttr); - if (parsedMax !== null && parsedMax > 0) { - return parsedMax; - } - } - return 1.0; - } - - get value() { - if (this._isDeterminate) { - return this._currentValue; - } - return 0; - } - set value(value) { - this.setAttributeNS(null, "value", value); - } - - get position() { - if (!this._isDeterminate) { - return -1; - } - - return this._currentValue / this._maximumValue; - } - - get labels() { - return getLabelsForLabelable(this); - } -} - -module.exports = { - implementation: HTMLProgressElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLQuoteElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLQuoteElement-impl.js deleted file mode 100644 index 97e96ea..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLQuoteElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLQuoteElementImpl extends HTMLElementImpl {} - -module.exports = { - implementation: HTMLQuoteElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js deleted file mode 100644 index 68c8e6f..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js +++ /dev/null @@ -1,255 +0,0 @@ -"use strict"; -const vm = require("vm"); -const { getBOMEncoding, labelToName, legacyHookDecode } = require("@exodus/bytes/encoding.js"); -const { MIMEType } = require("whatwg-mimetype"); -const { serializeURL } = require("whatwg-url"); - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const reportException = require("../helpers/runtime-script-errors"); -const { domSymbolTree, cloningSteps } = require("../helpers/internal-constants"); -const { asciiLowercase } = require("../helpers/strings"); -const { childTextContent } = require("../helpers/text"); -const nodeTypes = require("../node-type"); - -const jsMIMETypes = new Set([ - "application/ecmascript", - "application/javascript", - "application/x-ecmascript", - "application/x-javascript", - "text/ecmascript", - "text/javascript", - "text/javascript1.0", - "text/javascript1.1", - "text/javascript1.2", - "text/javascript1.3", - "text/javascript1.4", - "text/javascript1.5", - "text/jscript", - "text/livescript", - "text/x-ecmascript", - "text/x-javascript" -]); - -class HTMLScriptElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._alreadyStarted = false; - this._parserInserted = false; // set by the parser - } - - _attach() { - super._attach(); - - - // In our current terribly-hacky document.write() implementation, we parse in a div them move elements into the main - // document. Thus _eval() will bail early when it gets in _poppedOffStackOfOpenElements(), since we're not attached - // then. Instead, we'll let it eval here. - if (!this._parserInserted || this._isMovingDueToDocumentWrite) { - this._eval(); - } - } - - _canRunScript() { - const document = this._ownerDocument; - // Equivalent to the spec's "scripting is disabled" check. - if (!document._defaultView || document._defaultView._runScripts !== "dangerously" || document._scriptingDisabled) { - return false; - } - - return true; - } - - _fetchExternalScript() { - const document = this._ownerDocument; - const resourceLoader = document._resourceLoader; - const defaultEncoding = labelToName(this.getAttributeNS(null, "charset")) || document._encoding; - - if (!this._canRunScript()) { - return; - } - - const src = this.getAttributeNS(null, "src"); - const url = this._ownerDocument.encodingParseAURL(src); - if (url === null) { - return; - } - const urlString = serializeURL(url); - - const onLoadExternalScript = (data, response) => { - if (!response.ok) { - throw new Error("Status code: " + response.status); - } - - const contentType = MIMEType.parse(response.headers.get("content-type")) || new MIMEType("text/plain"); - - const encoding = labelToName(getBOMEncoding(data)) || - labelToName(contentType.parameters.get("charset")) || - defaultEncoding; - const script = legacyHookDecode(data, encoding); - - this._innerEval(script, urlString); - }; - - resourceLoader.fetch(urlString, { - element: this, - onLoad: onLoadExternalScript - }); - } - - _fetchInternalScript() { - const document = this._ownerDocument; - - if (!this._canRunScript()) { - return; - } - - document._queue.push(null, () => { - this._innerEval(this.text, document.URL); - }, null, false, this); - } - - _attrModified(name, value, oldValue) { - super._attrModified(name, value, oldValue); - - if (this._attached && !this._startedEval && name === "src" && oldValue === null && value !== null) { - this._fetchExternalScript(); - } - } - - _poppedOffStackOfOpenElements() { - // This seems to roughly correspond to - // https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-incdata:prepare-a-script, although we certainly - // don't implement the full semantics. - this._eval(); - } - - // Vaguely similar to https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script, but we have a long way - // to go before it's aligned. - _eval() { - if (this._alreadyStarted) { - return; - } - - // TODO: this text check doesn't seem completely the same as the spec, which e.g. will try to execute scripts with - // child element nodes. Spec bug? https://github.com/whatwg/html/issues/3419 - if (!this.hasAttributeNS(null, "src") && this.text.length === 0) { - return; - } - - if (!this._attached) { - return; - } - - const scriptBlocksTypeString = this._getTypeString(); - const type = getType(scriptBlocksTypeString); - - if (type !== "classic") { - // TODO: implement modules, and then change the check to `type === null`. - return; - } - - this._alreadyStarted = true; - - // TODO: implement nomodule here, **but only after we support modules**. - - // At this point we completely depart from the spec. - - if (this.hasAttributeNS(null, "src")) { - this._fetchExternalScript(); - } else { - this._fetchInternalScript(); - } - } - - _innerEval(text, filename) { - this._ownerDocument._writeAfterElement = this; - processJavaScript(this, text, filename); - delete this._ownerDocument._writeAfterElement; - } - - _getTypeString() { - const typeAttr = this.getAttributeNS(null, "type"); - const langAttr = this.getAttributeNS(null, "language"); - - if (typeAttr === "") { - return "text/javascript"; - } - - if (typeAttr === null && langAttr === "") { - return "text/javascript"; - } - - if (typeAttr === null && langAttr === null) { - return "text/javascript"; - } - - if (typeAttr !== null) { - return typeAttr.trim(); - } - - if (langAttr !== null) { - return "text/" + langAttr; - } - - return null; - } - - get text() { - return childTextContent(this); - } - - set text(text) { - this.textContent = text; - } - - // https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model - [cloningSteps](copy, node) { - copy._alreadyStarted = node._alreadyStarted; - } -} - -function processJavaScript(element, code, filename) { - const document = element.ownerDocument; - const window = document && document._global; - - if (window) { - document._currentScript = element; - - let lineOffset = 0; - if (!element.hasAttributeNS(null, "src")) { - for (const child of domSymbolTree.childrenIterator(element)) { - if (child.nodeType === nodeTypes.TEXT_NODE) { - if (child.sourceCodeLocation) { - lineOffset = child.sourceCodeLocation.startLine - 1; - } - break; - } - } - } - - try { - vm.runInContext(code, window, { filename, lineOffset, displayErrors: false }); - } catch (e) { - reportException(window, e, filename); - } finally { - document._currentScript = null; - } - } -} - -function getType(typeString) { - const lowercased = asciiLowercase(typeString); - // Cannot use whatwg-mimetype parsing because that strips whitespace. The spec demands a strict string comparison. - // That is, the type="" attribute is not really related to MIME types at all. - if (jsMIMETypes.has(lowercased)) { - return "classic"; - } - if (lowercased === "module") { - return "module"; - } - return null; -} - -module.exports = { - implementation: HTMLScriptElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSelectElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSelectElement-impl.js deleted file mode 100644 index 9a66227..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSelectElement-impl.js +++ /dev/null @@ -1,283 +0,0 @@ -"use strict"; - -const conversions = require("webidl-conversions"); - -const idlUtils = require("../generated/utils.js"); -const ValidityState = require("../generated/ValidityState"); -const DefaultConstraintValidationImpl = - require("../constraint-validation/DefaultConstraintValidation-impl").implementation; -const { mixin } = require("../../utils"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const NODE_TYPE = require("../node-type"); -const HTMLCollection = require("../generated/HTMLCollection"); -const HTMLOptionsCollection = require("../generated/HTMLOptionsCollection"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const { getLabelsForLabelable, formOwner, isDisabled } = require("../helpers/form-controls"); -const { parseNonNegativeInteger } = require("../helpers/strings"); - -class HTMLSelectElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._options = HTMLOptionsCollection.createImpl(this._globalObject, [], { - element: this, - query: () => { - // Customized domSymbolTree.treeToArray() clone. - const array = []; - for (const child of domSymbolTree.childrenIterator(this)) { - if (child._localName === "option") { - array.push(child); - } else if (child._localName === "optgroup") { - for (const childOfGroup of domSymbolTree.childrenIterator(child)) { - if (childOfGroup._localName === "option") { - array.push(childOfGroup); - } - } - } - } - return array; - } - }); - this._selectedOptions = null; // lazy - - this._customValidityErrorMessage = ""; - - this._labels = null; - } - - _formReset() { - for (const option of this.options) { - option._selectedness = option.hasAttributeNS(null, "selected"); - option._dirtyness = false; - } - this._askedForAReset(); - } - - _askedForAReset() { - if (this.hasAttributeNS(null, "multiple")) { - return; - } - - const selected = this.options.filter(opt => opt._selectedness); - - const size = this._displaySize; - if (size === 1 && !selected.length) { - // select the first option that is not disabled - for (const option of this.options) { - let disabled = option.hasAttributeNS(null, "disabled"); - const parentNode = domSymbolTree.parent(option); - if (parentNode && - parentNode._localName === "optgroup" && - parentNode.hasAttributeNS(null, "disabled")) { - disabled = true; - } - - if (!disabled) { - // (do not set dirty) - option._selectedness = true; - break; - } - } - } else if (selected.length >= 2) { - // select the last selected option - selected.forEach((option, index) => { - option._selectedness = index === selected.length - 1; - }); - } - } - - _descendantAdded(parent, child) { - if (child.nodeType === NODE_TYPE.ELEMENT_NODE) { - this._askedForAReset(); - } - - super._descendantAdded(parent, child); - } - - _descendantRemoved(parent, child) { - if (child.nodeType === NODE_TYPE.ELEMENT_NODE) { - this._askedForAReset(); - } - - super._descendantRemoved(parent, child); - } - - _attrModified(name, value, oldValue) { - if (name === "multiple" || name === "size") { - this._askedForAReset(); - } - super._attrModified(name, value, oldValue); - } - - get _displaySize() { - if (this.hasAttributeNS(null, "size")) { - const size = parseNonNegativeInteger(this.getAttributeNS(null, "size")); - if (size !== null) { - return size; - } - } - return this.hasAttributeNS(null, "multiple") ? 4 : 1; - } - - get _mutable() { - return !isDisabled(this); - } - - get options() { - return this._options; - } - - get selectedOptions() { - return HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => domSymbolTree.treeToArray(this, { - filter: node => node._localName === "option" && node._selectedness === true - }) - }); - } - - get selectedIndex() { - for (let i = 0; i < this.options.length; i++) { - if (this.options.item(i)._selectedness) { - return i; - } - } - return -1; - } - - set selectedIndex(index) { - for (let i = 0; i < this.options.length; i++) { - this.options.item(i)._selectedness = false; - } - - const selectedOption = this.options.item(index); - if (selectedOption) { - selectedOption._selectedness = true; - selectedOption._dirtyness = true; - } - } - - get labels() { - return getLabelsForLabelable(this); - } - - get value() { - for (const option of this.options) { - if (option._selectedness) { - return option.value; - } - } - - return ""; - } - - set value(val) { - for (const option of this.options) { - if (option.value === val) { - option._selectedness = true; - option._dirtyness = true; - } else { - option._selectedness = false; - } - - option._modified(); - } - } - - get form() { - return formOwner(this); - } - - get type() { - return this.hasAttributeNS(null, "multiple") ? "select-multiple" : "select-one"; - } - - get [idlUtils.supportedPropertyIndices]() { - return this.options[idlUtils.supportedPropertyIndices]; - } - - get length() { - return this.options.length; - } - - set length(value) { - this.options.length = value; - } - - item(index) { - return this.options.item(index); - } - - namedItem(name) { - return this.options.namedItem(name); - } - - [idlUtils.indexedSetNew](index, value) { - return this.options[idlUtils.indexedSetNew](index, value); - } - - [idlUtils.indexedSetExisting](index, value) { - return this.options[idlUtils.indexedSetExisting](index, value); - } - - add(opt, before) { - this.options.add(opt, before); - } - - remove(index) { - if (arguments.length > 0) { - index = conversions.long(index, { - context: "Failed to execute 'remove' on 'HTMLSelectElement': parameter 1" - }); - this.options.remove(index); - } else { - super.remove(); - } - } - - _barredFromConstraintValidationSpecialization() { - return this.hasAttributeNS(null, "readonly"); - } - - // Constraint validation: If the element has its required attribute specified, - // and either none of the option elements in the select element's list of options - // have their selectedness set to true, or the only option element in the select - // element's list of options with its selectedness set to true is the placeholder - // label option, then the element is suffering from being missing. - get validity() { - if (!this._validity) { - const state = { - valueMissing: () => { - if (!this.hasAttributeNS(null, "required")) { - return false; - } - const selectedOptionIndex = this.selectedIndex; - return selectedOptionIndex < 0 || (selectedOptionIndex === 0 && this._hasPlaceholderOption); - } - }; - - this._validity = ValidityState.createImpl(this._globalObject, [], { - element: this, - state - }); - } - return this._validity; - } - - // If a select element has a required attribute specified, does not have a multiple attribute - // specified, and has a display size of 1; and if the value of the first option element in the - // select element's list of options (if any) is the empty string, and that option element's parent - // node is the select element(and not an optgroup element), then that option is the select - // element's placeholder label option. - // https://html.spec.whatwg.org/multipage/form-elements.html#placeholder-label-option - get _hasPlaceholderOption() { - return this.hasAttributeNS(null, "required") && !this.hasAttributeNS(null, "multiple") && - this._displaySize === 1 && this.options.length > 0 && this.options.item(0).value === "" && - this.options.item(0).parentNode._localName !== "optgroup"; - } -} - -mixin(HTMLSelectElementImpl.prototype, DefaultConstraintValidationImpl.prototype); - -module.exports = { - implementation: HTMLSelectElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSlotElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSlotElement-impl.js deleted file mode 100644 index a926993..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSlotElement-impl.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils"); -const HTMLElement = require("../generated/HTMLElement"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -const { nodeRoot } = require("../helpers/node"); -const { assignSlotableForTree, findFlattenedSlotables } = require("../helpers/shadow-dom"); - -class HTMLSlotElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._assignedNodes = []; - } - - // https://dom.spec.whatwg.org/#slot-name - get name() { - return this.getAttributeNS(null, "name") || ""; - } - - _attrModified(name, value, oldValue) { - super._attrModified(name, value, oldValue); - - // https://dom.spec.whatwg.org/#slot-name - if (name === "name") { - if (value === oldValue) { - return; - } - - if (value === null && oldValue === "") { - return; - } - - if (value === "" && oldValue === null) { - return; - } - - assignSlotableForTree(nodeRoot(this)); - } - } - - // https://html.spec.whatwg.org/#dom-slot-assignednodes - assignedNodes(options) { - if (!options || !options.flatten) { - return this._assignedNodes.map(idlUtils.wrapperForImpl); - } - - return findFlattenedSlotables(this).map(idlUtils.wrapperForImpl); - } - - // https://html.spec.whatwg.org/#dom-slot-assignedelements - assignedElements(options) { - return this.assignedNodes(options).filter(HTMLElement.is); - } -} - -module.exports = { - implementation: HTMLSlotElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSourceElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSourceElement-impl.js deleted file mode 100644 index 44f4412..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSourceElement-impl.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLSourceElementImpl extends HTMLElementImpl {} - -module.exports = { - implementation: HTMLSourceElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSpanElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSpanElement-impl.js deleted file mode 100644 index 9c00e6e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSpanElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLSpanElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLSpanElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLStyleElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLStyleElement-impl.js deleted file mode 100644 index e693b7a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLStyleElement-impl.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { addStylesheet, removeStylesheet, createStylesheet } = require("../helpers/stylesheets"); -const { childTextContent } = require("../helpers/text"); -const { asciiCaseInsensitiveMatch } = require("../helpers/strings"); - -class HTMLStyleElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this.sheet = null; - this._isOnStackOfOpenElements = false; - } - - _attach() { - super._attach(); - if (!this._isOnStackOfOpenElements) { - this._updateAStyleBlock(); - } - } - - _detach() { - super._detach(); - if (!this._isOnStackOfOpenElements) { - this._updateAStyleBlock(); - } - } - - _childTextContentChangeSteps() { - super._childTextContentChangeSteps(); - - // This guard is not required by the spec, but should be unobservable (since you can't run script during the middle - // of parsing a <style> element) and saves a bunch of unnecessary work. - if (!this._isOnStackOfOpenElements) { - this._updateAStyleBlock(); - } - } - - _poppedOffStackOfOpenElements() { - this._isOnStackOfOpenElements = false; - this._updateAStyleBlock(); - } - - _pushedOnStackOfOpenElements() { - this._isOnStackOfOpenElements = true; - } - - _updateAStyleBlock() { - if (this.sheet) { - removeStylesheet(this.sheet, this); - } - - // Browsing-context connected, per https://github.com/whatwg/html/issues/4547 - if (!this.isConnected || !this._ownerDocument._defaultView) { - return; - } - - const type = this.getAttributeNS(null, "type"); - if (type !== null && type !== "" && !asciiCaseInsensitiveMatch(type, "text/css")) { - return; - } - - // Not implemented: CSP - - const content = childTextContent(this); - // Not implemented: a bunch of other state, e.g. title/media attributes - const createdSheet = createStylesheet(content, this, this._ownerDocument.baseURLSerialized(), { - ownerNode: this - }); - addStylesheet(createdSheet, this); - } -} - -module.exports = { - implementation: HTMLStyleElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCaptionElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCaptionElement-impl.js deleted file mode 100644 index 27ff421..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCaptionElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLTableCaptionElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLTableCaptionElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCellElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCellElement-impl.js deleted file mode 100644 index 6b6c13e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCellElement-impl.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -const { asciiLowercase, parseNonNegativeInteger } = require("../helpers/strings"); -const { closest } = require("../helpers/traversal"); - -function reflectedAttributeClampedToRange(attrValue, min, max, defaultValue = 0) { - if (attrValue === null) { - return defaultValue; - } - const parsed = parseNonNegativeInteger(attrValue); - if (parsed === null) { - return defaultValue; - } - if (parsed < min) { - return min; - } - if (parsed > max) { - return max; - } - return parsed; -} - -class HTMLTableCellElementImpl extends HTMLElementImpl { - get colSpan() { - return reflectedAttributeClampedToRange(this.getAttributeNS(null, "colspan"), 1, 1000, 1); - } - - set colSpan(V) { - this.setAttributeNS(null, "colspan", String(V)); - } - - get rowSpan() { - return reflectedAttributeClampedToRange(this.getAttributeNS(null, "rowspan"), 0, 65534, 1); - } - - set rowSpan(V) { - this.setAttributeNS(null, "rowspan", String(V)); - } - - get cellIndex() { - const tr = closest(this, "tr"); - if (tr === null) { - return -1; - } - - return tr.cells.indexOf(this); - } - - get scope() { - let value = this.getAttributeNS(null, "scope"); - if (value === null) { - return ""; - } - - // Enumerated attribute is matched ASCII-case-insensitively. - value = asciiLowercase(value); - if (value === "row" || value === "col" || value === "rowgroup" || value === "colgroup") { - return value; - } - - return ""; - } - - set scope(V) { - this.setAttributeNS(null, "scope", V); - } -} - -module.exports = { - implementation: HTMLTableCellElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableColElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableColElement-impl.js deleted file mode 100644 index d6cf3af..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableColElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLTableColElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLTableColElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableElement-impl.js deleted file mode 100644 index 4ee7781..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableElement-impl.js +++ /dev/null @@ -1,236 +0,0 @@ -"use strict"; -const DOMException = require("../generated/DOMException"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { HTML_NS } = require("../helpers/namespaces"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const { firstChildWithLocalName, childrenByLocalName } = require("../helpers/traversal"); -const HTMLCollection = require("../generated/HTMLCollection"); -const NODE_TYPE = require("../node-type"); - -function tHeadInsertionPoint(table) { - const iterator = domSymbolTree.childrenIterator(table); - for (const child of iterator) { - if (child.nodeType !== NODE_TYPE.ELEMENT_NODE) { - continue; - } - - if (child._namespaceURI !== HTML_NS || (child._localName !== "caption" && child._localName !== "colgroup")) { - return child; - } - } - - return null; -} - -class HTMLTableElementImpl extends HTMLElementImpl { - get caption() { - return firstChildWithLocalName(this, "caption"); - } - - set caption(value) { - const currentCaption = this.caption; - if (currentCaption !== null) { - this.removeChild(currentCaption); - } - - if (value !== null) { - const insertionPoint = this.firstChild; - this.insertBefore(value, insertionPoint); - } - } - - get tHead() { - return firstChildWithLocalName(this, "thead"); - } - - set tHead(value) { - if (value !== null && value._localName !== "thead") { - throw DOMException.create(this._globalObject, [ - "Cannot set a non-thead element as a table header", - "HierarchyRequestError" - ]); - } - - const currentHead = this.tHead; - if (currentHead !== null) { - this.removeChild(currentHead); - } - - if (value !== null) { - const insertionPoint = tHeadInsertionPoint(this); - this.insertBefore(value, insertionPoint); - } - } - - get tFoot() { - return firstChildWithLocalName(this, "tfoot"); - } - - set tFoot(value) { - if (value !== null && value._localName !== "tfoot") { - throw DOMException.create(this._globalObject, [ - "Cannot set a non-tfoot element as a table footer", - "HierarchyRequestError" - ]); - } - - const currentFoot = this.tFoot; - if (currentFoot !== null) { - this.removeChild(currentFoot); - } - - if (value !== null) { - this.appendChild(value); - } - } - - get rows() { - if (!this._rows) { - this._rows = HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => { - const headerRows = []; - const bodyRows = []; - const footerRows = []; - - const iterator = domSymbolTree.childrenIterator(this); - for (const child of iterator) { - if (child.nodeType !== NODE_TYPE.ELEMENT_NODE || child._namespaceURI !== HTML_NS) { - continue; - } - - if (child._localName === "thead") { - headerRows.push(...childrenByLocalName(child, "tr")); - } else if (child._localName === "tbody") { - bodyRows.push(...childrenByLocalName(child, "tr")); - } else if (child._localName === "tfoot") { - footerRows.push(...childrenByLocalName(child, "tr")); - } else if (child._localName === "tr") { - bodyRows.push(child); - } - } - - return [...headerRows, ...bodyRows, ...footerRows]; - } - }); - } - return this._rows; - } - - get tBodies() { - if (!this._tBodies) { - this._tBodies = HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => childrenByLocalName(this, "tbody") - }); - } - return this._tBodies; - } - - createTBody() { - const el = this._ownerDocument.createElement("TBODY"); - - const tbodies = childrenByLocalName(this, "tbody"); - const insertionPoint = tbodies[tbodies.length - 1]; - - if (insertionPoint) { - this.insertBefore(el, insertionPoint.nextSibling); - } else { - this.appendChild(el); - } - return el; - } - - createTHead() { - let el = this.tHead; - if (!el) { - el = this.tHead = this._ownerDocument.createElement("THEAD"); - } - return el; - } - - deleteTHead() { - this.tHead = null; - } - - createTFoot() { - let el = this.tFoot; - if (!el) { - el = this.tFoot = this._ownerDocument.createElement("TFOOT"); - } - return el; - } - - deleteTFoot() { - this.tFoot = null; - } - - createCaption() { - let el = this.caption; - if (!el) { - el = this.caption = this._ownerDocument.createElement("CAPTION"); - } - return el; - } - - deleteCaption() { - const c = this.caption; - if (c) { - c.parentNode.removeChild(c); - } - } - - insertRow(index) { - if (index < -1 || index > this.rows.length) { - throw DOMException.create(this._globalObject, [ - "Cannot insert a row at an index that is less than -1 or greater than the number of existing rows", - "IndexSizeError" - ]); - } - - const tr = this._ownerDocument.createElement("tr"); - - if (this.rows.length === 0 && this.tBodies.length === 0) { - const tBody = this._ownerDocument.createElement("tbody"); - tBody.appendChild(tr); - this.appendChild(tBody); - } else if (this.rows.length === 0) { - const tBody = this.tBodies.item(this.tBodies.length - 1); - tBody.appendChild(tr); - } else if (index === -1 || index === this.rows.length) { - const tSection = this.rows.item(this.rows.length - 1).parentNode; - tSection.appendChild(tr); - } else { - const beforeTR = this.rows.item(index); - const tSection = beforeTR.parentNode; - tSection.insertBefore(tr, beforeTR); - } - - return tr; - } - - deleteRow(index) { - const rowLength = this.rows.length; - if (index < -1 || index >= rowLength) { - throw DOMException.create(this._globalObject, [ - `Cannot delete a row at index ${index}, where no row exists`, - "IndexSizeError" - ]); - } - - if (index === -1) { - if (rowLength === 0) { - return; - } - - index = rowLength - 1; - } - - const tr = this.rows.item(index); - tr.parentNode.removeChild(tr); - } -} - -module.exports = { - implementation: HTMLTableElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableRowElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableRowElement-impl.js deleted file mode 100644 index e5d61d7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableRowElement-impl.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const HTMLCollection = require("../generated/HTMLCollection"); -const { HTML_NS } = require("../helpers/namespaces"); -const { childrenByLocalNames } = require("../helpers/traversal"); -const { domSymbolTree } = require("../helpers/internal-constants"); - -const cellLocalNames = new Set(["td", "th"]); - -class HTMLTableRowElementImpl extends HTMLElementImpl { - get cells() { - if (!this._cells) { - this._cells = HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => childrenByLocalNames(this, cellLocalNames) - }); - } - return this._cells; - } - - get rowIndex() { - const parent = this.parentElement; - if (parent === null || parent.namespaceURI !== HTML_NS) { - return -1; - } - - let tableElement = parent; - if (parent.localName === "thead" || parent.localName === "tbody" || parent.localName === "tfoot") { - tableElement = parent.parentElement; - } - if (tableElement === null || tableElement.namespaceURI !== HTML_NS || tableElement.localName !== "table") { - return -1; - } - - return tableElement.rows.indexOf(this); - } - - get sectionRowIndex() { - const parent = domSymbolTree.parent(this); - if (parent === null) { - return -1; - } - - const { rows } = parent; - if (!rows) { - return -1; - } - - return rows.indexOf(this); - } - - insertCell(index) { - const td = this._ownerDocument.createElement("TD"); - const { cells } = this; - if (index < -1 || index > cells.length) { - throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); - } - if (index === -1 || index === cells.length) { - this._append(td); - } else { - const ref = cells.item(index); - this._insert(td, ref); - } - return td; - } - - deleteCell(index) { - const { cells } = this; - if (index < -1 || index >= cells.length) { - throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); - } - if (index === -1) { - if (cells.length === 0) { - return; - } - - index = cells.length - 1; - } - const td = cells.item(index); - this._remove(td); - } -} - -module.exports = { - implementation: HTMLTableRowElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableSectionElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableSectionElement-impl.js deleted file mode 100644 index 4e8b0e4..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableSectionElement-impl.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { childrenByLocalName } = require("../helpers/traversal"); -const HTMLCollection = require("../generated/HTMLCollection"); -const DOMException = require("../generated/DOMException"); - -class HTMLTableSectionElementImpl extends HTMLElementImpl { - get rows() { - if (!this._rows) { - this._rows = HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => childrenByLocalName(this, "tr") - }); - } - return this._rows; - } - - insertRow(index) { - if (index < -1 || index > this.rows.length) { - throw DOMException.create(this._globalObject, [ - "Cannot insert a row at an index that is less than -1 or greater than the number of existing rows", - "IndexSizeError" - ]); - } - - const tr = this._ownerDocument.createElement("tr"); - - if (index === -1 || index === this.rows.length) { - this._append(tr); - } else { - const beforeTR = this.rows.item(index); - this._insert(tr, beforeTR); - } - - return tr; - } - - deleteRow(index) { - if (index < -1 || index >= this.rows.length) { - throw DOMException.create(this._globalObject, [ - `Cannot delete a row at index ${index}, where no row exists`, - "IndexSizeError" - ]); - } - - if (index === -1) { - if (this.rows.length > 0) { - const tr = this.rows.item(this.rows.length - 1); - this._remove(tr); - } - } else { - const tr = this.rows.item(index); - this._remove(tr); - } - } -} - -module.exports = { - implementation: HTMLTableSectionElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTemplateElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTemplateElement-impl.js deleted file mode 100644 index b0a2405..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTemplateElement-impl.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -const Document = require("../generated/Document"); -const DocumentFragment = require("../generated/DocumentFragment"); - -const { cloningSteps, domSymbolTree } = require("../helpers/internal-constants"); -const { clone } = require("../node"); - -class HTMLTemplateElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - const doc = this._appropriateTemplateContentsOwnerDocument(this._ownerDocument); - this._templateContents = DocumentFragment.createImpl(this._globalObject, [], { - ownerDocument: doc, - host: this - }); - } - - // https://html.spec.whatwg.org/multipage/scripting.html#appropriate-template-contents-owner-document - _appropriateTemplateContentsOwnerDocument(doc) { - if (!doc._isInertTemplateDocument) { - if (doc._associatedInertTemplateDocument === undefined) { - const newDoc = Document.createImpl(this._globalObject, [], { - options: { - parsingMode: doc._parsingMode, - encoding: doc._encoding - } - }); - newDoc._isInertTemplateDocument = true; - - doc._associatedInertTemplateDocument = newDoc; - } - - doc = doc._associatedInertTemplateDocument; - } - - return doc; - } - - // https://html.spec.whatwg.org/multipage/scripting.html#template-adopting-steps - _adoptingSteps() { - const doc = this._appropriateTemplateContentsOwnerDocument(this._ownerDocument); - doc._adoptNode(this._templateContents); - } - - get content() { - return this._templateContents; - } - - [cloningSteps](copy, node, document, cloneChildren) { - if (!cloneChildren) { - return; - } - - for (const child of domSymbolTree.childrenIterator(node._templateContents)) { - const childCopy = clone(child, copy._templateContents._ownerDocument, true); - copy._templateContents.appendChild(childCopy); - } - } -} - -module.exports = { - implementation: HTMLTemplateElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTextAreaElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTextAreaElement-impl.js deleted file mode 100644 index 4dfe9e3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTextAreaElement-impl.js +++ /dev/null @@ -1,244 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -const DefaultConstraintValidationImpl = - require("../constraint-validation/DefaultConstraintValidation-impl").implementation; -const ValidityState = require("../generated/ValidityState"); -const { mixin } = require("../../utils"); - -const DOMException = require("../generated/DOMException"); -const { cloningSteps } = require("../helpers/internal-constants"); -const { isDisabled, getLabelsForLabelable, formOwner } = require("../helpers/form-controls"); -const { childTextContent } = require("../helpers/text"); -const { fireAnEvent } = require("../helpers/events"); - -class HTMLTextAreaElementImpl extends HTMLElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this._selectionStart = this._selectionEnd = 0; - this._selectionDirection = "none"; - this._rawValue = ""; - this._dirtyValue = false; - - this._customValidityErrorMessage = ""; - - this._labels = null; - } - - _formReset() { - this._rawValue = childTextContent(this); - this._dirtyValue = false; - } - - _getAPIValue() { - return this._rawValue.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#textarea-wrapping-transformation - _getValue() { - const apiValue = this._getAPIValue(); - const wrap = this.getAttributeNS(null, "wrap"); - return wrap === "hard" ? - textareaWrappingTransformation(apiValue, this.getAttributeNS(null, "cols") ?? 20) : - apiValue; - } - - _childTextContentChangeSteps() { - super._childTextContentChangeSteps(); - - if (this._dirtyValue === false) { - this._rawValue = childTextContent(this); - } - } - - get labels() { - return getLabelsForLabelable(this); - } - - get form() { - return formOwner(this); - } - - get defaultValue() { - return childTextContent(this); - } - - set defaultValue(val) { - this.textContent = val; - } - - get value() { - return this._getAPIValue(); - } - - set value(val) { - // https://html.spec.whatwg.org/multipage/form-elements.html#dom-textarea-value - const oldAPIValue = this._getAPIValue(); - this._rawValue = val; - this._dirtyValue = true; - - if (oldAPIValue !== this._getAPIValue()) { - this._selectionStart = this._selectionEnd = this._getValueLength(); - this._selectionDirection = "none"; - } - } - - get textLength() { - return this.value.length; // code unit length (16 bit) - } - - get type() { - return "textarea"; - } - - _dispatchSelectEvent() { - setTimeout(() => fireAnEvent("select", this, undefined, { bubbles: true, cancelable: false }), 0); - } - - _getValueLength() { - return typeof this.value === "string" ? this.value.length : 0; - } - - select() { - this._selectionStart = 0; - this._selectionEnd = this._getValueLength(); - this._selectionDirection = "none"; - this._dispatchSelectEvent(); - } - - get selectionStart() { - return this._selectionStart; - } - - set selectionStart(start) { - this.setSelectionRange(start, Math.max(start, this._selectionEnd), this._selectionDirection); - } - - get selectionEnd() { - return this._selectionEnd; - } - - set selectionEnd(end) { - this.setSelectionRange(this._selectionStart, end, this._selectionDirection); - } - - get selectionDirection() { - return this._selectionDirection; - } - - set selectionDirection(dir) { - this.setSelectionRange(this._selectionStart, this._selectionEnd, dir); - } - - setSelectionRange(start, end, dir) { - this._selectionEnd = Math.min(end, this._getValueLength()); - this._selectionStart = Math.min(start, this._selectionEnd); - this._selectionDirection = dir === "forward" || dir === "backward" ? dir : "none"; - this._dispatchSelectEvent(); - } - - setRangeText(repl, start, end, selectionMode = "preserve") { - if (arguments.length < 2) { - start = this._selectionStart; - end = this._selectionEnd; - } else if (start > end) { - throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); - } - - start = Math.min(start, this._getValueLength()); - end = Math.min(end, this._getValueLength()); - - const val = this.value; - let selStart = this._selectionStart; - let selEnd = this._selectionEnd; - - this.value = val.slice(0, start) + repl + val.slice(end); - - const newEnd = start + repl.length; - - if (selectionMode === "select") { - this.setSelectionRange(start, newEnd); - } else if (selectionMode === "start") { - this.setSelectionRange(start, start); - } else if (selectionMode === "end") { - this.setSelectionRange(newEnd, newEnd); - } else { // preserve - const delta = repl.length - (end - start); - - if (selStart > end) { - selStart += delta; - } else if (selStart > start) { - selStart = start; - } - - if (selEnd > end) { - selEnd += delta; - } else if (selEnd > start) { - selEnd = newEnd; - } - - this.setSelectionRange(selStart, selEnd); - } - } - - _barredFromConstraintValidationSpecialization() { - return this.hasAttributeNS(null, "readonly"); - } - - get _mutable() { - return !isDisabled(this) && !this.hasAttributeNS(null, "readonly"); - } - - // https://html.spec.whatwg.org/multipage/form-elements.html#attr-textarea-required - get validity() { - if (!this._validity) { - const state = { - valueMissing: () => this.hasAttributeNS(null, "required") && this._mutable && this.value === "" - }; - - this._validity = ValidityState.createImpl(this._globalObject, [], { - element: this, - state - }); - } - return this._validity; - } - - [cloningSteps](copy, node) { - copy._dirtyValue = node._dirtyValue; - copy._rawValue = node._rawValue; - } -} - -mixin(HTMLTextAreaElementImpl.prototype, DefaultConstraintValidationImpl.prototype); - -module.exports = { - implementation: HTMLTextAreaElementImpl -}; - -function textareaWrappingTransformation(text, cols) { - let lineStart = 0; - let lineEnd = text.indexOf("\n"); - if (lineEnd === -1) { - lineEnd = text.length; - } - - while (lineStart < text.length) { - const lineLength = lineEnd - lineStart; - if (lineLength > cols) { - // split the line - lineEnd = lineStart + cols; - text = text.slice(0, lineEnd) + "\n" + text.slice(lineEnd); - } - // move to next line - lineStart = lineEnd + 1; // step over the newline - lineEnd = text.indexOf("\n", lineStart); - if (lineEnd === -1) { - lineEnd = text.length; - } - } - - return text; -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTimeElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTimeElement-impl.js deleted file mode 100644 index 0378649..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTimeElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLTimeElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLTimeElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTitleElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTitleElement-impl.js deleted file mode 100644 index fad736c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTitleElement-impl.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; -const { childTextContent } = require("../helpers/text"); - -class HTMLTitleElementImpl extends HTMLElementImpl { - get text() { - return childTextContent(this); - } - - set text(value) { - this.textContent = value; - } -} - -module.exports = { - implementation: HTMLTitleElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTrackElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTrackElement-impl.js deleted file mode 100644 index 858df85..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTrackElement-impl.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLTrackElementImpl extends HTMLElementImpl { - get readyState() { - return 0; - } -} - -module.exports = { - implementation: HTMLTrackElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLUListElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLUListElement-impl.js deleted file mode 100644 index ed22ec0..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLUListElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLUListElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLUListElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLUnknownElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLUnknownElement-impl.js deleted file mode 100644 index 89b2b2b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLUnknownElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const HTMLElementImpl = require("./HTMLElement-impl").implementation; - -class HTMLUnknownElementImpl extends HTMLElementImpl { } - -module.exports = { - implementation: HTMLUnknownElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLVideoElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLVideoElement-impl.js deleted file mode 100644 index d06cd9e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/HTMLVideoElement-impl.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -const HTMLMediaElementImpl = require("./HTMLMediaElement-impl").implementation; - -class HTMLVideoElementImpl extends HTMLMediaElementImpl { - get videoWidth() { - return 0; - } - - get videoHeight() { - return 0; - } -} - -module.exports = { - implementation: HTMLVideoElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/LinkStyle-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/LinkStyle-impl.js deleted file mode 100644 index 7a6c5d8..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/LinkStyle-impl.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -module.exports = class LinkStyleImpl {}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Node-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Node-impl.js deleted file mode 100644 index f0a845c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Node-impl.js +++ /dev/null @@ -1,1174 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); - -const EventTargetImpl = require("../events/EventTarget-impl").implementation; -const { simultaneousIterators } = require("../../utils"); -const NODE_TYPE = require("../node-type"); -const NODE_DOCUMENT_POSITION = require("../node-document-position"); -const { clone, locateNamespacePrefix, locateNamespace } = require("../node"); -const { setAnExistingAttributeValue } = require("../attributes"); - -const NodeList = require("../generated/NodeList"); - -const { nodeRoot, nodeLength, isInclusiveAncestor } = require("../helpers/node"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const { queueTreeMutationRecord } = require("../helpers/mutation-observers"); -const { enqueueCECallbackReaction, tryUpgradeElement } = require("../helpers/custom-elements"); -const { - isShadowRoot, shadowIncludingRoot, assignSlot, assignSlotableForTree, assignSlotable, signalSlotChange, isSlot, - shadowIncludingInclusiveDescendantsIterator, shadowIncludingDescendantsIterator -} = require("../helpers/shadow-dom"); -const { invalidateStyleCache } = require("../helpers/style-rules"); - -function nodeEquals(a, b) { - if (a.nodeType !== b.nodeType) { - return false; - } - - switch (a.nodeType) { - case NODE_TYPE.DOCUMENT_TYPE_NODE: - if (a.name !== b.name || a.publicId !== b.publicId || - a.systemId !== b.systemId) { - return false; - } - break; - case NODE_TYPE.ELEMENT_NODE: - if (a._namespaceURI !== b._namespaceURI || a._prefix !== b._prefix || a._localName !== b._localName || - a._attributeList.length !== b._attributeList.length) { - return false; - } - break; - case NODE_TYPE.ATTRIBUTE_NODE: - if (a._namespace !== b._namespace || a._localName !== b._localName || a._value !== b._value) { - return false; - } - break; - case NODE_TYPE.PROCESSING_INSTRUCTION_NODE: - if (a._target !== b._target || a._data !== b._data) { - return false; - } - break; - case NODE_TYPE.TEXT_NODE: - case NODE_TYPE.COMMENT_NODE: - if (a._data !== b._data) { - return false; - } - break; - } - - if (a.nodeType === NODE_TYPE.ELEMENT_NODE && !attributeListsEqual(a, b)) { - return false; - } - - for (const nodes of simultaneousIterators(domSymbolTree.childrenIterator(a), domSymbolTree.childrenIterator(b))) { - if (!nodes[0] || !nodes[1]) { - // mismatch in the amount of childNodes - return false; - } - - if (!nodeEquals(nodes[0], nodes[1])) { - return false; - } - } - - return true; -} - -// Needed by https://dom.spec.whatwg.org/#concept-node-equals -function attributeListsEqual(elementA, elementB) { - const listA = elementA._attributeList; - const listB = elementB._attributeList; - - const lengthA = listA.length; - const lengthB = listB.length; - - if (lengthA !== lengthB) { - return false; - } - - for (let i = 0; i < lengthA; ++i) { - const attrA = listA[i]; - - if (!listB.some(attrB => nodeEquals(attrA, attrB))) { - return false; - } - } - - return true; -} - -// https://dom.spec.whatwg.org/#concept-tree-host-including-inclusive-ancestor -function isHostInclusiveAncestor(nodeImplA, nodeImplB) { - for (const ancestor of domSymbolTree.ancestorsIterator(nodeImplB)) { - if (ancestor === nodeImplA) { - return true; - } - } - - const rootImplB = nodeRoot(nodeImplB); - if (rootImplB._host) { - return isHostInclusiveAncestor(nodeImplA, rootImplB._host); - } - - return false; -} - -class NodeImpl extends EventTargetImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - domSymbolTree.initialize(this); - - this._ownerDocument = privateData.ownerDocument; - - this._childNodesList = null; - this._childrenList = null; - this._version = 0; - this._memoizedQueries = {}; - this._registeredObserverList = []; - this._referencedRanges = new Set(); // Set of WeakRef<Range> - } - - // Generator that yields live Range objects from _referencedRanges, - // cleaning up any dead WeakRefs encountered during iteration. - * _liveRanges() { - for (const weakRef of this._referencedRanges) { - const range = weakRef.deref(); - if (range) { - yield range; - } else { - // Range was garbage collected - remove the dead WeakRef - this._referencedRanges.delete(weakRef); - } - } - } - - _getTheParent() { - if (this._assignedSlot) { - return this._assignedSlot; - } - - return domSymbolTree.parent(this); - } - - get parentNode() { - return domSymbolTree.parent(this); - } - - getRootNode(options) { - return options.composed ? shadowIncludingRoot(this) : nodeRoot(this); - } - - get nodeName() { - switch (this.nodeType) { - case NODE_TYPE.ELEMENT_NODE: - return this.tagName; - case NODE_TYPE.ATTRIBUTE_NODE: - return this._qualifiedName; - case NODE_TYPE.TEXT_NODE: - return "#text"; - case NODE_TYPE.CDATA_SECTION_NODE: - return "#cdata-section"; - case NODE_TYPE.PROCESSING_INSTRUCTION_NODE: - return this.target; - case NODE_TYPE.COMMENT_NODE: - return "#comment"; - case NODE_TYPE.DOCUMENT_NODE: - return "#document"; - case NODE_TYPE.DOCUMENT_TYPE_NODE: - return this.name; - case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: - return "#document-fragment"; - } - - // should never happen - return null; - } - - get firstChild() { - return domSymbolTree.firstChild(this); - } - - // https://dom.spec.whatwg.org/#connected - // https://dom.spec.whatwg.org/#dom-node-isconnected - get isConnected() { - const root = shadowIncludingRoot(this); - return root && root.nodeType === NODE_TYPE.DOCUMENT_NODE; - } - - get ownerDocument() { - return this.nodeType === NODE_TYPE.DOCUMENT_NODE ? null : this._ownerDocument; - } - - get lastChild() { - return domSymbolTree.lastChild(this); - } - - get childNodes() { - if (!this._childNodesList) { - this._childNodesList = NodeList.createImpl(this._globalObject, [], { - element: this, - query: () => domSymbolTree.childrenToArray(this) - }); - } else { - this._childNodesList._update(); - } - - return this._childNodesList; - } - - get nextSibling() { - return domSymbolTree.nextSibling(this); - } - - get previousSibling() { - return domSymbolTree.previousSibling(this); - } - - _modified() { - this._version++; - for (const ancestor of domSymbolTree.ancestorsIterator(this)) { - ancestor._version++; - } - - if (this._childrenList) { - this._childrenList._update(); - } - if (this._childNodesList) { - this._childNodesList._update(); - } - this._clearMemoizedQueries(); - invalidateStyleCache(this); - } - - _childTextContentChangeSteps() { - invalidateStyleCache(this); - } - - _clearMemoizedQueries() { - this._memoizedQueries = {}; - const myParent = domSymbolTree.parent(this); - if (myParent) { - myParent._clearMemoizedQueries(); - } - } - - _descendantRemoved(parent, child) { - const myParent = domSymbolTree.parent(this); - if (myParent) { - myParent._descendantRemoved(parent, child); - } - } - - _descendantAdded(parent, child) { - const myParent = domSymbolTree.parent(this); - if (myParent) { - myParent._descendantAdded(parent, child); - } - } - - _attach() { - this._attached = true; - - for (const child of domSymbolTree.childrenIterator(this)) { - if (child._attach) { - child._attach(); - } - } - } - - _detach() { - this._attached = false; - - if (this._ownerDocument && this._ownerDocument._lastFocusedElement === this) { - this._ownerDocument._lastFocusedElement = null; - } - - for (const child of domSymbolTree.childrenIterator(this)) { - if (child._detach) { - child._detach(); - } - } - } - - hasChildNodes() { - return domSymbolTree.hasChildren(this); - } - - // https://dom.spec.whatwg.org/#dom-node-normalize - normalize() { - // It is important to use a treeToArray instead of a treeToIterator here, because the - // treeToIterator doesn't support tree mutation in the middle of the traversal. - for (const node of domSymbolTree.treeToArray(this)) { - const parentNode = domSymbolTree.parent(node); - if (parentNode === null || node.nodeType !== NODE_TYPE.TEXT_NODE) { - continue; - } - - let length = nodeLength(node); - - if (length === 0) { - parentNode._remove(node); - continue; - } - - const continuousExclusiveTextNodes = []; - - for (const currentNode of domSymbolTree.previousSiblingsIterator(node)) { - if (currentNode.nodeType !== NODE_TYPE.TEXT_NODE) { - break; - } - - continuousExclusiveTextNodes.unshift(currentNode); - } - for (const currentNode of domSymbolTree.nextSiblingsIterator(node)) { - if (currentNode.nodeType !== NODE_TYPE.TEXT_NODE) { - break; - } - - continuousExclusiveTextNodes.push(currentNode); - } - - const data = continuousExclusiveTextNodes.reduce((d, n) => d + n._data, ""); - node.replaceData(length, 0, data); - - let currentNode = domSymbolTree.nextSibling(node); - while (currentNode && currentNode.nodeType === NODE_TYPE.TEXT_NODE) { - const currentNodeIndex = domSymbolTree.index(currentNode); - - for (const range of node._liveRanges()) { - const { _start, _end } = range; - - if (_start.node === currentNode) { - range._setLiveRangeStart(node, _start.offset + length); - } - if (_end.node === currentNode) { - range._setLiveRangeEnd(node, _end.offset + length); - } - } - - for (const range of parentNode._liveRanges()) { - const { _start, _end } = range; - - if (_start.node === parentNode && _start.offset === currentNodeIndex) { - range._setLiveRangeStart(node, length); - } - if (_end.node === parentNode && _end.offset === currentNodeIndex) { - range._setLiveRangeEnd(node, length); - } - } - - length += nodeLength(currentNode); - currentNode = domSymbolTree.nextSibling(currentNode); - } - - for (const continuousExclusiveTextNode of continuousExclusiveTextNodes) { - parentNode._remove(continuousExclusiveTextNode); - } - } - } - - get parentElement() { - const parentNode = domSymbolTree.parent(this); - return parentNode !== null && parentNode.nodeType === NODE_TYPE.ELEMENT_NODE ? parentNode : null; - } - - get baseURI() { - return this._ownerDocument.baseURLSerialized(); - } - - compareDocumentPosition(other) { - // Let node1 be other and node2 be the context object. - let node1 = other; - let node2 = this; - - let attr1 = null; - let attr2 = null; - - if (node1.nodeType === NODE_TYPE.ATTRIBUTE_NODE) { - attr1 = node1; - node1 = attr1._element; - } - - if (node2.nodeType === NODE_TYPE.ATTRIBUTE_NODE) { - attr2 = node2; - node2 = attr2._element; - - if (attr1 !== null && node1 !== null && node2 === node1) { - for (const attr of node2._attributeList) { - if (nodeEquals(attr, attr1)) { - return NODE_DOCUMENT_POSITION.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | - NODE_DOCUMENT_POSITION.DOCUMENT_POSITION_PRECEDING; - } - - if (nodeEquals(attr, attr2)) { - return NODE_DOCUMENT_POSITION.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | - NODE_DOCUMENT_POSITION.DOCUMENT_POSITION_FOLLOWING; - } - } - } - } - - const result = domSymbolTree.compareTreePosition(node2, node1); - - // “If other and reference are not in the same tree, return the result of adding DOCUMENT_POSITION_DISCONNECTED, - // DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, and either DOCUMENT_POSITION_PRECEDING or - // DOCUMENT_POSITION_FOLLOWING, with the constraint that this is to be consistent, together.” - if (result === NODE_DOCUMENT_POSITION.DOCUMENT_POSITION_DISCONNECTED) { - // symbol-tree does not add these bits required by the spec: - return NODE_DOCUMENT_POSITION.DOCUMENT_POSITION_DISCONNECTED | - NODE_DOCUMENT_POSITION.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | - NODE_DOCUMENT_POSITION.DOCUMENT_POSITION_FOLLOWING; - } - - return result; - } - - lookupPrefix(namespace) { - if (namespace === null || namespace === "") { - return null; - } - - switch (this.nodeType) { - case NODE_TYPE.ELEMENT_NODE: { - return locateNamespacePrefix(this, namespace); - } - case NODE_TYPE.DOCUMENT_NODE: { - return this.documentElement !== null ? locateNamespacePrefix(this.documentElement, namespace) : null; - } - case NODE_TYPE.DOCUMENT_TYPE_NODE: - case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: { - return null; - } - case NODE_TYPE.ATTRIBUTE_NODE: { - return this._element !== null ? locateNamespacePrefix(this._element, namespace) : null; - } - default: { - return this.parentElement !== null ? locateNamespacePrefix(this.parentElement, namespace) : null; - } - } - } - - lookupNamespaceURI(prefix) { - if (prefix === "") { - prefix = null; - } - - return locateNamespace(this, prefix); - } - - isDefaultNamespace(namespace) { - if (namespace === "") { - namespace = null; - } - - const defaultNamespace = locateNamespace(this, null); - return defaultNamespace === namespace; - } - - contains(other) { - return isInclusiveAncestor(this, other); - } - - isEqualNode(node) { - if (node === null) { - return false; - } - - // Fast-path, not in the spec - if (this === node) { - return true; - } - - return nodeEquals(this, node); - } - - isSameNode(node) { - if (this === node) { - return true; - } - - return false; - } - - cloneNode(deep) { - if (isShadowRoot(this)) { - throw DOMException.create(this._globalObject, ["ShadowRoot nodes are not clonable.", "NotSupportedError"]); - } - - deep = Boolean(deep); - - return clone(this, undefined, deep); - } - - get nodeValue() { - switch (this.nodeType) { - case NODE_TYPE.ATTRIBUTE_NODE: { - return this._value; - } - case NODE_TYPE.TEXT_NODE: - case NODE_TYPE.CDATA_SECTION_NODE: // CDATASection is a subclass of Text - case NODE_TYPE.PROCESSING_INSTRUCTION_NODE: - case NODE_TYPE.COMMENT_NODE: { - return this._data; - } - default: { - return null; - } - } - } - - set nodeValue(value) { - if (value === null) { - value = ""; - } - - switch (this.nodeType) { - case NODE_TYPE.ATTRIBUTE_NODE: { - setAnExistingAttributeValue(this, value); - break; - } - case NODE_TYPE.TEXT_NODE: - case NODE_TYPE.CDATA_SECTION_NODE: // CDATASection is a subclass of Text - case NODE_TYPE.PROCESSING_INSTRUCTION_NODE: - case NODE_TYPE.COMMENT_NODE: { - this.replaceData(0, this.length, value); - break; - } - } - } - - // https://dom.spec.whatwg.org/#dom-node-textcontent - get textContent() { - switch (this.nodeType) { - case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: - case NODE_TYPE.ELEMENT_NODE: { - let text = ""; - for (const child of domSymbolTree.treeIterator(this)) { - if (child.nodeType === NODE_TYPE.TEXT_NODE || child.nodeType === NODE_TYPE.CDATA_SECTION_NODE) { - text += child.nodeValue; - } - } - return text; - } - - case NODE_TYPE.ATTRIBUTE_NODE: { - return this._value; - } - - case NODE_TYPE.TEXT_NODE: - case NODE_TYPE.CDATA_SECTION_NODE: // CDATASection is a subclass of Text - case NODE_TYPE.PROCESSING_INSTRUCTION_NODE: - case NODE_TYPE.COMMENT_NODE: { - return this._data; - } - - default: { - return null; - } - } - } - set textContent(value) { - if (value === null) { - value = ""; - } - - switch (this.nodeType) { - case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: - case NODE_TYPE.ELEMENT_NODE: { - // https://dom.spec.whatwg.org/#string-replace-all - let nodeImpl = null; - - if (value !== "") { - nodeImpl = this._ownerDocument.createTextNode(value); - } - - this._replaceAll(nodeImpl); - break; - } - - case NODE_TYPE.ATTRIBUTE_NODE: { - setAnExistingAttributeValue(this, value); - break; - } - - case NODE_TYPE.TEXT_NODE: - case NODE_TYPE.CDATA_SECTION_NODE: // CDATASection is a subclass of Text - case NODE_TYPE.PROCESSING_INSTRUCTION_NODE: - case NODE_TYPE.COMMENT_NODE: { - this.replaceData(0, this.length, value); - break; - } - } - } - - // https://dom.spec.whatwg.org/#dom-node-insertbefore - insertBefore(nodeImpl, childImpl) { - return this._preInsert(nodeImpl, childImpl); - } - - // https://dom.spec.whatwg.org/#dom-node-appendchild - appendChild(nodeImpl) { - return this._append(nodeImpl); - } - - // https://dom.spec.whatwg.org/#dom-node-replacechild - replaceChild(nodeImpl, childImpl) { - return this._replace(nodeImpl, childImpl); - } - - // https://dom.spec.whatwg.org/#dom-node-removechild - removeChild(oldChildImpl) { - return this._preRemove(oldChildImpl); - } - - // https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity - _preInsertValidity(nodeImpl, childImpl) { - const { nodeType } = nodeImpl; - const parentType = this.nodeType; - - if ( - parentType !== NODE_TYPE.DOCUMENT_NODE && - parentType !== NODE_TYPE.DOCUMENT_FRAGMENT_NODE && - parentType !== NODE_TYPE.ELEMENT_NODE - ) { - throw DOMException.create(this._globalObject, [ - `Node can't be inserted in a ${this.nodeName} parent.`, - "HierarchyRequestError" - ]); - } - - if (isHostInclusiveAncestor(nodeImpl, this)) { - throw DOMException.create(this._globalObject, [ - "The operation would yield an incorrect node tree.", - "HierarchyRequestError" - ]); - } - - if (childImpl && domSymbolTree.parent(childImpl) !== this) { - throw DOMException.create(this._globalObject, [ - "The child can not be found in the parent.", - "NotFoundError" - ]); - } - - if ( - nodeType !== NODE_TYPE.DOCUMENT_FRAGMENT_NODE && - nodeType !== NODE_TYPE.DOCUMENT_TYPE_NODE && - nodeType !== NODE_TYPE.ELEMENT_NODE && - nodeType !== NODE_TYPE.TEXT_NODE && - nodeType !== NODE_TYPE.CDATA_SECTION_NODE && // CData section extends from Text - nodeType !== NODE_TYPE.PROCESSING_INSTRUCTION_NODE && - nodeType !== NODE_TYPE.COMMENT_NODE - ) { - throw DOMException.create(this._globalObject, [ - `${nodeImpl.nodeName} node can't be inserted in parent node.`, - "HierarchyRequestError" - ]); - } - - if ( - (nodeType === NODE_TYPE.TEXT_NODE && parentType === NODE_TYPE.DOCUMENT_NODE) || - (nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE && parentType !== NODE_TYPE.DOCUMENT_NODE) - ) { - throw DOMException.create(this._globalObject, [ - `${nodeImpl.nodeName} node can't be inserted in ${this.nodeName} parent.`, - "HierarchyRequestError" - ]); - } - - if (parentType === NODE_TYPE.DOCUMENT_NODE) { - const nodeChildren = domSymbolTree.childrenToArray(nodeImpl); - const parentChildren = domSymbolTree.childrenToArray(this); - - switch (nodeType) { - case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: { - const nodeChildrenElements = nodeChildren.filter(child => child.nodeType === NODE_TYPE.ELEMENT_NODE); - if (nodeChildrenElements.length > 1) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeImpl.nodeName} node in ${this.nodeName} node.`, - "HierarchyRequestError" - ]); - } - - const hasNodeTextChildren = nodeChildren.some(child => child.nodeType === NODE_TYPE.TEXT_NODE); - if (hasNodeTextChildren) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeImpl.nodeName} node in ${this.nodeName} node.`, - "HierarchyRequestError" - ]); - } - - if ( - nodeChildrenElements.length === 1 && - ( - parentChildren.some(child => child.nodeType === NODE_TYPE.ELEMENT_NODE) || - (childImpl && childImpl.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE) || - ( - childImpl && - domSymbolTree.nextSibling(childImpl) && - domSymbolTree.nextSibling(childImpl).nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE - ) - ) - ) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeImpl.nodeName} node in ${this.nodeName} node.`, - "HierarchyRequestError" - ]); - } - break; - } - - case NODE_TYPE.ELEMENT_NODE: - if ( - parentChildren.some(child => child.nodeType === NODE_TYPE.ELEMENT_NODE) || - (childImpl && childImpl.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE) || - ( - childImpl && - domSymbolTree.nextSibling(childImpl) && - domSymbolTree.nextSibling(childImpl).nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE - ) - ) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeImpl.nodeName} node in ${this.nodeName} node.`, - "HierarchyRequestError" - ]); - } - break; - - case NODE_TYPE.DOCUMENT_TYPE_NODE: - if ( - parentChildren.some(child => child.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE) || - ( - childImpl && - domSymbolTree.previousSibling(childImpl) && - domSymbolTree.previousSibling(childImpl).nodeType === NODE_TYPE.ELEMENT_NODE - ) || - (!childImpl && parentChildren.some(child => child.nodeType === NODE_TYPE.ELEMENT_NODE)) - ) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeImpl.nodeName} node in ${this.nodeName} node.`, - "HierarchyRequestError" - ]); - } - break; - } - } - } - - // https://dom.spec.whatwg.org/#concept-node-pre-insert - _preInsert(nodeImpl, childImpl) { - this._preInsertValidity(nodeImpl, childImpl); - - let referenceChildImpl = childImpl; - if (referenceChildImpl === nodeImpl) { - referenceChildImpl = domSymbolTree.nextSibling(nodeImpl); - } - - this._ownerDocument._adoptNode(nodeImpl); - - this._insert(nodeImpl, referenceChildImpl); - - return nodeImpl; - } - - // https://dom.spec.whatwg.org/#concept-node-insert - _insert(nodeImpl, childImpl, suppressObservers) { - const count = nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE ? - domSymbolTree.childrenCount(nodeImpl) : - 1; - - if (childImpl) { - const childIndex = domSymbolTree.index(childImpl); - - for (const range of this._liveRanges()) { - const { _start, _end } = range; - - if (_start.offset > childIndex) { - range._setLiveRangeStart(this, _start.offset + count); - } - - if (_end.offset > childIndex) { - range._setLiveRangeEnd(this, _end.offset + count); - } - } - } - - const nodesImpl = nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE ? - domSymbolTree.childrenToArray(nodeImpl) : - [nodeImpl]; - - if (nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE) { - let grandChildImpl; - while ((grandChildImpl = domSymbolTree.firstChild(nodeImpl))) { - nodeImpl._remove(grandChildImpl, true); - } - } - - if (nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE) { - queueTreeMutationRecord(nodeImpl, [], nodesImpl, null, null); - } - - const previousChildImpl = childImpl ? - domSymbolTree.previousSibling(childImpl) : - domSymbolTree.lastChild(this); - - let isConnected; - - for (const node of nodesImpl) { - if (!childImpl) { - domSymbolTree.appendChild(this, node); - } else { - domSymbolTree.insertBefore(childImpl, node); - } - - if ( - (this.nodeType === NODE_TYPE.ELEMENT_NODE && this._shadowRoot !== null) && - (node.nodeType === NODE_TYPE.ELEMENT_NODE || node.nodeType === NODE_TYPE.TEXT_NODE) - ) { - assignSlot(node); - } - - this._modified(); - - if (node.nodeType === NODE_TYPE.TEXT_NODE || - node.nodeType === NODE_TYPE.CDATA_SECTION_NODE) { - this._childTextContentChangeSteps(); - } - - if (isSlot(this) && this._assignedNodes.length === 0 && isShadowRoot(nodeRoot(this))) { - signalSlotChange(this); - } - - const root = nodeRoot(node); - if (isShadowRoot(root)) { - assignSlotableForTree(root); - } - - if (this._attached && nodeImpl._attach) { - node._attach(); - } - - this._descendantAdded(this, node); - - if (isConnected === undefined) { - isConnected = node.isConnected; - } - - if (isConnected) { - for (const inclusiveDescendant of shadowIncludingInclusiveDescendantsIterator(node)) { - if (inclusiveDescendant._ceState === "custom") { - enqueueCECallbackReaction(inclusiveDescendant, "connectedCallback", []); - } else { - tryUpgradeElement(inclusiveDescendant); - } - } - } - } - - if (!suppressObservers) { - queueTreeMutationRecord(this, nodesImpl, [], previousChildImpl, childImpl); - } - } - - // https://dom.spec.whatwg.org/#concept-node-append - _append(nodeImpl) { - return this._preInsert(nodeImpl, null); - } - - // https://dom.spec.whatwg.org/#concept-node-replace - _replace(nodeImpl, childImpl) { - const { nodeType, nodeName } = nodeImpl; - const { nodeType: parentType, nodeName: parentName } = this; - - // Note: This section differs from the pre-insert validation algorithm. - if ( - parentType !== NODE_TYPE.DOCUMENT_NODE && - parentType !== NODE_TYPE.DOCUMENT_FRAGMENT_NODE && - parentType !== NODE_TYPE.ELEMENT_NODE - ) { - throw DOMException.create(this._globalObject, [ - `Node can't be inserted in a ${parentName} parent.`, - "HierarchyRequestError" - ]); - } - - if (isHostInclusiveAncestor(nodeImpl, this)) { - throw DOMException.create(this._globalObject, [ - "The operation would yield an incorrect node tree.", - "HierarchyRequestError" - ]); - } - - if (childImpl && domSymbolTree.parent(childImpl) !== this) { - throw DOMException.create(this._globalObject, [ - "The child can not be found in the parent.", - "NotFoundError" - ]); - } - - if ( - nodeType !== NODE_TYPE.DOCUMENT_FRAGMENT_NODE && - nodeType !== NODE_TYPE.DOCUMENT_TYPE_NODE && - nodeType !== NODE_TYPE.ELEMENT_NODE && - nodeType !== NODE_TYPE.TEXT_NODE && - nodeType !== NODE_TYPE.CDATA_SECTION_NODE && // CData section extends from Text - nodeType !== NODE_TYPE.PROCESSING_INSTRUCTION_NODE && - nodeType !== NODE_TYPE.COMMENT_NODE - ) { - throw DOMException.create(this._globalObject, [ - `${nodeName} node can't be inserted in parent node.`, - "HierarchyRequestError" - ]); - } - - if ( - (nodeType === NODE_TYPE.TEXT_NODE && parentType === NODE_TYPE.DOCUMENT_NODE) || - (nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE && parentType !== NODE_TYPE.DOCUMENT_NODE) - ) { - throw DOMException.create(this._globalObject, [ - `${nodeName} node can't be inserted in ${parentName} parent.`, - "HierarchyRequestError" - ]); - } - - if (parentType === NODE_TYPE.DOCUMENT_NODE) { - const nodeChildren = domSymbolTree.childrenToArray(nodeImpl); - const parentChildren = domSymbolTree.childrenToArray(this); - - switch (nodeType) { - case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: { - const nodeChildrenElements = nodeChildren.filter(child => child.nodeType === NODE_TYPE.ELEMENT_NODE); - if (nodeChildrenElements.length > 1) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeName} node in ${parentName} node.`, - "HierarchyRequestError" - ]); - } - - const hasNodeTextChildren = nodeChildren.some(child => child.nodeType === NODE_TYPE.TEXT_NODE); - if (hasNodeTextChildren) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeName} node in ${parentName} node.`, - "HierarchyRequestError" - ]); - } - - - const parentChildElements = parentChildren.filter(child => child.nodeType === NODE_TYPE.ELEMENT_NODE); - if ( - nodeChildrenElements.length === 1 && - ( - (parentChildElements.length === 1 && parentChildElements[0] !== childImpl) || - ( - childImpl && - domSymbolTree.nextSibling(childImpl) && - domSymbolTree.nextSibling(childImpl).nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE - ) - ) - ) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeName} node in ${parentName} node.`, - "HierarchyRequestError" - ]); - } - break; - } - - case NODE_TYPE.ELEMENT_NODE: - if ( - parentChildren.some(child => child.nodeType === NODE_TYPE.ELEMENT_NODE && child !== childImpl) || - ( - childImpl && - domSymbolTree.nextSibling(childImpl) && - domSymbolTree.nextSibling(childImpl).nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE - ) - ) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeName} node in ${parentName} node.`, - "HierarchyRequestError" - ]); - } - break; - - case NODE_TYPE.DOCUMENT_TYPE_NODE: - if ( - parentChildren.some(child => child.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE && child !== childImpl) || - ( - childImpl && - domSymbolTree.previousSibling(childImpl) && - domSymbolTree.previousSibling(childImpl).nodeType === NODE_TYPE.ELEMENT_NODE - ) - ) { - throw DOMException.create(this._globalObject, [ - `Invalid insertion of ${nodeName} node in ${parentName} node.`, - "HierarchyRequestError" - ]); - } - break; - } - } - - let referenceChildImpl = domSymbolTree.nextSibling(childImpl); - if (referenceChildImpl === nodeImpl) { - referenceChildImpl = domSymbolTree.nextSibling(nodeImpl); - } - - const previousSiblingImpl = domSymbolTree.previousSibling(childImpl); - - this._ownerDocument._adoptNode(nodeImpl); - - let removedNodesImpl = []; - - if (domSymbolTree.parent(childImpl)) { - removedNodesImpl = [childImpl]; - this._remove(childImpl, true); - } - - const nodesImpl = nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE ? - domSymbolTree.childrenToArray(nodeImpl) : - [nodeImpl]; - - this._insert(nodeImpl, referenceChildImpl, true); - - queueTreeMutationRecord(this, nodesImpl, removedNodesImpl, previousSiblingImpl, referenceChildImpl); - - return childImpl; - } - - // https://dom.spec.whatwg.org/#concept-node-replace-all - _replaceAll(nodeImpl) { - if (nodeImpl !== null) { - this._ownerDocument._adoptNode(nodeImpl); - } - - const removedNodesImpl = domSymbolTree.childrenToArray(this); - - let addedNodesImpl; - if (nodeImpl === null) { - addedNodesImpl = []; - } else if (nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE) { - addedNodesImpl = domSymbolTree.childrenToArray(nodeImpl); - } else { - addedNodesImpl = [nodeImpl]; - } - - for (const childImpl of domSymbolTree.childrenIterator(this)) { - this._remove(childImpl, true); - } - - if (nodeImpl !== null) { - this._insert(nodeImpl, null, true); - } - - if (addedNodesImpl.length > 0 || removedNodesImpl.length > 0) { - queueTreeMutationRecord(this, addedNodesImpl, removedNodesImpl, null, null); - } - } - - // https://dom.spec.whatwg.org/#concept-node-pre-remove - _preRemove(childImpl) { - if (domSymbolTree.parent(childImpl) !== this) { - throw DOMException.create(this._globalObject, [ - "The node to be removed is not a child of this node.", - "NotFoundError" - ]); - } - - this._remove(childImpl); - - return childImpl; - } - - // https://dom.spec.whatwg.org/#concept-node-remove - _remove(nodeImpl, suppressObservers) { - const index = domSymbolTree.index(nodeImpl); - - for (const descendant of domSymbolTree.treeIterator(nodeImpl)) { - for (const range of descendant._liveRanges()) { - const { _start, _end } = range; - - if (_start.node === descendant) { - range._setLiveRangeStart(this, index); - } - - if (_end.node === descendant) { - range._setLiveRangeEnd(this, index); - } - } - } - - for (const range of this._liveRanges()) { - const { _start, _end } = range; - - if (_start.node === this && _start.offset > index) { - range._setLiveRangeStart(this, _start.offset - 1); - } - - if (_end.node === this && _end.offset > index) { - range._setLiveRangeEnd(this, _end.offset - 1); - } - } - - if (this._ownerDocument) { - this._ownerDocument._runPreRemovingSteps(nodeImpl); - } - - const oldPreviousSiblingImpl = domSymbolTree.previousSibling(nodeImpl); - const oldNextSiblingImpl = domSymbolTree.nextSibling(nodeImpl); - - domSymbolTree.remove(nodeImpl); - - if (nodeImpl._assignedSlot) { - assignSlotable(nodeImpl._assignedSlot); - } - - if (isSlot(this) && this._assignedNodes.length === 0 && isShadowRoot(nodeRoot(this))) { - signalSlotChange(this); - } - - let hasSlotDescendant = isSlot(nodeImpl); - if (!hasSlotDescendant) { - for (const child of domSymbolTree.treeIterator(nodeImpl)) { - if (isSlot(child)) { - hasSlotDescendant = true; - break; - } - } - } - - if (hasSlotDescendant) { - assignSlotableForTree(nodeRoot(this)); - assignSlotableForTree(nodeImpl); - } - - this._modified(); - nodeImpl._detach(); - this._descendantRemoved(this, nodeImpl); - - if (this.isConnected) { - if (nodeImpl._ceState === "custom") { - enqueueCECallbackReaction(nodeImpl, "disconnectedCallback", []); - } - - for (const descendantImpl of shadowIncludingDescendantsIterator(nodeImpl)) { - if (descendantImpl._ceState === "custom") { - enqueueCECallbackReaction(descendantImpl, "disconnectedCallback", []); - } - } - } - - if (!suppressObservers) { - queueTreeMutationRecord(this, [], [nodeImpl], oldPreviousSiblingImpl, oldNextSiblingImpl); - } - - if (nodeImpl.nodeType === NODE_TYPE.TEXT_NODE) { - this._childTextContentChangeSteps(); - } - } -} - -module.exports = { - implementation: NodeImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/NodeList-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/NodeList-impl.js deleted file mode 100644 index 6f83035..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/NodeList-impl.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -const idlUtils = require("../generated/utils.js"); - -exports.implementation = class NodeListImpl { - constructor(globalObject, args, privateData) { - if (privateData.nodes) { - this._list = [...privateData.nodes]; - this._isLive = false; - } else { - this._list = []; - this._isLive = true; - this._version = -1; - this._element = privateData.element; - this._query = privateData.query; - this._update(); - } - } - get length() { - this._update(); - return this._list.length; - } - item(index) { - this._update(); - return this._list[index] || null; - } - _update() { - if (this._isLive) { - if (this._version < this._element._version) { - const snapshot = this._query(); - for (let i = 0; i < snapshot.length; i++) { - this._list[i] = snapshot[i]; - } - this._list.length = snapshot.length; - this._version = this._element._version; - } - } - } - get [idlUtils.supportedPropertyIndices]() { - this._update(); - return this._list.keys(); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/NonDocumentTypeChildNode-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/NonDocumentTypeChildNode-impl.js deleted file mode 100644 index 21bbb15..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/NonDocumentTypeChildNode-impl.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -const { domSymbolTree } = require("../helpers/internal-constants"); -const NODE_TYPE = require("../node-type"); - -class NonDocumentTypeChildNodeImpl { - get nextElementSibling() { - for (const sibling of domSymbolTree.nextSiblingsIterator(this)) { - if (sibling.nodeType === NODE_TYPE.ELEMENT_NODE) { - return sibling; - } - } - return null; - } - - get previousElementSibling() { - for (const sibling of domSymbolTree.previousSiblingsIterator(this)) { - if (sibling.nodeType === NODE_TYPE.ELEMENT_NODE) { - return sibling; - } - } - return null; - } -} - -module.exports = { - implementation: NonDocumentTypeChildNodeImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/NonElementParentNode-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/NonElementParentNode-impl.js deleted file mode 100644 index ca8d578..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/NonElementParentNode-impl.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -// https://dom.spec.whatwg.org/#interface-nonelementparentnode -// getElementById is implemented separately inside Document and DocumentFragment. -class NonElementParentNodeImpl { - -} - -module.exports = { - implementation: NonElementParentNodeImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js deleted file mode 100644 index 0639ec2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; - -const NodeList = require("../generated/NodeList"); -const HTMLCollection = require("../generated/HTMLCollection"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const NODE_TYPE = require("../node-type"); -const { convertNodesIntoNode } = require("../node"); - -class ParentNodeImpl { - get children() { - if (!this._childrenList) { - this._childrenList = HTMLCollection.createImpl(this._globalObject, [], { - element: this, - query: () => domSymbolTree.childrenToArray(this, { - filter: node => node.nodeType === NODE_TYPE.ELEMENT_NODE - }) - }); - } else { - this._childrenList._update(); - } - return this._childrenList; - } - - get firstElementChild() { - for (const child of domSymbolTree.childrenIterator(this)) { - if (child.nodeType === NODE_TYPE.ELEMENT_NODE) { - return child; - } - } - - return null; - } - - get lastElementChild() { - for (const child of domSymbolTree.childrenIterator(this, { reverse: true })) { - if (child.nodeType === NODE_TYPE.ELEMENT_NODE) { - return child; - } - } - - return null; - } - - get childElementCount() { - return this.children.length; - } - - prepend(...nodes) { - this._preInsert(convertNodesIntoNode(this._ownerDocument, nodes), this.firstChild); - } - - append(...nodes) { - this._append(convertNodesIntoNode(this._ownerDocument, nodes)); - } - - replaceChildren(...nodes) { - const node = convertNodesIntoNode(this._ownerDocument, nodes); - this._preInsertValidity(node, null); - this._replaceAll(node); - } - - querySelector(selectors) { - if (shouldAlwaysSelectNothing(this)) { - return null; - } - const domSelector = this._ownerDocument._domSelector; - return domSelector.querySelector(selectors, this); - } - - // WARNING FOR INTERNAL USERS: - // This returns a NodeList impl, not a NodeList wrapper. NodeList impls are not iterable and do not have indexed - // properties. To iterate over them, use `for (let i = 0; i < nodeListImpl.length; ++i) { nodeListImpl.item(i) }`. - querySelectorAll(selectors) { - if (shouldAlwaysSelectNothing(this)) { - return NodeList.createImpl(this._globalObject, [], { nodes: [] }); - } - const domSelector = this._ownerDocument._domSelector; - const nodes = domSelector.querySelectorAll(selectors, this); - return NodeList.createImpl(this._globalObject, [], { nodes }); - } -} - -function shouldAlwaysSelectNothing(elImpl) { - // This is true during initialization. - return elImpl === elImpl._ownerDocument && !elImpl.documentElement; -} - -module.exports = { - implementation: ParentNodeImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ProcessingInstruction-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ProcessingInstruction-impl.js deleted file mode 100644 index 348dadc..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ProcessingInstruction-impl.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -const CharacterDataImpl = require("./CharacterData-impl").implementation; - -const NODE_TYPE = require("../node-type"); - -class ProcessingInstructionImpl extends CharacterDataImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - this.nodeType = NODE_TYPE.PROCESSING_INSTRUCTION_NODE; - this._target = privateData.target; - } - - get target() { - return this._target; - } -} - -module.exports = { - implementation: ProcessingInstructionImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/RadioNodeList-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/RadioNodeList-impl.js deleted file mode 100644 index 9071f45..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/RadioNodeList-impl.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; - -const NodeListImpl = require("./NodeList-impl").implementation; - -class RadioNodeListImpl extends NodeListImpl { - // https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-radionodelist-value - // Note in general the spec says to manipulate/consult checkedness, but we use `checked` instead - // because the spec isn't very good here: https://github.com/whatwg/html/issues/7612. - - get value() { - this._update(); - - const element = this._list.find(e => e._localName === "input" && e.type === "radio" && e.checked); - if (element === undefined) { - return ""; - } - - if (!element.hasAttributeNS(null, "value")) { - return "on"; - } - - return element.getAttributeNS(null, "value"); - } - - set value(value) { - let element; - if (value === "on") { - element = this._list.find( - e => e._localName === "input" && - e.type === "radio" && - (!e.hasAttributeNS(null, "value") || e.getAttributeNS(null, "value") === value) - ); - } else { - element = this._list.find( - e => e._localName === "input" && - e.type === "radio" && - (e.hasAttributeNS(null, "value") && e.getAttributeNS(null, "value") === value) - ); - } - - if (element) { - element.checked = true; - } - } -} - -module.exports = { - implementation: RadioNodeListImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGDefsElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGDefsElement-impl.js deleted file mode 100644 index bf43cfb..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGDefsElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const SVGGraphicsElementImpl = require("./SVGGraphicsElement-impl").implementation; - -class SVGDefsElementImpl extends SVGGraphicsElementImpl {} - -module.exports = { - implementation: SVGDefsElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGDescElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGDescElement-impl.js deleted file mode 100644 index 6a07f2d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGDescElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const SVGElementImpl = require("./SVGElement-impl").implementation; - -class SVGDescElementImpl extends SVGElementImpl {} - -module.exports = { - implementation: SVGDescElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGElement-impl.js deleted file mode 100644 index 44135a3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGElement-impl.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; - -const { domSymbolTree } = require("../helpers/internal-constants"); -const { SVG_NS } = require("../helpers/namespaces"); -const { mixin } = require("../../utils"); -const ElementImpl = require("./Element-impl").implementation; -const ElementCSSInlineStyleImpl = require("./ElementCSSInlineStyle-impl").implementation; -const GlobalEventHandlersImpl = require("./GlobalEventHandlers-impl").implementation; -const HTMLOrSVGElementImpl = require("./HTMLOrSVGElement-impl").implementation; - -class SVGElementImpl extends ElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._initHTMLOrSVGElement(); - this._initElementCSSInlineStyle(); - this._initGlobalEvents(); - } - - // Keep in sync with HTMLElement. https://github.com/jsdom/jsdom/issues/2599 - _attrModified(name, value, oldValue) { - if (name === "style" && value !== oldValue && !this._settingCssText) { - this._settingCssText = true; - this._style.cssText = value; - this._settingCssText = false; - } else if (name.startsWith("on")) { - this._globalEventChanged(name.substring(2)); - } - - super._attrModified(name, value, oldValue); - } - - get ownerSVGElement() { - let e = domSymbolTree.parent(this); - while (e && e.namespaceURI === SVG_NS) { - if (e.localName === "svg") { - return e; - } - e = domSymbolTree.parent(e); - } - - return null; - } - - get viewportElement() { - // Get the nearest ancestor that establishes the viewport. - // https://svgwg.org/svg2-draft/coords.html#EstablishingANewSVGViewport - let e = domSymbolTree.parent(this); - while (e && e.namespaceURI === SVG_NS) { - if (e.localName === "svg" || e.localName === "symbol") { - return e; - } - e = domSymbolTree.parent(e); - } - return null; - } -} - -SVGElementImpl.attributeRegistry = new Map(); - -mixin(SVGElementImpl.prototype, ElementCSSInlineStyleImpl.prototype); -mixin(SVGElementImpl.prototype, GlobalEventHandlersImpl.prototype); -mixin(SVGElementImpl.prototype, HTMLOrSVGElementImpl.prototype); - -exports.implementation = SVGElementImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGGElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGGElement-impl.js deleted file mode 100644 index 26a26ab..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGGElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const SVGGraphicsElementImpl = require("./SVGGraphicsElement-impl").implementation; - -class SVGGElementImpl extends SVGGraphicsElementImpl {} - -module.exports = { - implementation: SVGGElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGGraphicsElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGGraphicsElement-impl.js deleted file mode 100644 index ef0ec1d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGGraphicsElement-impl.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -const { mixin } = require("../../utils"); -const SVGElementImpl = require("./SVGElement-impl").implementation; -const SVGTestsImpl = require("./SVGTests-impl").implementation; - -class SVGGraphicsElementImpl extends SVGElementImpl {} - -SVGGraphicsElementImpl.attributeRegistry = new Map([ - ...SVGElementImpl.attributeRegistry, - ...SVGTestsImpl.attributeRegistry -]); - -mixin(SVGGraphicsElementImpl.prototype, SVGTestsImpl.prototype); - -exports.implementation = SVGGraphicsElementImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGMetadataElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGMetadataElement-impl.js deleted file mode 100644 index 801158e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGMetadataElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const SVGElementImpl = require("./SVGElement-impl").implementation; - -class SVGMetadataElementImpl extends SVGElementImpl {} - -module.exports = { - implementation: SVGMetadataElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGSVGElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGSVGElement-impl.js deleted file mode 100644 index 1a86f3a..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGSVGElement-impl.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -const { mixin } = require("../../utils"); -const SVGNumber = require("../generated/SVGNumber"); -const SVGRect = require("../generated/SVGRect"); -const SVGGraphicsElementImpl = require("./SVGGraphicsElement-impl").implementation; -const WindowEventHandlersImpl = require("./WindowEventHandlers-impl").implementation; -const { domSymbolTree } = require("../helpers/internal-constants"); -const { ELEMENT_NODE } = require("../node-type"); - -class SVGSVGElementImpl extends SVGGraphicsElementImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - this._proxyWindowEventsToWindow(); - } - - createSVGNumber() { - return SVGNumber.createImpl(this._globalObject, [], {}); - } - - createSVGRect() { - return SVGRect.createImpl(this._globalObject, [], {}); - } - - getElementById(elementId) { - // TODO: optimize with _ids caching trick; see Document class. - for (const node of domSymbolTree.treeIterator(this)) { - if (node.nodeType === ELEMENT_NODE && node.getAttributeNS(null, "id") === elementId) { - return node; - } - } - return null; - } - - suspendRedraw() { - return 1; - } - unsuspendRedraw() {} - unsuspendRedrawAll() {} - forceRedraw() {} -} - -mixin(SVGSVGElementImpl.prototype, WindowEventHandlersImpl.prototype); - -module.exports = { - implementation: SVGSVGElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGSwitchElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGSwitchElement-impl.js deleted file mode 100644 index 58f9dfe..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGSwitchElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const SVGGraphicsElementImpl = require("./SVGGraphicsElement-impl").implementation; - -class SVGSwitchElementImpl extends SVGGraphicsElementImpl {} - -module.exports = { - implementation: SVGSwitchElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGSymbolElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGSymbolElement-impl.js deleted file mode 100644 index e868222..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGSymbolElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const SVGGraphicsElementImpl = require("./SVGGraphicsElement-impl").implementation; - -class SVGSymbolElementImpl extends SVGGraphicsElementImpl {} - -module.exports = { - implementation: SVGSymbolElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGTests-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGTests-impl.js deleted file mode 100644 index 6ff1182..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGTests-impl.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -const { splitOnASCIIWhitespace, splitOnCommas } = require("../helpers/strings"); -const { reserializeCommaSeparatedTokens, reserializeSpaceSeparatedTokens } = require("../helpers/svg/basic-types"); -const SVGStringList = require("../generated/SVGStringList"); - -class SVGTestsImpl { - get requiredExtensions() { - return SVGStringList.createImpl(this._globalObject, [], { - element: this, - attribute: "requiredExtensions" - }); - } - - get systemLanguage() { - return SVGStringList.createImpl(this._globalObject, [], { - element: this, - attribute: "systemLanguage" - }); - } -} - -SVGTestsImpl.attributeRegistry = new Map([ - // https://svgwg.org/svg2-draft/struct.html#RequiredExtensionsAttribute - [ - "requiredExtensions", { - getValue: splitOnASCIIWhitespace, - serialize: reserializeSpaceSeparatedTokens, - initialValue: undefined - } - ], - // https://svgwg.org/svg2-draft/struct.html#SystemLanguageAttribute - [ - "systemLanguage", { - getValue: splitOnCommas, - serialize: reserializeCommaSeparatedTokens, - initialValue: undefined - } - ] -]); - -exports.implementation = SVGTestsImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGTitleElement-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGTitleElement-impl.js deleted file mode 100644 index 7a9187d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/SVGTitleElement-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const SVGElementImpl = require("./SVGElement-impl").implementation; - -class SVGTitleElementImpl extends SVGElementImpl { } - -module.exports = { - implementation: SVGTitleElementImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js deleted file mode 100644 index 336203e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js +++ /dev/null @@ -1,41 +0,0 @@ -"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; - this._availableToElementInternals = false; - } - - _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 -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Slotable-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Slotable-impl.js deleted file mode 100644 index 5746a01..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Slotable-impl.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -const { findSlot, assignSlot, assignSlotable } = require("../helpers/shadow-dom"); - -// https://dom.spec.whatwg.org/#mixin-slotable -// https://dom.spec.whatwg.org/#light-tree-slotables -class SlotableMixinImpl { - _initSlotableMixin() { - this._slotableName = ""; - } - - _attrModifiedSlotableMixin(name, value, oldValue) { - if (name === "slot") { - if (value === oldValue) { - return; - } - - if (value === null && oldValue === "") { - return; - } - - if (value === "" && oldValue === null) { - return; - } - - if (value === null || value === "") { - this._slotableName = ""; - } else { - this._slotableName = value; - } - - - if (this._assignedSlot) { - assignSlotable(this._assignedSlot); - } - - assignSlot(this); - } - } - - get assignedSlot() { - return findSlot(this, "open"); - } -} - -module.exports = { - implementation: SlotableMixinImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Text-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Text-impl.js deleted file mode 100644 index a00359b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/Text-impl.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -const SlotableMixinImpl = require("./Slotable-impl").implementation; -const CharacterDataImpl = require("./CharacterData-impl").implementation; -const idlUtils = require("../generated/utils"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const DOMException = require("../generated/DOMException"); -const NODE_TYPE = require("../node-type"); -const { mixin } = require("../../utils"); - -// https://dom.spec.whatwg.org/#text -class TextImpl extends CharacterDataImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, { - data: args[0], - ownerDocument: idlUtils.implForWrapper(globalObject._document), - ...privateData - }); - - this._initSlotableMixin(); - - this.nodeType = NODE_TYPE.TEXT_NODE; - } - - // https://dom.spec.whatwg.org/#dom-text-splittext - // https://dom.spec.whatwg.org/#concept-text-split - splitText(offset) { - const { length } = this; - - if (offset > length) { - throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); - } - - const count = length - offset; - const newData = this.substringData(offset, count); - - const newNode = this._ownerDocument.createTextNode(newData); - - const parent = domSymbolTree.parent(this); - - if (parent !== null) { - parent._insert(newNode, this.nextSibling); - - for (const range of this._liveRanges()) { - const { _start, _end } = range; - - if (_start.node === this && _start.offset > offset) { - range._setLiveRangeStart(newNode, _start.offset - offset); - } - - if (_end.node === this && _end.offset > offset) { - range._setLiveRangeEnd(newNode, _end.offset - offset); - } - } - - const nodeIndex = domSymbolTree.index(this); - for (const range of parent._liveRanges()) { - const { _start, _end } = range; - - if (_start.node === parent && _start.offset === nodeIndex + 1) { - range._setLiveRangeStart(parent, _start.offset + 1); - } - - if (_end.node === parent && _end.offset === nodeIndex + 1) { - range._setLiveRangeEnd(parent, _end.offset + 1); - } - } - } - - this.replaceData(offset, count, ""); - - return newNode; - } - - // https://dom.spec.whatwg.org/#dom-text-wholetext - get wholeText() { - let wholeText = this.textContent; - let next; - let current = this; - while ((next = domSymbolTree.previousSibling(current)) && next.nodeType === NODE_TYPE.TEXT_NODE) { - wholeText = next.textContent + wholeText; - current = next; - } - current = this; - while ((next = domSymbolTree.nextSibling(current)) && next.nodeType === NODE_TYPE.TEXT_NODE) { - wholeText += next.textContent; - current = next; - } - return wholeText; - } -} - -mixin(TextImpl.prototype, SlotableMixinImpl.prototype); - -module.exports = { - implementation: TextImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js deleted file mode 100644 index bce1989..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -const { createEventAccessor } = require("../helpers/create-event-accessor"); - -const events = new Set([ - // WindowEventHandlers - "afterprint", - "beforeprint", - "beforeunload", - "hashchange", - "languagechange", - "message", - "messageerror", - "offline", - "online", - "pagehide", - "pageshow", - "popstate", - "rejectionhandled", - "storage", - "unhandledrejection", - "unload", - - // inherited and overridden - "blur", - "error", - "focus", - "load", - "resize", - "scroll" -]); - -// This class builds on GlobalEventHandlers, which must be mixed in first. -class WindowEventHandlersImpl { - _proxyWindowEventsToWindow() { - // We're a <body> or <frameset>, so we need to proxy these specific events to the Window (if it exists) - this._getEventHandlerTarget = event => { - if (events.has(event)) { - return this.ownerDocument.defaultView || null; - } - return this; - }; - } -} - -for (const event of events) { - createEventAccessor(WindowEventHandlersImpl.prototype, event); -} - -module.exports = { - implementation: WindowEventHandlersImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/XMLDocument-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/XMLDocument-impl.js deleted file mode 100644 index 487db01..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/nodes/XMLDocument-impl.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -const DocumentImpl = require("./Document-impl").implementation; - -exports.implementation = class XMLDocumentImpl extends DocumentImpl {}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/range/AbstractRange-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/range/AbstractRange-impl.js deleted file mode 100644 index 55a0719..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/range/AbstractRange-impl.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -// https://dom.spec.whatwg.org/#abstractrange -class AbstractRangeImpl { - constructor(globalObject, args, privateData) { - const { start, end } = privateData; - - this._start = start; - this._end = end; - - this._globalObject = globalObject; - } - - // https://dom.spec.whatwg.org/#dom-range-startcontainer - get startContainer() { - return this._start.node; - } - - // https://dom.spec.whatwg.org/#dom-range-startoffset - get startOffset() { - return this._start.offset; - } - - // https://dom.spec.whatwg.org/#dom-range-endcontainer - get endContainer() { - return this._end.node; - } - - // https://dom.spec.whatwg.org/#dom-range-endoffset - get endOffset() { - return this._end.offset; - } - - // https://dom.spec.whatwg.org/#dom-range-collapsed - get collapsed() { - const { _start, _end } = this; - return _start.node === _end.node && _start.offset === _end.offset; - } -} - -module.exports = { - implementation: AbstractRangeImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/range/Range-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/range/Range-impl.js deleted file mode 100644 index faafb46..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/range/Range-impl.js +++ /dev/null @@ -1,902 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); - -const { clone } = require("../node"); -const NODE_TYPE = require("../node-type"); -const { parseFragment } = require("../../browser/parser/index"); - -const { HTML_NS } = require("../helpers/namespaces"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const { compareBoundaryPointsPosition } = require("./boundary-point"); -const { nodeRoot, nodeLength, isInclusiveAncestor } = require("../helpers/node"); -const { createElement } = require("../helpers/create-element"); - -const AbstractRangeImpl = require("./AbstractRange-impl").implementation; - -const Range = require("../generated/Range"); -const DocumentFragment = require("../generated/DocumentFragment"); -const { implForWrapper } = require("../generated/utils"); - -const RANGE_COMPARISON_TYPE = { - START_TO_START: 0, - START_TO_END: 1, - END_TO_END: 2, - END_TO_START: 3 -}; - -class RangeImpl extends AbstractRangeImpl { - constructor(globalObject, args, privateData) { - super(globalObject, args, privateData); - - // Store a WeakRef to this Range for use in _referencedRanges. - // This allows Ranges to be garbage collected when no longer referenced by user code, - // preventing accumulation in long-lived nodes like document.body. - this._weakRef = new WeakRef(this); - - const defaultBoundaryPoint = { - node: implForWrapper(globalObject._document), - offset: 0 - }; - - const { - start = defaultBoundaryPoint, - end = defaultBoundaryPoint - } = privateData; - - this._setLiveRangeStart(start.node, start.offset); - this._setLiveRangeEnd(end.node, end.offset); - } - - // https://dom.spec.whatwg.org/#dom-range-commonancestorcontainer - get commonAncestorContainer() { - const { _start, _end } = this; - - for (const container of domSymbolTree.ancestorsIterator(_start.node)) { - if (isInclusiveAncestor(container, _end.node)) { - return container; - } - } - - return null; - } - - // https://dom.spec.whatwg.org/#dom-range-setstart - setStart(node, offset) { - setBoundaryPointStart(this, node, offset); - } - - // https://dom.spec.whatwg.org/#dom-range-setend - setEnd(node, offset) { - setBoundaryPointEnd(this, node, offset); - } - - // https://dom.spec.whatwg.org/#dom-range-setstartbefore - setStartBefore(node) { - const parent = domSymbolTree.parent(node); - - if (!parent) { - throw DOMException.create(this._globalObject, ["The given Node has no parent.", "InvalidNodeTypeError"]); - } - - setBoundaryPointStart(this, parent, domSymbolTree.index(node)); - } - - // https://dom.spec.whatwg.org/#dom-range-setstartafter - setStartAfter(node) { - const parent = domSymbolTree.parent(node); - - if (!parent) { - throw DOMException.create(this._globalObject, ["The given Node has no parent.", "InvalidNodeTypeError"]); - } - - setBoundaryPointStart(this, parent, domSymbolTree.index(node) + 1); - } - - // https://dom.spec.whatwg.org/#dom-range-setendbefore - setEndBefore(node) { - const parent = domSymbolTree.parent(node); - - if (!parent) { - throw DOMException.create(this._globalObject, ["The given Node has no parent.", "InvalidNodeTypeError"]); - } - - setBoundaryPointEnd(this, parent, domSymbolTree.index(node)); - } - - // https://dom.spec.whatwg.org/#dom-range-setendafter - setEndAfter(node) { - const parent = domSymbolTree.parent(node); - - if (!parent) { - throw DOMException.create(this._globalObject, ["The given Node has no parent.", "InvalidNodeTypeError"]); - } - - setBoundaryPointEnd(this, parent, domSymbolTree.index(node) + 1); - } - - // https://dom.spec.whatwg.org/#dom-range-collapse - collapse(toStart) { - if (toStart) { - this._setLiveRangeEnd(this._start.node, this._start.offset); - } else { - this._setLiveRangeStart(this._end.node, this._end.offset); - } - } - - // https://dom.spec.whatwg.org/#dom-range-selectnode - selectNode(node) { - selectNodeWithinRange(node, this); - } - - // https://dom.spec.whatwg.org/#dom-range-selectnodecontents - selectNodeContents(node) { - if (node.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE) { - throw DOMException.create(this._globalObject, [ - "DocumentType Node can't be used as boundary point.", - "InvalidNodeTypeError" - ]); - } - - const length = nodeLength(node); - - this._setLiveRangeStart(node, 0); - this._setLiveRangeEnd(node, length); - } - - // https://dom.spec.whatwg.org/#dom-range-compareboundarypoints - compareBoundaryPoints(how, sourceRange) { - if ( - how !== RANGE_COMPARISON_TYPE.START_TO_START && - how !== RANGE_COMPARISON_TYPE.START_TO_END && - how !== RANGE_COMPARISON_TYPE.END_TO_END && - how !== RANGE_COMPARISON_TYPE.END_TO_START - ) { - const message = "The comparison method provided must be one of 'START_TO_START', 'START_TO_END', 'END_TO_END', " + - "or 'END_TO_START'."; - throw DOMException.create(this._globalObject, [message, "NotSupportedError"]); - } - - if (this._root !== sourceRange._root) { - throw DOMException.create(this._globalObject, ["The two Ranges are not in the same tree.", "WrongDocumentError"]); - } - - let thisPoint, otherPoint; - if (how === RANGE_COMPARISON_TYPE.START_TO_START) { - thisPoint = this._start; - otherPoint = sourceRange._start; - } else if (how === RANGE_COMPARISON_TYPE.START_TO_END) { - thisPoint = this._end; - otherPoint = sourceRange._start; - } else if (how === RANGE_COMPARISON_TYPE.END_TO_END) { - thisPoint = this._end; - otherPoint = sourceRange._end; - } else { - thisPoint = this._start; - otherPoint = sourceRange._end; - } - - return compareBoundaryPointsPosition(thisPoint, otherPoint); - } - - // https://dom.spec.whatwg.org/#dom-range-deletecontents - deleteContents() { - if (this.collapsed) { - return; - } - - const { _start: originalStart, _end: originalEnd } = this; - - if ( - originalStart.node === originalEnd.node && - ( - originalStart.node.nodeType === NODE_TYPE.TEXT_NODE || - originalStart.node.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - originalStart.node.nodeType === NODE_TYPE.COMMENT_NODE - ) - ) { - originalStart.node.replaceData(originalStart.offset, originalEnd.offset - originalStart.offset, ""); - return; - } - - const nodesToRemove = []; - let currentNode = this._start.node; - const endNode = nextNodeDescendant(this._end.node); - while (currentNode && currentNode !== endNode) { - if ( - isContained(currentNode, this) && - !isContained(domSymbolTree.parent(currentNode), this) - ) { - nodesToRemove.push(currentNode); - } - - currentNode = domSymbolTree.following(currentNode); - } - - let newNode, newOffset; - if (isInclusiveAncestor(originalStart.node, originalEnd.node)) { - newNode = originalStart.node; - newOffset = originalStart.offset; - } else { - let referenceNode = originalStart.node; - - while ( - referenceNode && - !isInclusiveAncestor(domSymbolTree.parent(referenceNode), originalEnd.node) - ) { - referenceNode = domSymbolTree.parent(referenceNode); - } - - newNode = domSymbolTree.parent(referenceNode); - newOffset = domSymbolTree.index(referenceNode) + 1; - } - - if ( - originalStart.node.nodeType === NODE_TYPE.TEXT_NODE || - originalStart.node.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - originalStart.node.nodeType === NODE_TYPE.COMMENT_NODE - ) { - originalStart.node.replaceData(originalStart.offset, nodeLength(originalStart.node) - originalStart.offset, ""); - } - - for (const node of nodesToRemove) { - const parent = domSymbolTree.parent(node); - parent.removeChild(node); - } - - if ( - originalEnd.node.nodeType === NODE_TYPE.TEXT_NODE || - originalEnd.node.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - originalEnd.node.nodeType === NODE_TYPE.COMMENT_NODE - ) { - originalEnd.node.replaceData(0, originalEnd.offset, ""); - } - - this._setLiveRangeStart(newNode, newOffset); - this._setLiveRangeEnd(newNode, newOffset); - } - - // https://dom.spec.whatwg.org/#dom-range-extractcontents - extractContents() { - return extractRange(this); - } - - // https://dom.spec.whatwg.org/#dom-range-clonecontents - cloneContents() { - return cloneRange(this); - } - - // https://dom.spec.whatwg.org/#dom-range-insertnode - insertNode(node) { - insertNodeInRange(node, this); - } - - // https://dom.spec.whatwg.org/#dom-range-surroundcontents - surroundContents(newParent) { - let node = this.commonAncestorContainer; - const endNode = nextNodeDescendant(node); - while (node !== endNode) { - if (node.nodeType !== NODE_TYPE.TEXT_NODE && isPartiallyContained(node, this)) { - throw DOMException.create(this._globalObject, [ - "The Range has partially contains a non-Text node.", - "InvalidStateError" - ]); - } - - node = domSymbolTree.following(node); - } - - if ( - newParent.nodeType === NODE_TYPE.DOCUMENT_NODE || - newParent.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE || - newParent.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE - ) { - throw DOMException.create(this._globalObject, ["Invalid element type.", "InvalidNodeTypeError"]); - } - - const fragment = extractRange(this); - - while (domSymbolTree.firstChild(newParent)) { - newParent.removeChild(domSymbolTree.firstChild(newParent)); - } - - insertNodeInRange(newParent, this); - - newParent.appendChild(fragment); - - selectNodeWithinRange(newParent, this); - } - - // https://dom.spec.whatwg.org/#dom-range-clonerange - cloneRange() { - const { _start, _end, _globalObject } = this; - - return Range.createImpl(_globalObject, [], { - start: { node: _start.node, offset: _start.offset }, - end: { node: _end.node, offset: _end.offset } - }); - } - - // https://dom.spec.whatwg.org/#dom-range-detach - detach() { - // Do nothing by spec! - } - - // https://dom.spec.whatwg.org/#dom-range-ispointinrange - isPointInRange(node, offset) { - if (nodeRoot(node) !== this._root) { - return false; - } - - validateSetBoundaryPoint(node, offset); - - const bp = { node, offset }; - - if ( - compareBoundaryPointsPosition(bp, this._start) === -1 || - compareBoundaryPointsPosition(bp, this._end) === 1 - ) { - return false; - } - - return true; - } - - // https://dom.spec.whatwg.org/#dom-range-comparepoint - comparePoint(node, offset) { - if (nodeRoot(node) !== this._root) { - throw DOMException.create(this._globalObject, [ - "The given Node and the Range are not in the same tree.", - "WrongDocumentError" - ]); - } - - validateSetBoundaryPoint(node, offset); - - const bp = { node, offset }; - if (compareBoundaryPointsPosition(bp, this._start) === -1) { - return -1; - } else if (compareBoundaryPointsPosition(bp, this._end) === 1) { - return 1; - } - - return 0; - } - - // https://dom.spec.whatwg.org/#dom-range-intersectsnode - intersectsNode(node) { - if (nodeRoot(node) !== this._root) { - return false; - } - - const parent = domSymbolTree.parent(node); - if (!parent) { - return true; - } - - const offset = domSymbolTree.index(node); - - return ( - compareBoundaryPointsPosition({ node: parent, offset }, this._end) === -1 && - compareBoundaryPointsPosition({ node: parent, offset: offset + 1 }, this._start) === 1 - ); - } - - // https://dom.spec.whatwg.org/#dom-range-stringifier - toString() { - let s = ""; - const { _start, _end } = this; - - if (_start.node === _end.node && _start.node.nodeType === NODE_TYPE.TEXT_NODE) { - return _start.node.data.slice(_start.offset, _end.offset); - } - - if (_start.node.nodeType === NODE_TYPE.TEXT_NODE) { - s += _start.node.data.slice(_start.offset); - } - - let currentNode = _start.node; - const endNode = nextNodeDescendant(_end.node); - while (currentNode && currentNode !== endNode) { - if (currentNode.nodeType === NODE_TYPE.TEXT_NODE && isContained(currentNode, this)) { - s += currentNode.data; - } - - currentNode = domSymbolTree.following(currentNode); - } - - if (_end.node.nodeType === NODE_TYPE.TEXT_NODE) { - s += _end.node.data.slice(0, _end.offset); - } - - return s; - } - - // https://w3c.github.io/DOM-Parsing/#dom-range-createcontextualfragment - createContextualFragment(fragment) { - const { node } = this._start; - - let element; - switch (node.nodeType) { - case NODE_TYPE.DOCUMENT_NODE: - case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: - element = null; - break; - - case NODE_TYPE.ELEMENT_NODE: - element = node; - break; - - case NODE_TYPE.TEXT_NODE: - case NODE_TYPE.COMMENT_NODE: - element = node.parentElement; - break; - - default: - throw new Error("Internal error: Invalid range start node"); - } - - if ( - element === null || ( - element._ownerDocument._parsingMode === "html" && - element._localName === "html" && - element._namespaceURI === HTML_NS - ) - ) { - element = createElement(node._ownerDocument, "body", HTML_NS); - } - - return parseFragment(fragment, element); - } - - // https://dom.spec.whatwg.org/#concept-range-root - get _root() { - return nodeRoot(this._start.node); - } - - _setLiveRangeStart(node, offset) { - if ( - this._start && - this._start.node !== node && - this._start.node !== this._end.node - ) { - this._start.node._referencedRanges.delete(this._weakRef); - } - - if (!node._referencedRanges.has(this._weakRef)) { - node._referencedRanges.add(this._weakRef); - } - - this._start = { - node, - offset - }; - } - - _setLiveRangeEnd(node, offset) { - if ( - this._end && - this._end.node !== node && - this._end.node !== this._start.node - ) { - this._end.node._referencedRanges.delete(this._weakRef); - } - - if (!node._referencedRanges.has(this._weakRef)) { - node._referencedRanges.add(this._weakRef); - } - - this._end = { - node, - offset - }; - } -} - - -function nextNodeDescendant(node) { - while (node && !domSymbolTree.nextSibling(node)) { - node = domSymbolTree.parent(node); - } - - if (!node) { - return null; - } - - return domSymbolTree.nextSibling(node); -} - -// https://dom.spec.whatwg.org/#concept-range-bp-set -function validateSetBoundaryPoint(node, offset) { - if (node.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE) { - throw DOMException.create(node._globalObject, [ - "DocumentType Node can't be used as boundary point.", - "InvalidNodeTypeError" - ]); - } - - if (offset > nodeLength(node)) { - throw DOMException.create(node._globalObject, ["Offset out of bound.", "IndexSizeError"]); - } -} -function setBoundaryPointStart(range, node, offset) { - validateSetBoundaryPoint(node, offset); - - const bp = { node, offset }; - if ( - nodeRoot(node) !== range._root || - compareBoundaryPointsPosition(bp, range._end) === 1 - ) { - range._setLiveRangeEnd(node, offset); - } - - range._setLiveRangeStart(node, offset); -} -function setBoundaryPointEnd(range, node, offset) { - validateSetBoundaryPoint(node, offset); - - const bp = { node, offset }; - if ( - nodeRoot(node) !== range._root || - compareBoundaryPointsPosition(bp, range._start) === -1 - ) { - range._setLiveRangeStart(node, offset); - } - - range._setLiveRangeEnd(node, offset); -} - -// https://dom.spec.whatwg.org/#concept-range-select -function selectNodeWithinRange(node, range) { - const parent = domSymbolTree.parent(node); - - if (!parent) { - throw DOMException.create(node._globalObject, ["The given Node has no parent.", "InvalidNodeTypeError"]); - } - - const index = domSymbolTree.index(node); - - range._setLiveRangeStart(parent, index); - range._setLiveRangeEnd(parent, index + 1); -} - -// https://dom.spec.whatwg.org/#contained -function isContained(node, range) { - const { _start, _end } = range; - return ( - compareBoundaryPointsPosition({ node, offset: 0 }, _start) === 1 && - compareBoundaryPointsPosition({ node, offset: nodeLength(node) }, _end) === -1 - ); -} - -// https://dom.spec.whatwg.org/#partially-contained -function isPartiallyContained(node, range) { - const { _start, _end } = range; - return ( - (isInclusiveAncestor(node, _start.node) && !isInclusiveAncestor(node, _end.node)) || - (!isInclusiveAncestor(node, _start.node) && isInclusiveAncestor(node, _end.node)) - ); -} - -// https://dom.spec.whatwg.org/#concept-range-insert -function insertNodeInRange(node, range) { - const { node: startNode, offset: startOffset } = range._start; - - if ( - startNode.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - startNode.nodeType === NODE_TYPE.COMMENT_NODE || - (startNode.nodeType === NODE_TYPE.TEXT_NODE && !domSymbolTree.parent(startNode)) || - node === startNode - ) { - throw DOMException.create(node._globalObject, ["Invalid start node.", "HierarchyRequestError"]); - } - - let referenceNode = startNode.nodeType === NODE_TYPE.TEXT_NODE ? - startNode : - domSymbolTree.childrenToArray(startNode)[startOffset] || null; - const parent = !referenceNode ? - startNode : - domSymbolTree.parent(referenceNode); - - parent._preInsertValidity(node, referenceNode); - - if (startNode.nodeType === NODE_TYPE.TEXT_NODE) { - referenceNode = startNode.splitText(startOffset); - } - - if (node === referenceNode) { - referenceNode = domSymbolTree.nextSibling(referenceNode); - } - - const nodeParent = domSymbolTree.parent(node); - if (nodeParent) { - nodeParent.removeChild(node); - } - - let newOffset = !referenceNode ? nodeLength(parent) : domSymbolTree.index(referenceNode); - newOffset += node.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE ? nodeLength(node) : 1; - - parent.insertBefore(node, referenceNode); - - if (range.collapsed) { - range._setLiveRangeEnd(parent, newOffset); - } -} - -// https://dom.spec.whatwg.org/#concept-range-clone -function cloneRange(range) { - const { _start: originalStart, _end: originalEnd, _globalObject } = range; - - const fragment = DocumentFragment.createImpl(_globalObject, [], { - ownerDocument: originalStart.node._ownerDocument - }); - - if (range.collapsed) { - return fragment; - } - - if ( - originalStart.node === originalEnd.node && - ( - originalStart.node.nodeType === NODE_TYPE.TEXT_NODE || - originalStart.node.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - originalStart.node.nodeType === NODE_TYPE.COMMENT_NODE - ) - ) { - const cloned = clone(originalStart.node); - cloned._data = cloned.substringData(originalStart.offset, originalEnd.offset - originalStart.offset); - - fragment.appendChild(cloned); - - return fragment; - } - - let commonAncestor = originalStart.node; - while (!isInclusiveAncestor(commonAncestor, originalEnd.node)) { - commonAncestor = domSymbolTree.parent(commonAncestor); - } - - let firstPartialContainedChild = null; - if (!isInclusiveAncestor(originalStart.node, originalEnd.node)) { - let candidate = domSymbolTree.firstChild(commonAncestor); - while (!firstPartialContainedChild) { - if (isPartiallyContained(candidate, range)) { - firstPartialContainedChild = candidate; - } - - candidate = domSymbolTree.nextSibling(candidate); - } - } - - let lastPartiallyContainedChild = null; - if (!isInclusiveAncestor(originalEnd.node, originalStart.node)) { - let candidate = domSymbolTree.lastChild(commonAncestor); - while (!lastPartiallyContainedChild) { - if (isPartiallyContained(candidate, range)) { - lastPartiallyContainedChild = candidate; - } - - candidate = domSymbolTree.previousSibling(candidate); - } - } - - const containedChildren = domSymbolTree.childrenToArray(commonAncestor) - .filter(node => isContained(node, range)); - - const hasDoctypeChildren = containedChildren.some(node => node.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE); - if (hasDoctypeChildren) { - throw DOMException.create(range._globalObject, ["Invalid document type element.", "HierarchyRequestError"]); - } - - if ( - firstPartialContainedChild !== null && - ( - firstPartialContainedChild.nodeType === NODE_TYPE.TEXT_NODE || - firstPartialContainedChild.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - firstPartialContainedChild.nodeType === NODE_TYPE.COMMENT_NODE - ) - ) { - const cloned = clone(originalStart.node); - cloned._data = cloned.substringData(originalStart.offset, nodeLength(originalStart.node) - originalStart.offset); - - fragment.appendChild(cloned); - } else if (firstPartialContainedChild !== null) { - const cloned = clone(firstPartialContainedChild); - fragment.appendChild(cloned); - - const subrange = Range.createImpl(_globalObject, [], { - start: { node: originalStart.node, offset: originalStart.offset }, - end: { node: firstPartialContainedChild, offset: nodeLength(firstPartialContainedChild) } - }); - - const subfragment = cloneRange(subrange); - cloned.appendChild(subfragment); - } - - for (const containedChild of containedChildren) { - const cloned = clone(containedChild, undefined, true); - fragment.appendChild(cloned); - } - - if ( - lastPartiallyContainedChild !== null && - ( - lastPartiallyContainedChild.nodeType === NODE_TYPE.TEXT_NODE || - lastPartiallyContainedChild.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - lastPartiallyContainedChild.nodeType === NODE_TYPE.COMMENT_NODE - ) - ) { - const cloned = clone(originalEnd.node); - cloned._data = cloned.substringData(0, originalEnd.offset); - - fragment.appendChild(cloned); - } else if (lastPartiallyContainedChild !== null) { - const cloned = clone(lastPartiallyContainedChild); - fragment.appendChild(cloned); - - const subrange = Range.createImpl(_globalObject, [], { - start: { node: lastPartiallyContainedChild, offset: 0 }, - end: { node: originalEnd.node, offset: originalEnd.offset } - }); - - const subfragment = cloneRange(subrange); - cloned.appendChild(subfragment); - } - - return fragment; -} - -// https://dom.spec.whatwg.org/#concept-range-extract -function extractRange(range) { - const { _start: originalStart, _end: originalEnd, _globalObject } = range; - - const fragment = DocumentFragment.createImpl(_globalObject, [], { - ownerDocument: originalStart.node._ownerDocument - }); - - if (range.collapsed) { - return fragment; - } - - if ( - originalStart.node === originalEnd.node && - ( - originalStart.node.nodeType === NODE_TYPE.TEXT_NODE || - originalStart.node.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - originalStart.node.nodeType === NODE_TYPE.COMMENT_NODE - ) - ) { - const cloned = clone(originalStart.node); - cloned._data = cloned.substringData(originalStart.offset, originalEnd.offset - originalStart.offset); - - fragment.appendChild(cloned); - originalStart.node.replaceData(originalStart.offset, originalEnd.offset - originalStart.offset, ""); - - return fragment; - } - - let commonAncestor = originalStart.node; - while (!isInclusiveAncestor(commonAncestor, originalEnd.node)) { - commonAncestor = domSymbolTree.parent(commonAncestor); - } - - let firstPartialContainedChild = null; - if (!isInclusiveAncestor(originalStart.node, originalEnd.node)) { - let candidate = domSymbolTree.firstChild(commonAncestor); - while (!firstPartialContainedChild) { - if (isPartiallyContained(candidate, range)) { - firstPartialContainedChild = candidate; - } - - candidate = domSymbolTree.nextSibling(candidate); - } - } - - let lastPartiallyContainedChild = null; - if (!isInclusiveAncestor(originalEnd.node, originalStart.node)) { - let candidate = domSymbolTree.lastChild(commonAncestor); - while (!lastPartiallyContainedChild) { - if (isPartiallyContained(candidate, range)) { - lastPartiallyContainedChild = candidate; - } - - candidate = domSymbolTree.previousSibling(candidate); - } - } - - const containedChildren = domSymbolTree.childrenToArray(commonAncestor) - .filter(node => isContained(node, range)); - - const hasDoctypeChildren = containedChildren.some(node => node.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE); - if (hasDoctypeChildren) { - throw DOMException.create(range._globalObject, ["Invalid document type element.", "HierarchyRequestError"]); - } - - let newNode, newOffset; - if (isInclusiveAncestor(originalStart.node, originalEnd.node)) { - newNode = originalStart.node; - newOffset = originalStart.offset; - } else { - let referenceNode = originalStart.node; - - while ( - referenceNode && - !isInclusiveAncestor(domSymbolTree.parent(referenceNode), originalEnd.node) - ) { - referenceNode = domSymbolTree.parent(referenceNode); - } - - newNode = domSymbolTree.parent(referenceNode); - newOffset = domSymbolTree.index(referenceNode) + 1; - } - - if ( - firstPartialContainedChild !== null && - ( - firstPartialContainedChild.nodeType === NODE_TYPE.TEXT_NODE || - firstPartialContainedChild.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - firstPartialContainedChild.nodeType === NODE_TYPE.COMMENT_NODE - ) - ) { - const cloned = clone(originalStart.node); - cloned._data = cloned.substringData(originalStart.offset, nodeLength(originalStart.node) - originalStart.offset); - - fragment.appendChild(cloned); - - originalStart.node.replaceData(originalStart.offset, nodeLength(originalStart.node) - originalStart.offset, ""); - } else if (firstPartialContainedChild !== null) { - const cloned = clone(firstPartialContainedChild); - fragment.appendChild(cloned); - - const subrange = Range.createImpl(_globalObject, [], { - start: { node: originalStart.node, offset: originalStart.offset }, - end: { node: firstPartialContainedChild, offset: nodeLength(firstPartialContainedChild) } - }); - - const subfragment = extractRange(subrange); - cloned.appendChild(subfragment); - } - - for (const containedChild of containedChildren) { - fragment.appendChild(containedChild); - } - - if ( - lastPartiallyContainedChild !== null && - ( - lastPartiallyContainedChild.nodeType === NODE_TYPE.TEXT_NODE || - lastPartiallyContainedChild.nodeType === NODE_TYPE.PROCESSING_INSTRUCTION_NODE || - lastPartiallyContainedChild.nodeType === NODE_TYPE.COMMENT_NODE - ) - ) { - const cloned = clone(originalEnd.node); - cloned._data = cloned.substringData(0, originalEnd.offset); - - fragment.appendChild(cloned); - - originalEnd.node.replaceData(0, originalEnd.offset, ""); - } else if (lastPartiallyContainedChild !== null) { - const cloned = clone(lastPartiallyContainedChild); - fragment.appendChild(cloned); - - const subrange = Range.createImpl(_globalObject, [], { - start: { node: lastPartiallyContainedChild, offset: 0 }, - end: { node: originalEnd.node, offset: originalEnd.offset } - }); - - const subfragment = extractRange(subrange); - cloned.appendChild(subfragment); - } - - range._setLiveRangeStart(newNode, newOffset); - range._setLiveRangeEnd(newNode, newOffset); - - return fragment; -} - -module.exports = { - implementation: RangeImpl, - - setBoundaryPointStart, - setBoundaryPointEnd -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/range/StaticRange-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/range/StaticRange-impl.js deleted file mode 100644 index 328a28e..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/range/StaticRange-impl.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); - -const NODE_TYPE = require("../node-type"); - -const AbstractRangeImpl = require("./AbstractRange-impl").implementation; - -// https://dom.spec.whatwg.org/#staticrange -class StaticRangeImpl extends AbstractRangeImpl { - // https://dom.spec.whatwg.org/#dom-staticrange-staticrange - constructor(globalObject, args) { - const { startContainer, startOffset, endContainer, endOffset } = args[0]; - - if ( - startContainer.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE || - startContainer.nodeType === NODE_TYPE.ATTRIBUTE_NODE || - endContainer.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE || - endContainer.nodeType === NODE_TYPE.ATTRIBUTE_NODE - ) { - throw DOMException.create(globalObject, ["The supplied node is incorrect.", "InvalidNodeTypeError"]); - } - - super(globalObject, [], { - start: { - node: startContainer, - offset: startOffset - }, - end: { - node: endContainer, - offset: endOffset - } - }); - } -} - -module.exports = { - implementation: StaticRangeImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/range/boundary-point.js b/vanilla/node_modules/jsdom/lib/jsdom/living/range/boundary-point.js deleted file mode 100644 index a0eabdf..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/range/boundary-point.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -const { domSymbolTree } = require("../helpers/internal-constants"); -const { nodeRoot, isFollowing, isInclusiveAncestor } = require("../helpers/node"); - -// Returns 0 if equal, +1 for after and -1 for before -// https://dom.spec.whatwg.org/#concept-range-bp-after -function compareBoundaryPointsPosition(bpA, bpB) { - const { node: nodeA, offset: offsetA } = bpA; - const { node: nodeB, offset: offsetB } = bpB; - - if (nodeRoot(nodeA) !== nodeRoot(nodeB)) { - throw new Error(`Internal Error: Boundary points should have the same root!`); - } - - if (nodeA === nodeB) { - if (offsetA === offsetB) { - return 0; - } else if (offsetA < offsetB) { - return -1; - } - - return 1; - } - - if (isFollowing(nodeA, nodeB)) { - return compareBoundaryPointsPosition(bpB, bpA) === -1 ? 1 : -1; - } - - if (isInclusiveAncestor(nodeA, nodeB)) { - let child = nodeB; - - while (domSymbolTree.parent(child) !== nodeA) { - child = domSymbolTree.parent(child); - } - - if (domSymbolTree.index(child) < offsetA) { - return 1; - } - } - - return -1; -} - -module.exports = { - compareBoundaryPointsPosition -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/selection/Selection-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/selection/Selection-impl.js deleted file mode 100644 index 0b4ffa7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/selection/Selection-impl.js +++ /dev/null @@ -1,358 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); - -const NODE_TYPE = require("../node-type"); -const { nodeLength, nodeRoot } = require("../helpers/node"); -const { domSymbolTree } = require("../helpers/internal-constants"); -const { compareBoundaryPointsPosition } = require("../range/boundary-point"); - -const { setBoundaryPointStart, setBoundaryPointEnd } = require("../range/Range-impl"); - -const Range = require("../generated/Range"); -const { implForWrapper } = require("../generated/utils"); -const { fireAnEvent } = require("../helpers/events"); - -// https://w3c.github.io/selection-api/#dfn-direction -const SELECTION_DIRECTION = { - FORWARDS: 1, - BACKWARDS: -1, - DIRECTIONLESS: 0 -}; - -// https://w3c.github.io/selection-api/#dom-selection -class SelectionImpl { - constructor(globalObject) { - this._range = null; - this._direction = SELECTION_DIRECTION.DIRECTIONLESS; - - this._globalObject = globalObject; - } - - // https://w3c.github.io/selection-api/#dom-selection-anchornode - get anchorNode() { - const anchor = this._anchor; - return anchor ? anchor.node : null; - } - - // https://w3c.github.io/selection-api/#dom-selection-anchoroffset - get anchorOffset() { - const anchor = this._anchor; - return anchor ? anchor.offset : 0; - } - - // https://w3c.github.io/selection-api/#dom-selection-focusnode - get focusNode() { - const focus = this._focus; - return focus ? focus.node : null; - } - - // https://w3c.github.io/selection-api/#dom-selection-focusoffset - get focusOffset() { - const focus = this._focus; - return focus ? focus.offset : 0; - } - - // https://w3c.github.io/selection-api/#dom-selection-iscollapsed - get isCollapsed() { - return this._range === null || this._range.collapsed; - } - - // https://w3c.github.io/selection-api/#dom-selection-rangecount - get rangeCount() { - return this._isEmpty() ? 0 : 1; - } - - // https://w3c.github.io/selection-api/#dom-selection-type - get type() { - if (this._isEmpty()) { - return "None"; - } else if (this._range.collapsed) { - return "Caret"; - } - - return "Range"; - } - - // https://w3c.github.io/selection-api/#dom-selection-getrangeat - getRangeAt(index) { - if (index !== 0 || this._isEmpty()) { - throw DOMException.create(this._globalObject, ["Invalid range index.", "IndexSizeError"]); - } - - return this._range; - } - - // https://w3c.github.io/selection-api/#dom-selection-addrange - addRange(range) { - if (range._root === implForWrapper(this._globalObject._document) && this.rangeCount === 0) { - this._associateRange(range); - } - } - - // https://w3c.github.io/selection-api/#dom-selection-removerange - removeRange(range) { - if (range !== this._range) { - throw DOMException.create(this._globalObject, ["Invalid range.", "NotFoundError"]); - } - - this._associateRange(null); - } - - // https://w3c.github.io/selection-api/#dom-selection-removeallranges - removeAllRanges() { - this._associateRange(null); - } - - // https://w3c.github.io/selection-api/#dom-selection-empty - empty() { - this.removeAllRanges(); - } - - // https://w3c.github.io/selection-api/#dom-selection-collapse - collapse(node, offset) { - if (node === null) { - this.removeAllRanges(); - return; - } - - if (node.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE) { - throw DOMException.create(this._globalObject, [ - "DocumentType Node can't be used as boundary point.", - "InvalidNodeTypeError" - ]); - } - - if (offset > nodeLength(node)) { - throw DOMException.create(this._globalObject, ["Invalid range index.", "IndexSizeError"]); - } - - if (nodeRoot(node) !== implForWrapper(this._globalObject._document)) { - return; - } - - const newRange = Range.createImpl(this._globalObject, [], { - start: { node, offset: 0 }, - end: { node, offset: 0 } - }); - - setBoundaryPointStart(newRange, node, offset); - setBoundaryPointEnd(newRange, node, offset); - - this._associateRange(newRange); - } - - // https://w3c.github.io/selection-api/#dom-selection-setposition - setPosition(node, offset) { - this.collapse(node, offset); - } - - // https://w3c.github.io/selection-api/#dom-selection-collapsetostart - collapseToStart() { - if (this._isEmpty()) { - throw DOMException.create(this._globalObject, ["There is no selection to collapse.", "InvalidStateError"]); - } - - const { node, offset } = this._range._start; - const newRange = Range.createImpl(this._globalObject, [], { - start: { node, offset }, - end: { node, offset } - }); - - this._associateRange(newRange); - } - - // https://w3c.github.io/selection-api/#dom-selection-collapsetoend - collapseToEnd() { - if (this._isEmpty()) { - throw DOMException.create(this._globalObject, ["There is no selection to collapse.", "InvalidStateError"]); - } - - const { node, offset } = this._range._end; - const newRange = Range.createImpl(this._globalObject, [], { - start: { node, offset }, - end: { node, offset } - }); - - this._associateRange(newRange); - } - - // https://w3c.github.io/selection-api/#dom-selection-extend - extend(node, offset) { - if (nodeRoot(node) !== implForWrapper(this._globalObject._document)) { - return; - } - - if (this._isEmpty()) { - throw DOMException.create(this._globalObject, ["There is no selection to extend.", "InvalidStateError"]); - } - - const { _anchor: oldAnchor } = this; - const newFocus = { node, offset }; - - const newRange = Range.createImpl(this._globalObject, [], { - start: { node, offset: 0 }, - end: { node, offset: 0 } - }); - - if (nodeRoot(node) !== this._range._root) { - setBoundaryPointStart(newRange, newFocus.node, newFocus.offset); - setBoundaryPointEnd(newRange, newFocus.node, newFocus.offset); - } else if (compareBoundaryPointsPosition(oldAnchor, newFocus) <= 0) { - setBoundaryPointStart(newRange, oldAnchor.node, oldAnchor.offset); - setBoundaryPointEnd(newRange, newFocus.node, newFocus.offset); - } else { - setBoundaryPointStart(newRange, newFocus.node, newFocus.offset); - setBoundaryPointEnd(newRange, oldAnchor.node, oldAnchor.offset); - } - - this._associateRange(newRange); - - this._direction = compareBoundaryPointsPosition(newFocus, oldAnchor) === -1 ? - SELECTION_DIRECTION.BACKWARDS : - SELECTION_DIRECTION.FORWARDS; - } - - // https://w3c.github.io/selection-api/#dom-selection-setbaseandextent - setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset) { - if (anchorOffset > nodeLength(anchorNode) || focusOffset > nodeLength(focusNode)) { - throw DOMException.create(this._globalObject, ["Invalid anchor or focus offset.", "IndexSizeError"]); - } - - const document = implForWrapper(this._globalObject._document); - if (document !== nodeRoot(anchorNode) || document !== nodeRoot(focusNode)) { - return; - } - - const anchor = { node: anchorNode, offset: anchorOffset }; - const focus = { node: focusNode, offset: focusOffset }; - - let newRange; - if (compareBoundaryPointsPosition(anchor, focus) === -1) { - newRange = Range.createImpl(this._globalObject, [], { - start: { node: anchor.node, offset: anchor.offset }, - end: { node: focus.node, offset: focus.offset } - }); - } else { - newRange = Range.createImpl(this._globalObject, [], { - start: { node: focus.node, offset: focus.offset }, - end: { node: anchor.node, offset: anchor.offset } - }); - } - - this._associateRange(newRange); - - this._direction = compareBoundaryPointsPosition(focus, anchor) === -1 ? - SELECTION_DIRECTION.BACKWARDS : - SELECTION_DIRECTION.FORWARDS; - } - - // https://w3c.github.io/selection-api/#dom-selection-selectallchildren - selectAllChildren(node) { - if (node.nodeType === NODE_TYPE.DOCUMENT_TYPE_NODE) { - throw DOMException.create(this._globalObject, [ - "DocumentType Node can't be used as boundary point.", - "InvalidNodeTypeError" - ]); - } - - const document = implForWrapper(this._globalObject._document); - if (document !== nodeRoot(node)) { - return; - } - - const length = domSymbolTree.childrenCount(node); - - const newRange = Range.createImpl(this._globalObject, [], { - start: { node, offset: 0 }, - end: { node, offset: 0 } - }); - - setBoundaryPointStart(newRange, node, 0); - setBoundaryPointEnd(newRange, node, length); - - this._associateRange(newRange); - } - - // https://w3c.github.io/selection-api/#dom-selection-deletefromdocument - deleteFromDocument() { - if (!this._isEmpty()) { - this._range.deleteContents(); - } - } - - // https://w3c.github.io/selection-api/#dom-selection-containsnode - containsNode(node, allowPartialContainment) { - if (this._isEmpty() || nodeRoot(node) !== implForWrapper(this._globalObject._document)) { - return false; - } - - const { _start, _end } = this._range; - - const startIsBeforeNode = compareBoundaryPointsPosition(_start, { node, offset: 0 }) === -1; - const endIsAfterNode = compareBoundaryPointsPosition(_end, { node, offset: nodeLength(node) }) === 1; - - return allowPartialContainment ? - startIsBeforeNode || endIsAfterNode : - startIsBeforeNode && endIsAfterNode; - } - - // https://w3c.github.io/selection-api/#dom-selection-stringifier - toString() { - return this._range ? this._range.toString() : ""; - } - - // https://w3c.github.io/selection-api/#dfn-empty - _isEmpty() { - return this._range === null; - } - - // https://w3c.github.io/selection-api/#dfn-anchor - get _anchor() { - if (!this._range) { - return null; - } - - return this._direction === SELECTION_DIRECTION.FORWARDS ? - this._range._start : - this._range._end; - } - - // https://w3c.github.io/selection-api/#dfn-focus - get _focus() { - if (!this._range) { - return null; - } - - return this._direction === SELECTION_DIRECTION.FORWARDS ? - this._range._end : - this._range._start; - } - - _associateRange(newRange) { - const didSelectionChange = this._range !== newRange && - ( - // Change from/to null selection - newRange === null || - this._range === null || - // Change of selection range - compareBoundaryPointsPosition(newRange._start, this._range._start) !== 0 || - compareBoundaryPointsPosition(newRange._end, this._range._end) !== 0 - ); - this._range = newRange; - this._direction = newRange === null ? SELECTION_DIRECTION.DIRECTIONLESS : SELECTION_DIRECTION.FORWARDS; - - // https://w3c.github.io/selection-api/#selectionchange-event - if (didSelectionChange) { - // Fire the event asynchronously, as it's done in the browser - const document = this._globalObject._document; - setTimeout(() => { - fireAnEvent("selectionchange", implForWrapper(document)); - }, 0); - } - } -} - -module.exports = { - implementation: SelectionImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedPreserveAspectRatio-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedPreserveAspectRatio-impl.js deleted file mode 100644 index 8e212e3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedPreserveAspectRatio-impl.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -const SVGPreserveAspectRatio = require("../generated/SVGPreserveAspectRatio"); - -class SVGAnimatedPreserveAspectRatioImpl { - constructor(globalObject, args, privateData) { - this._globalObject = globalObject; - this._element = privateData.element; - } - - get baseVal() { - return SVGPreserveAspectRatio.createImpl(this._globalObject, [], { - element: this._element - }); - } - - get animVal() { - return SVGPreserveAspectRatio.createImpl(this._globalObject, [], { - element: this._element - }); - } -} - -exports.implementation = SVGAnimatedPreserveAspectRatioImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedRect-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedRect-impl.js deleted file mode 100644 index 2730fe3..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedRect-impl.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; - -const SVGRect = require("../generated/SVGRect"); - -// https://drafts.csswg.org/css-syntax/#number-token-diagram -const numberRe = /^[+-]?(?:\d*\.)?\d+(?:[eE][+-]?\d+)?/; - -// https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute -function parseViewBox(str) { - // Use a do-while "loop" as JavaScript `goto end`. - // eslint-disable-next-line no-unreachable-loop - do { - // When the attribute does not exist. - if (typeof str !== "string") { - break; - } - - let i = 0; - skipSpace(); - const xStr = matchNumber(); - if (!xStr) { - break; - } - if (!skipDelimiter()) { - break; - } - const yStr = matchNumber(); - if (!yStr) { - break; - } - if (!skipDelimiter()) { - break; - } - const widthStr = matchNumber(); - if (!widthStr) { - break; - } - if (!skipDelimiter()) { - break; - } - const heightStr = matchNumber(); - if (!heightStr) { - break; - } - // Test for trailing junk. - skipSpace(); - if (i < str.length) { - break; - } - - // A negative value for <width> or <height> is an error and invalidates the 'viewBox' attribute. - const width = Number(widthStr); - if (width < 0) { - break; - } - const height = Number(heightStr); - if (height < 0) { - break; - } - - return { - x: Number(xStr), - y: Number(yStr), - width, - height - }; - - function skipSpace() { - while (i < str.length && str[i] === " ") { - i += 1; - } - } - - function matchNumber() { - const numMatch = numberRe.exec(str.slice(i)); - if (!numMatch) { - return undefined; - } - i += numMatch[0].length; - return numMatch[0]; - } - - function skipDelimiter() { - const start = i; - skipSpace(); - if (i < str.length && str[i] === ",") { - i += 1; - } - skipSpace(); - return i > start; - } - } while (false); - - return { x: 0, y: 0, width: 0, height: 0 }; -} - -class SVGAnimatedRectImpl { - constructor(globalObject, args, privateData) { - this._globalObject = globalObject; - this._element = privateData.element; - this._attribute = privateData.attribute; - } - - get baseVal() { - return SVGRect.createImpl(this._globalObject, [], { - reflectedElement: this._element, - reflectedAttribute: this._attribute, - parser: parseViewBox - }); - } - - get animVal() { - return SVGRect.createImpl(this._globalObject, [], { - reflectedElement: this._element, - reflectedAttribute: this._attribute, - parser: parseViewBox, - readOnly: true - }); - } -} - -exports.implementation = SVGAnimatedRectImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedString-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedString-impl.js deleted file mode 100644 index 1b6bf21..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedString-impl.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -class SVGAnimatedStringImpl { - constructor(globalObject, args, privateData) { - this._element = privateData.element; - this._attribute = privateData.attribute; - - // These three can be undefined. - this._attributeDeprecated = privateData.attributeDeprecated; - this._attributeDeprecatedNamespace = privateData.attributeDeprecatedNamespace; - this._initialValue = privateData.initialValue; - } - - get baseVal() { - if (!this._element.hasAttributeNS(null, this._attribute)) { - if (this._attributeDeprecated !== undefined && - this._element.hasAttributeNS(this._attributeDeprecatedNamespace, this._attributeDeprecated)) { - return this._element.getAttributeNS(this._attributeDeprecatedNamespace, this._attributeDeprecated); - } else if (this._initialValue !== undefined) { - return this._initialValue; - } - return ""; - } - return this._element.getAttributeNS(null, this._attribute); - } - - set baseVal(base) { - if (!this._element.hasAttributeNS(null, this._attribute) && - this._attributeDeprecated !== undefined && - this._element.hasAttributeNS(null, this._attributeDeprecated)) { - this._element.setAttributeNS(null, this._attributeDeprecated, base); - } else { - this._element.setAttributeNS(null, this._attribute, base); - } - } - - get animVal() { - return this.baseVal; - } -} - -exports.implementation = SVGAnimatedStringImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGListBase.js b/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGListBase.js deleted file mode 100644 index c48791d..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGListBase.js +++ /dev/null @@ -1,195 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); -const idlUtils = require("../generated/utils"); -const { attach, detach } = require("../helpers/svg/basic-types"); - -// https://svgwg.org/svg2-draft/types.html#ListInterfaces - -// Child classes must implement _reserialize() -class List { - _initList({ - element, - attribute, - readOnly = false - }) { - this._element = element; - this._attribute = attribute; - this._attributeRegistryEntry = element.constructor.attributeRegistry.get(attribute); - this._readOnly = readOnly; - this._list = []; - this._version = -1; - } - - get _needsResync() { - return this._version < this._element._version; - } - - _synchronize() { - if (!this._needsResync) { - return; - } - let value = []; - if (this._element.hasAttributeNS(null, this._attribute)) { - value = this._attributeRegistryEntry.getValue(this._element.getAttributeNS(null, this._attribute)); - } - if (value.length === 0 && this._attributeRegistryEntry.initialValue !== undefined) { - value = this._attributeRegistryEntry.getValue(this._attributeRegistryEntry.initialValue); - } - // TODO: support non-DOMString lists. - this._list = value; - this._version = this._element._version; - } - - _reserialize() { - const elements = this._list; - this._element.setAttributeNS(null, this._attribute, this._attributeRegistryEntry.serialize(elements)); - // Prevent ping-ponging back and forth between _reserialize() and _synchronize(). - this._version = this._element._version; - } - - [idlUtils.supportsPropertyIndex](index) { - this._synchronize(); - return index >= 0 && index < this.length; - } - - get [idlUtils.supportedPropertyIndices]() { - this._synchronize(); - return this._list.keys(); - } - - get length() { - this._synchronize(); - return this._list.length; - } - - get numberOfItems() { - this._synchronize(); - return this._list.length; - } - - clear() { - this._synchronize(); - if (this._readOnly) { - throw DOMException.create(this._globalObject, [ - "Attempting to modify a read-only list", - "NoModificationAllowedError" - ]); - } - for (const item of this._list) { - detach(item); - } - this._list.length = 0; - this._reserialize(); - } - - initialize(newItem) { - this._synchronize(); - if (this._readOnly) { - throw DOMException.create(this._globalObject, [ - "Attempting to modify a read-only list", - "NoModificationAllowedError" - ]); - } - for (const item of this._list) { - detach(item); - } - this._list.length = 0; - // TODO: clone non-DOMString list elements. - attach(newItem, this); - this._list.push(newItem); - this._reserialize(); - } - - getItem(index) { - this._synchronize(); - if (index >= this._list.length) { - throw DOMException.create(this._globalObject, [ - `The index provided (${index}) is greater than or equal to the maximum bound (${this._list.length}).`, - "IndexSizeError" - ]); - } - return this._list[index]; - } - - insertItemBefore(newItem, index) { - this._synchronize(); - if (this._readOnly) { - throw DOMException.create(this._globalObject, [ - "Attempting to modify a read-only list", - "NoModificationAllowedError" - ]); - } - // TODO: clone non-DOMString list elements. - if (index > this._list.length) { - index = this._list.length; - } - this._list.splice(index, 0, newItem); - attach(newItem, this); - this._reserialize(); - return newItem; - } - - replaceItem(newItem, index) { - this._synchronize(); - if (this._readOnly) { - throw DOMException.create(this._globalObject, [ - "Attempting to modify a read-only list", - "NoModificationAllowedError" - ]); - } - if (index >= this._list.length) { - throw DOMException.create(this._globalObject, [ - `The index provided (${index}) is greater than or equal to the maximum bound (${this._list.length}).`, - "IndexSizeError" - ]); - } - // TODO: clone non-DOMString list elements. - detach(this._list[index]); - this._list[index] = newItem; - attach(newItem, this); - this._reserialize(); - return newItem; - } - - removeItem(index) { - this._synchronize(); - if (this._readOnly) { - throw DOMException.create(this._globalObject, [ - "Attempting to modify a read-only list", - "NoModificationAllowedError" - ]); - } - if (index >= this._list.length) { - throw DOMException.create(this._globalObject, [ - `The index provided (${index}) is greater than or equal to the maximum bound (${this._list.length}).`, - "IndexSizeError" - ]); - } - const item = this._list[index]; - detach(item); - this._list.splice(index, 1); - this._reserialize(); - return item; - } - - appendItem(newItem) { - this._synchronize(); - // TODO: clone non-DOMString list elements. - this._list.push(newItem); - attach(newItem, this); - this._reserialize(); - return newItem; - } - - [idlUtils.indexedSetNew](index, value) { - // Note: this will always throw a IndexSizeError. - this.replaceItem(value, index); - } - - [idlUtils.indexedSetExisting](index, value) { - this.replaceItem(value, index); - } -} - -module.exports = List; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGNumber-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGNumber-impl.js deleted file mode 100644 index 64bb7d2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGNumber-impl.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); - -class SVGNumberImpl { - constructor(globalObject, args, privateData) { - // Delegate to parent List object for (almost) everything related to reflection. - this._parentList = privateData.parentList; - this._value = 0; - } - - get _readOnly() { - if (this._parentList !== undefined) { - return this._parentList._readOnly; - } - return false; - } - - _synchronize() { - if (this._parentList !== undefined) { - this._parentList._synchronize(); - } - } - - _reserialize() { - if (this._parentList !== undefined) { - this._parentList._reserialize(); - } - } - - get value() { - this._synchronize(); - return this._value; - } - - set value(value) { - if (this._readOnly) { - throw DOMException.create(this._globalObject, [ - "Attempting to modify a read-only SVGNumber", - "NoModificationAllowedError" - ]); - } - this._value = value; - this._reserialize(); - } -} - -exports.implementation = SVGNumberImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGPreserveAspectRatio-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGPreserveAspectRatio-impl.js deleted file mode 100644 index 16556c2..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGPreserveAspectRatio-impl.js +++ /dev/null @@ -1,100 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); - -const alignmentStringsByIndex = [ - "unknown", "none", - "xMinYMin", "xMidYMin", "xMaxYMin", - "xMinYMid", "xMidYMid", "xMaxYMid", - "xMinYMax", "xMidYMax", "xMaxYMax" -]; -const alignmentIndicesByString = { - __proto__: null, - unknown: 0, - none: 1, - xMinYMin: 2, - xMidYMin: 3, - xMaxYMin: 4, - xMinYMid: 5, - xMidYMid: 6, - xMaxYMid: 7, - xMinYMax: 8, - xMidYMax: 9, - xMaxYMax: 10 -}; - -const meetOrSliceStringsByIndex = ["unknown", "meet", "slice"]; -const meetOrSliceIndicesByString = { - __proto__: null, - unknown: 0, - meet: 1, - slice: 2 -}; - -// https://svgwg.org/svg2-draft/coords.html#PreserveAspectRatioAttribute -const preserveAspectRatioRegExp = /^(none|x(?:Min|Mid|Max)Y(?:Min|Mid|Max))(?: +(meet|slice))?$/; - -class SVGPreserveAspectRatioImpl { - constructor(globalObject, args, privateData) { - this._globalObject = globalObject; - this._element = privateData.element; - this._readOnly = Boolean(privateData.readOnly); - } - - _parse() { - const attrValue = this._element.getAttributeNS(null, "preserveAspectRatio"); - if (attrValue) { - const value = preserveAspectRatioRegExp.exec(attrValue); - if (value) { - return { - align: value[1], - meetOrSlice: value[2] || "meet" - }; - } - } - return { - align: "xMidYMid", - meetOrSlice: "meet" - }; - } - - get align() { - const { align } = this._parse(); - return alignmentIndicesByString[align]; - } - - set align(value) { - if (this._readOnly) { - throw DOMException.create(this._globalObject, [ - "Attempting to modify a read-only SVGPreserveAspectRatio", - "NoModificationAllowedError" - ]); - } - const string = alignmentStringsByIndex[value]; - if (string === "unknown" || string === undefined) { - throw new TypeError("Invalid alignment"); - } - this._element.setAttributeNS(null, "preserveAspectRatio", `${string} ${this._parse().meetOrSlice}`); - } - - get meetOrSlice() { - const { meetOrSlice } = this._parse(); - return meetOrSliceIndicesByString[meetOrSlice]; - } - - set meetOrSlice(value) { - if (this._readOnly) { - throw DOMException.create(this._globalObject, [ - "Attempting to modify a read-only SVGPreserveAspectRatio", - "NoModificationAllowedError" - ]); - } - const string = meetOrSliceStringsByIndex[value]; - if (string === "unknown" || string === undefined) { - throw new TypeError("Invalid meet-or-slice value"); - } - this._element.setAttributeNS(null, "preserveAspectRatio", `${this._parse().align} ${string}`); - } -} - -exports.implementation = SVGPreserveAspectRatioImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGRect-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGRect-impl.js deleted file mode 100644 index 2dd2e92..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGRect-impl.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; -const DOMException = require("../generated/DOMException"); - -class SVGRectImplRecord { - constructor() { - this.x = 0; - this.y = 0; - this.width = 0; - this.height = 0; - } -} - -class SVGRectImplReflection { - constructor(privateData) { - this._reflectedElement = privateData.reflectedElement; - this._reflectedAttribute = privateData.reflectedAttribute; - this._parser = privateData.parser; - } - - // https://svgwg.org/svg2-draft/types.html#TermReserialize - _reserialize({ x, y, width, height }) { - this._reflectedElement.setAttributeNS(null, this._reflectedAttribute, `${x} ${y} ${width} ${height}`); - } - - get x() { - const attr = this._reflectedElement.getAttributeNS(null, this._reflectedAttribute); - return this._parser(attr).x; - } - - set x(newX) { - const { y, width, height } = this; - this._reserialize({ - x: newX, - y, - width, - height - }); - } - - get y() { - const attr = this._reflectedElement.getAttributeNS(null, this._reflectedAttribute); - return this._parser(attr).y; - } - - set y(newY) { - const { x, width, height } = this; - this._reserialize({ - x, - y: newY, - width, - height - }); - } - - get width() { - const attr = this._reflectedElement.getAttributeNS(null, this._reflectedAttribute); - return this._parser(attr).width; - } - - set width(newWidth) { - const { x, y, height } = this; - this._reserialize({ - x, - y, - width: newWidth, - height - }); - } - - get height() { - const attr = this._reflectedElement.getAttributeNS(null, this._reflectedAttribute); - return this._parser(attr).height; - } - - set height(newHeight) { - const { x, y, width } = this; - this._reserialize({ - x, - y, - width, - height: newHeight - }); - } -} - -class SVGRectImpl { - constructor(globalObject, args, { readOnly = false, ...privateData } = {}) { - this._globalObject = globalObject; - - this._readOnly = readOnly; - if (privateData.reflectedElement) { - this._impl = new SVGRectImplReflection(privateData); - } else { - this._impl = new SVGRectImplRecord(); - } - } - - get x() { - return this._impl.x; - } - - set x(newX) { - if (this._readOnly) { - throw DOMException.create(this._globalObject, ["This SVGRect is read-only", "NO_MODIFICATION_ALLOWED_ERR"]); - } - this._impl.x = newX; - } - - get y() { - return this._impl.y; - } - - set y(newY) { - if (this._readOnly) { - throw DOMException.create(this._globalObject, ["This SVGRect is read-only", "NO_MODIFICATION_ALLOWED_ERR"]); - } - this._impl.y = newY; - } - - get width() { - return this._impl.width; - } - - set width(newWidth) { - if (this._readOnly) { - throw DOMException.create(this._globalObject, ["This SVGRect is read-only", "NO_MODIFICATION_ALLOWED_ERR"]); - } - this._impl.width = newWidth; - } - - get height() { - return this._impl.height; - } - - set height(newHeight) { - if (this._readOnly) { - throw DOMException.create(this._globalObject, ["This SVGRect is read-only", "NO_MODIFICATION_ALLOWED_ERR"]); - } - this._impl.height = newHeight; - } -} - -exports.implementation = SVGRectImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGStringList-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGStringList-impl.js deleted file mode 100644 index a745ea7..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/svg/SVGStringList-impl.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -const { mixin } = require("../../utils"); -const SVGListBase = require("./SVGListBase"); - -class SVGStringListImpl { - constructor(globalObject, args, privateData) { - this._globalObject = globalObject; - - this._initList(privateData); - } -} - -mixin(SVGStringListImpl.prototype, SVGListBase.prototype); - -exports.implementation = SVGStringListImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/traversal/NodeIterator-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/traversal/NodeIterator-impl.js deleted file mode 100644 index 6a29f99..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/traversal/NodeIterator-impl.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; -const { domSymbolTree } = require("../helpers/internal-constants"); -const { filter, FILTER_ACCEPT } = require("./helpers"); - -exports.implementation = class NodeIteratorImpl { - constructor(globalObject, args, privateData) { - this._active = false; - this.root = privateData.root; - this.whatToShow = privateData.whatToShow; - this.filter = privateData.filter; - - this._referenceNode = this.root; - this._pointerBeforeReferenceNode = true; - - this._globalObject = globalObject; - } - - get referenceNode() { - return this._referenceNode; - } - - get pointerBeforeReferenceNode() { - return this._pointerBeforeReferenceNode; - } - - nextNode() { - return this._traverse("next"); - } - - previousNode() { - return this._traverse("previous"); - } - - detach() { - // Intentionally do nothing, per spec. - } - - // Called by Documents. - _preRemovingSteps(toBeRemovedNode) { - // Second clause is https://github.com/whatwg/dom/issues/496 - if (!toBeRemovedNode.contains(this._referenceNode) || toBeRemovedNode === this.root) { - return; - } - - if (this._pointerBeforeReferenceNode) { - let next = null; - let candidateForNext = domSymbolTree.following(toBeRemovedNode, { skipChildren: true }); - while (candidateForNext !== null) { - if (this.root.contains(candidateForNext)) { - next = candidateForNext; - break; - } - candidateForNext = domSymbolTree.following(candidateForNext, { skipChildren: true }); - } - - if (next !== null) { - this._referenceNode = next; - return; - } - - this._pointerBeforeReferenceNode = false; - } - - const { previousSibling } = toBeRemovedNode; - this._referenceNode = previousSibling === null ? - toBeRemovedNode.parentNode : - domSymbolTree.lastInclusiveDescendant(toBeRemovedNode.previousSibling); - } - - _traverse(direction) { - let node = this._referenceNode; - let beforeNode = this._pointerBeforeReferenceNode; - - while (true) { - if (direction === "next") { - if (!beforeNode) { - node = domSymbolTree.following(node, { root: this.root }); - - if (!node) { - return null; - } - } - - beforeNode = false; - } else if (direction === "previous") { - if (beforeNode) { - node = domSymbolTree.preceding(node, { root: this.root }); - - if (!node) { - return null; - } - } - - beforeNode = true; - } - - const result = filter(this, node); - if (result === FILTER_ACCEPT) { - break; - } - } - - this._referenceNode = node; - this._pointerBeforeReferenceNode = beforeNode; - return node; - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/traversal/TreeWalker-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/traversal/TreeWalker-impl.js deleted file mode 100644 index cebe5de..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/traversal/TreeWalker-impl.js +++ /dev/null @@ -1,217 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); -const { filter, FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP } = require("./helpers"); - -const FIRST = false; -const LAST = true; -const NEXT = false; -const PREVIOUS = true; - -exports.implementation = class TreeWalkerImpl { - constructor(globalObject, args, privateData) { - this._active = false; - this.root = privateData.root; - this.currentNode = this.root; - this.whatToShow = privateData.whatToShow; - this.filter = privateData.filter; - - this._globalObject = globalObject; - } - - get currentNode() { - return this._currentNode; - } - - set currentNode(node) { - if (node === null) { - throw DOMException.create(this._globalObject, ["Cannot set currentNode to null", "NotSupportedError"]); - } - - this._currentNode = node; - } - - parentNode() { - let node = this._currentNode; - while (node !== null && node !== this.root) { - node = node.parentNode; - - if (node !== null && filter(this, node) === FILTER_ACCEPT) { - return (this._currentNode = node); - } - } - return null; - } - - firstChild() { - return this._traverseChildren(FIRST); - } - - lastChild() { - return this._traverseChildren(LAST); - } - - previousSibling() { - return this._traverseSiblings(PREVIOUS); - } - - nextSibling() { - return this._traverseSiblings(NEXT); - } - - previousNode() { - let node = this._currentNode; - - while (node !== this.root) { - let sibling = node.previousSibling; - - while (sibling !== null) { - node = sibling; - let result = filter(this, node); - - while (result !== FILTER_REJECT && node.hasChildNodes()) { - node = node.lastChild; - result = filter(this, node); - } - - if (result === FILTER_ACCEPT) { - return (this._currentNode = node); - } - - sibling = node.previousSibling; - } - - if (node === this.root || node.parentNode === null) { - return null; - } - - node = node.parentNode; - - if (filter(this, node) === FILTER_ACCEPT) { - return (this._currentNode = node); - } - } - - return null; - } - - nextNode() { - let node = this._currentNode; - let result = FILTER_ACCEPT; - - for (;;) { - while (result !== FILTER_REJECT && node.hasChildNodes()) { - node = node.firstChild; - result = filter(this, node); - if (result === FILTER_ACCEPT) { - return (this._currentNode = node); - } - } - - do { - if (node === this.root) { - return null; - } - - const sibling = node.nextSibling; - - if (sibling !== null) { - node = sibling; - break; - } - - node = node.parentNode; - } while (node !== null); - - if (node === null) { - return null; - } - - result = filter(this, node); - - if (result === FILTER_ACCEPT) { - return (this._currentNode = node); - } - } - } - - _traverseChildren(type) { - let node = this._currentNode; - node = type === FIRST ? node.firstChild : node.lastChild; - - if (node === null) { - return null; - } - - main: for (;;) { - const result = filter(this, node); - - if (result === FILTER_ACCEPT) { - return (this._currentNode = node); - } - - if (result === FILTER_SKIP) { - const child = type === FIRST ? node.firstChild : node.lastChild; - - if (child !== null) { - node = child; - continue; - } - } - - for (;;) { - const sibling = type === FIRST ? node.nextSibling : node.previousSibling; - - if (sibling !== null) { - node = sibling; - continue main; - } - - const parent = node.parentNode; - - if (parent === null || parent === this.root || parent === this._currentNode) { - return null; - } - - node = parent; - } - } - } - - _traverseSiblings(type) { - let node = this._currentNode; - - if (node === this.root) { - return null; - } - - for (;;) { - let sibling = type === NEXT ? node.nextSibling : node.previousSibling; - - while (sibling !== null) { - node = sibling; - const result = filter(this, node); - - if (result === FILTER_ACCEPT) { - return (this._currentNode = node); - } - - sibling = type === NEXT ? node.firstChild : node.lastChild; - - if (result === FILTER_REJECT || sibling === null) { - sibling = type === NEXT ? node.nextSibling : node.previousSibling; - } - } - - node = node.parentNode; - - if (node === null || node === this.root) { - return null; - } - - if (filter(this, node) === FILTER_ACCEPT) { - return null; - } - } - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/traversal/helpers.js b/vanilla/node_modules/jsdom/lib/jsdom/living/traversal/helpers.js deleted file mode 100644 index 5a3ca09..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/traversal/helpers.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -const DOMException = require("../generated/DOMException"); -const conversions = require("webidl-conversions"); - -exports.FILTER_ACCEPT = 1; // NodeFilter.FILTER_ACCEPT -exports.FILTER_REJECT = 2; // NodeFilter.FILTER_REJECT -exports.FILTER_SKIP = 3; // NodeFilter.FILTER_SKIP - -exports.filter = (nodeIteratorOrTreeWalkerImpl, nodeImpl) => { - if (nodeIteratorOrTreeWalkerImpl._active) { - throw DOMException.create(nodeIteratorOrTreeWalkerImpl._globalObject, [ - "Recursive node filtering", - "InvalidStateError" - ]); - } - - const n = nodeImpl.nodeType - 1; - - if (!((1 << n) & nodeIteratorOrTreeWalkerImpl.whatToShow)) { - return exports.FILTER_SKIP; - } - - // Saving in a variable is important so we don't accidentally call it as a method later. - const { filter } = nodeIteratorOrTreeWalkerImpl; - - if (filter === null) { - return exports.FILTER_ACCEPT; - } - - nodeIteratorOrTreeWalkerImpl._active = true; - - let result; - - // https://github.com/whatwg/dom/issues/494 - try { - result = filter(nodeImpl); - } finally { - nodeIteratorOrTreeWalkerImpl._active = false; - } - - result = conversions["unsigned short"](result); - - return result; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/webidl/DOMException-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/webidl/DOMException-impl.js deleted file mode 100644 index b3a80aa..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/webidl/DOMException-impl.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -const idlUtils = require("../generated/utils"); - -const legacyErrorCodes = { - IndexSizeError: 1, - HierarchyRequestError: 3, - WrongDocumentError: 4, - InvalidCharacterError: 5, - NoModificationAllowedError: 7, - NotFoundError: 8, - NotSupportedError: 9, - InUseAttributeError: 10, - InvalidStateError: 11, - SyntaxError: 12, - InvalidModificationError: 13, - NamespaceError: 14, - InvalidAccessError: 15, - TypeMismatchError: 17, - SecurityError: 18, - NetworkError: 19, - AbortError: 20, - URLMismatchError: 21, - QuotaExceededError: 22, - TimeoutError: 23, - InvalidNodeTypeError: 24, - DataCloneError: 25 -}; - -exports.implementation = class DOMExceptionImpl { - constructor(globalObject, [message, name]) { - this.name = name; - this.message = message; - } - - get code() { - return legacyErrorCodes[this.name] || 0; - } -}; - -// A proprietary V8 extension that causes the stack property to appear. -exports.init = impl => { - if (Error.captureStackTrace) { - const wrapper = idlUtils.wrapperForImpl(impl); - Error.captureStackTrace(wrapper, wrapper.constructor); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/websockets/WebSocket-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/websockets/WebSocket-impl.js deleted file mode 100644 index 41c58c9..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/websockets/WebSocket-impl.js +++ /dev/null @@ -1,211 +0,0 @@ -"use strict"; -const { WebSocket } = require("undici"); -const { parseURL, serializeURL, serializeURLOrigin } = require("whatwg-url"); -const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor"); -const { fireAnEvent } = require("../helpers/events"); -const { copyToArrayBufferInTargetRealmDestructively } = require("../helpers/binary-data"); -const IterableWeakSet = require("../helpers/iterable-weak-set"); -const EventTargetImpl = require("../events/EventTarget-impl").implementation; -const Blob = require("../generated/Blob"); -const CloseEvent = require("../generated/CloseEvent"); -const DOMException = require("../generated/DOMException"); -const MessageEvent = require("../generated/MessageEvent"); - -const openSockets = new WeakMap(); - -class WebSocketImpl extends EventTargetImpl { - constructor(globalObject, [url, protocols]) { - super(globalObject); - - // Do our own URL parsing because we want to be consistent with the rest of jsdom and use whatwg-url, not Node.js's - // URL. - const urlRecord = parseURL(url); - if (urlRecord === null) { - throw DOMException.create(this._globalObject, [`The URL '${url}' is invalid.`, "SyntaxError"]); - } - if (urlRecord.scheme !== "ws" && urlRecord.scheme !== "wss") { - throw DOMException.create(this._globalObject, [ - `The URL's scheme must be either 'ws' or 'wss'. '${urlRecord.scheme}' is not allowed.`, - "SyntaxError" - ]); - } - if (urlRecord.fragment !== null) { - throw DOMException.create(this._globalObject, [ - `The URL contains a fragment identifier ('${urlRecord.fragment}'). Fragment identifiers ` + - "are not allowed in WebSocket URLs.", - "SyntaxError" - ]); - } - - this._urlRecord = urlRecord; - this._urlSerialized = serializeURL(urlRecord); - this._binaryType = "blob"; - - const wsOptions = { - dispatcher: globalObject._dispatcher, - protocols, - headers: { - // Origin is required for WebSocket and uses the window's origin - origin: globalObject._origin - } - }; - - this._ws = wrapAndRethrowNodeDOMExceptions(() => { - return new WebSocket(serializeURL(urlRecord), wsOptions); - }, this._globalObject); - - // Always use "arraybuffer" for `this._ws`'s `binaryType`. It will be converted to the correct type by `_onMessage`, - // and jsdom's `Blob`s are just wrappers around `ArrayBuffer`s anyway. - this._ws.binaryType = "arraybuffer"; - - // Track open sockets for cleanup - let openSocketsForWindow = openSockets.get(globalObject._globalProxy); - if (openSocketsForWindow === undefined) { - openSocketsForWindow = new IterableWeakSet(); - openSockets.set(globalObject._globalProxy, openSocketsForWindow); - } - openSocketsForWindow.add(this); - - // Set up event forwarding. We use `setTimeout()` to work around https://github.com/nodejs/undici/issues/4741 where - // undici fires events synchronously during `close()`, but the spec requires them to fire asynchronously. - this._ws.addEventListener("open", () => { - setTimeout(() => fireAnEvent("open", this), 0); - }); - - this._ws.addEventListener("message", event => { - // Capture readyState now, before setTimeout, because undici may transition to CLOSED before our setTimeout fires, - // but the spec says readyState must be OPEN during message events. - const readyStateWhenReceived = this._ws.readyState; - setTimeout(() => { - const prevReadyState = this._readyState; - this._readyState = readyStateWhenReceived; - this._onMessage(event); - this._readyState = prevReadyState; - }, 0); - }); - - this._ws.addEventListener("error", () => { - setTimeout(() => fireAnEvent("error", this), 0); - }); - - this._ws.addEventListener("close", event => { - setTimeout(() => { - // Set readyState to CLOSED when firing the close event. We manage this ourselves because undici has bugs with - // readyState during close: https://github.com/nodejs/undici/issues/4742. - this._readyState = this._ws.CLOSED; - openSocketsForWindow.delete(this); - fireAnEvent("close", this, CloseEvent, { - wasClean: event.wasClean, - code: event.code, - reason: event.reason - }); - }, 0); - }); - } - - _onMessage({ data }) { - let dataForEvent; - if (typeof data === "string") { - dataForEvent = data; - } else if (this._binaryType === "arraybuffer") { - dataForEvent = copyToArrayBufferInTargetRealmDestructively(data, this._globalObject); - } else { - // `this._binaryType === "blob"` - dataForEvent = Blob.create(this._globalObject, [undefined, { type: "" }], { - fastPathArrayBufferToWrap: data - }); - } - - fireAnEvent("message", this, MessageEvent, { - data: dataForEvent, - origin: serializeURLOrigin(this._urlRecord) - }); - } - - get url() { - return this._urlSerialized; - } - - get readyState() { - // Use captured readyState if available (workaround for undici bug #4742) - return this._readyState ?? this._ws.readyState; - } - - get bufferedAmount() { - return this._ws.bufferedAmount; - } - - get extensions() { - return this._ws.extensions; - } - - get protocol() { - return this._ws.protocol; - } - - get binaryType() { - return this._binaryType; - } - - set binaryType(value) { - this._binaryType = value; - } - - close(code, reason) { - return wrapAndRethrowNodeDOMExceptions(() => { - // Set readyState to CLOSING before calling undici's close(). We manage this ourselves because - // undici has bugs with readyState during close - see https://github.com/nodejs/undici/issues/4742 - // Only set to CLOSING if not already CLOSED (calling close() on a closed socket is a no-op). - if (this._readyState !== this._ws.CLOSED) { - this._readyState = this._ws.CLOSING; - } - return this._ws.close(code, reason); - }, this._globalObject); - } - - send(data) { - return wrapAndRethrowNodeDOMExceptions(() => { - // Convert jsdom Blob to ArrayBuffer. Other types are passed through as-is. - if (Blob.isImpl(data)) { - data = data._bytes.buffer; - } - - return this._ws.send(data); - }, this._globalObject); - } - - // https://websockets.spec.whatwg.org/#make-disappear - // But with additional work from jsdom to remove all event listeners. - _makeDisappear() { - this._eventListeners = Object.create(null); - if (this._ws.readyState === this._ws.OPEN || this._ws.readyState === this._ws.CONNECTING) { - // Close without a code - undici doesn't allow reserved codes like 1001 - this._ws.close(); - } - } - - static cleanUpWindow(window) { - const openSocketsForWindow = openSockets.get(window._globalProxy); - if (openSocketsForWindow !== undefined) { - for (const ws of openSocketsForWindow) { - ws._makeDisappear(); - } - openSockets.delete(window._globalProxy); - } - } -} - -function wrapAndRethrowNodeDOMExceptions(func, globalObject) { - try { - return func(); - } catch (e) { - if (e instanceof globalThis.DOMException) { - throw DOMException.create(globalObject, [e.message, e.name]); - } - throw e; - } -} - -setupForSimpleEventAccessors(WebSocketImpl.prototype, ["open", "message", "error", "close"]); - -exports.implementation = WebSocketImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/webstorage/Storage-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/webstorage/Storage-impl.js deleted file mode 100644 index 44b2586..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/webstorage/Storage-impl.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; - -const DOMException = require("../generated/DOMException"); -const StorageEvent = require("../generated/StorageEvent"); -const idlUtils = require("../generated/utils"); -const { fireAnEvent } = require("../helpers/events"); - -// https://html.spec.whatwg.org/multipage/webstorage.html#the-storage-interface -class StorageImpl { - constructor(globalObject, args, privateData) { - const { associatedWindow, storageArea, url, type, storageQuota } = privateData; - - this._associatedWindow = associatedWindow; - this._items = storageArea; - this._url = url; - this._type = type; - this._quota = storageQuota; - - this._globalObject = globalObject; - } - - _dispatchStorageEvent(key, oldValue, newValue) { - return this._associatedWindow._currentOriginData.windowsInSameOrigin - .filter(target => target !== this._associatedWindow) - .forEach(target => fireAnEvent("storage", target, StorageEvent, { - key, - oldValue, - newValue, - url: this._url, - storageArea: target["_" + this._type] - })); - } - - get length() { - return this._items.size; - } - - key(n) { - if (n >= this._items.size) { - return null; - } - return [...this._items.keys()][n]; - } - - getItem(key) { - if (this._items.has(key)) { - return this._items.get(key); - } - return null; - } - - setItem(key, value) { - const oldValue = this._items.get(key) || null; - - if (oldValue === value) { - return; - } - - // Concatenate all keys and values to measure their length against the quota - let itemsTotalLength = key.length + value.length; - for (const [curKey, curValue] of this._items) { - // If the key already exists, skip it as it will be set to the new value instead - if (key !== curKey) { - itemsTotalLength += curKey.length + curValue.length; - } - } - if (itemsTotalLength > this._quota) { - throw DOMException.create(this._globalObject, [ - `The ${this._quota}-code unit storage quota has been exceeded.`, - "QuotaExceededError" - ]); - } - - setTimeout(this._dispatchStorageEvent.bind(this), 0, key, oldValue, value); - - this._items.set(key, value); - } - - removeItem(key) { - if (this._items.has(key)) { - setTimeout(this._dispatchStorageEvent.bind(this), 0, key, this._items.get(key), null); - - this._items.delete(key); - } - } - - clear() { - if (this._items.size > 0) { - setTimeout(this._dispatchStorageEvent.bind(this), 0, null, null, null); - - this._items.clear(); - } - } - - get [idlUtils.supportedPropertyNames]() { - return this._items.keys(); - } -} - -module.exports = { - implementation: StorageImpl -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/window-properties.js b/vanilla/node_modules/jsdom/lib/jsdom/living/window-properties.js deleted file mode 100644 index 598b133..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/window-properties.js +++ /dev/null @@ -1,241 +0,0 @@ -"use strict"; -const idlUtils = require("./generated/utils.js"); -const HTMLCollection = require("./generated/HTMLCollection.js"); -const { HTML_NS } = require("./helpers/namespaces.js"); -const { nodeRoot } = require("./helpers/node.js"); -const { treeOrderSorter } = require("../utils.js"); - -// We count iframe/frame here too even though it's not in the relevant part of the spec because we still need to track -// named iframes/frames, and we'll process the element -> WindowProxy work as special cases. -const nameAttributeElementLocalNames = new Set(["embed", "form", "img", "object", "iframe", "frame"]); - -const trackers = new WeakMap(); // WeakMap<WindowProperties, Map<string, Set<Element>>> - -function upsert(map, key, value) { - let set = map.get(key); - if (!set) { - set = new Set(); - map.set(key, set); - } - set.add(value); -} - -function remove(map, key, value) { - const set = map.get(key); - if (set) { - set.delete(value); - if (set.size === 0) { - map.delete(key); - } - } -} - -function getNamedObject(window, name) { - const tracker = trackers.get(window); - const set = tracker.get(name); - if (set === undefined) { - return undefined; - } - - const sorted = [...set].sort(treeOrderSorter); - for (const element of sorted) { - if (element.localName === "iframe" || element.localName === "frame") { - const { contentWindow } = element; - if (contentWindow && element.getAttributeNS(null, "name") === name) { - return contentWindow; - } - } - } - - if (set.size === 1) { - return idlUtils.wrapperForImpl(set.values().next().value); - } - - return HTMLCollection.create(window, [], { - element: idlUtils.implForWrapper(window._document).documentElement, - query() { - // Do *not* reuse `sorted` or `set` from above. We need to re-get and re-iterate the set each time because it - // might have changed due to elements being attached, removed, or having their names changed! - const currentSet = tracker.get(name); - return [...currentSet].sort(treeOrderSorter); - } - }); -} - -exports.elementAttached = element => { - const window = element._ownerDocument._globalObject; - if (!window) { - return; - } - - if (element.namespaceURI !== HTML_NS) { - return; - } - if (nodeRoot(element) !== element._ownerDocument) { - return; - } - - const tracker = trackers.get(window); - - if (nameAttributeElementLocalNames.has(element.localName)) { - const nameAttr = element.getAttributeNS(null, "name"); - if (nameAttr !== null) { - upsert(tracker, nameAttr, element); - } - } - - const idAttr = element.getAttributeNS(null, "id"); - if (idAttr !== null) { - upsert(tracker, idAttr, element); - } -}; - -exports.elementDetached = element => { - const window = element._ownerDocument._globalObject; - if (!window) { - return; - } - - if (element.namespaceURI !== HTML_NS) { - return; - } - - const tracker = trackers.get(window); - - const idAttr = element.getAttributeNS(null, "id"); - if (idAttr !== null) { - remove(tracker, idAttr, element); - } - - const nameAttr = element.getAttributeNS(null, "name"); - if (nameAttr !== null) { - remove(tracker, nameAttr, element); - } -}; - -exports.elementAttributeModified = (element, attributeName, value, oldValue) => { - const window = element._ownerDocument._globalObject; - if (!window) { - return; - } - - if (element.namespaceURI !== HTML_NS) { - return; - } - if (nodeRoot(element) !== element._ownerDocument) { - return; - } - - const tracker = trackers.get(window); - - // TODO what about attribute namespace? - - if (attributeName === "id") { - if (element.getAttributeNS(null, "name") !== oldValue) { - remove(tracker, oldValue, element); - } - if (value !== null) { - upsert(tracker, value, element); - } - } else if (attributeName === "name") { - if (nameAttributeElementLocalNames.has(element.localName)) { - if (element.getAttributeNS(null, "id") !== oldValue) { - remove(tracker, oldValue, element); - } - if (value !== null) { - upsert(tracker, value, element); - } - } - } -}; - -exports.create = (eventTargetPrototype, window) => { - const windowProperties = Object.create(eventTargetPrototype, { - [Symbol.toStringTag]: { - value: "WindowProperties", - configurable: true - } - }); - - const windowPropertiesProxy = new Proxy(windowProperties, { - getOwnPropertyDescriptor(target, property) { - if (typeof property === "symbol") { - return Reflect.getOwnPropertyDescriptor(target, property); - } - - // Named property visibility algorithm check, modified as discused in - // https://github.com/whatwg/webidl/issues/607. - let targetObj = Object.getPrototypeOf(target); - while (targetObj !== null) { - if (Object.hasOwn(targetObj, property)) { - return Reflect.getOwnPropertyDescriptor(target, property); - } - - targetObj = Object.getPrototypeOf(targetObj); - } - - const value = getNamedObject(window, property); - if (value) { - return { - value, - enumerable: false, // Window is [LegacyUnenumerableNamedProperties] - writable: true, - configurable: true - }; - } - - return Reflect.getOwnPropertyDescriptor(target, property); - }, - has(target, property) { - if (typeof property === "symbol") { - return Reflect.has(target, property); - } - - const desc = this.getOwnPropertyDescriptor(target, property); - if (desc !== undefined) { - return true; - } - - const parent = Object.getPrototypeOf(target); - return Reflect.has(parent, property); - }, - get(target, property, receiver) { - if (typeof property === "symbol") { - return Reflect.get(target, property, receiver); - } - - const desc = this.getOwnPropertyDescriptor(target, property); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - return Reflect.get(parent, property, receiver); - } - - // Named properties object only has data properties. - return desc.value; - }, - set(target, property, value, receiver) { - if (typeof property === "symbol") { - return Reflect.set(target, property, value, receiver); - } - - const ownDesc = this.getOwnPropertyDescriptor(target, property); - return idlUtils.ordinarySetWithOwnDescriptor(target, property, value, receiver, ownDesc); - }, - defineProperty() { - return false; - }, - deleteProperty() { - return false; - }, - setPrototypeOf() { - throw new TypeError("Immutable prototype object WindowProperties cannot have its prototype set."); - }, - preventExtensions() { - return false; - } - }); - - trackers.set(window, new Map()); - - return windowPropertiesProxy; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/window/BarProp-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/window/BarProp-impl.js deleted file mode 100644 index ae81b81..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/window/BarProp-impl.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -// https://html.spec.whatwg.org/multipage/window-object.html#browser-interface-elements -class BarPropImpl {} - -// Since many BarProps do not apply to modern browsers, -// returning true in all cases seems to be common practice. -BarPropImpl.prototype.visible = true; - -exports.implementation = BarPropImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/window/External-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/window/External-impl.js deleted file mode 100644 index 645d97c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/window/External-impl.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -// https://html.spec.whatwg.org/multipage/obsolete.html#dom-external -exports.implementation = class ExternalImpl { - // The AddSearchProvider() and IsSearchProviderInstalled() methods must do nothing - AddSearchProvider() {} - - IsSearchProviderInstalled() {} -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/window/History-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/window/History-impl.js deleted file mode 100644 index 367dc82..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/window/History-impl.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; -const DOMException = require("../generated/DOMException"); -const { serializeURL } = require("whatwg-url"); - -// https://html.spec.whatwg.org/#history-3 -exports.implementation = class HistoryImpl { - constructor(globalObject, args, privateData) { - this._window = privateData.window; - this._document = privateData.document; - this._actAsIfLocationReloadCalled = privateData.actAsIfLocationReloadCalled; - this._state = null; - - this._globalObject = globalObject; - } - - _guardAgainstInactiveDocuments() { - if (!this._window) { - throw DOMException.create(this._globalObject, [ - "History object is associated with a document that is not fully active.", - "SecurityError" - ]); - } - } - - get length() { - this._guardAgainstInactiveDocuments(); - - return this._window._sessionHistory.length; - } - - get state() { - this._guardAgainstInactiveDocuments(); - - return this._state; - } - - go(delta) { - this._guardAgainstInactiveDocuments(); - - if (delta === 0) { - // When the go(delta) method is invoked, if delta is zero, the user agent must act as - // if the location.reload() method was called instead. - this._actAsIfLocationReloadCalled(); - } else { - // Otherwise, the user agent must traverse the history by a delta whose value is delta - this._window._sessionHistory.traverseByDelta(delta); - } - } - - back() { - this.go(-1); - } - - forward() { - this.go(+1); - } - - pushState(data, unused, url) { - this._sharedPushAndReplaceState(data, url, "push"); - } - replaceState(data, unused, url) { - this._sharedPushAndReplaceState(data, url, "replace"); - } - - // https://html.spec.whatwg.org/#shared-history-push/replace-state-steps - _sharedPushAndReplaceState(data, url, historyHandling) { - this._guardAgainstInactiveDocuments(); - - // TODO structured clone data - - let newURL = this._document._URL; - if (url !== null && url.length > 0) { - newURL = this._document.encodingParseAURL(url); - - if (newURL === null) { - throw DOMException.create(this._globalObject, [ - `Could not parse url argument "${url}" to ${historyHandling}State() against base URL ` + - `"${this._document.baseURLSerialized()}".`, - "SecurityError" - ]); - } - - if (!canHaveItsURLRewritten(this._document, newURL)) { - throw DOMException.create(this._globalObject, [ - `${historyHandling}State() cannot update history to the URL ${serializeURL(newURL)}.`, - "SecurityError" - ]); - } - } - - // What follows is very unlike the spec's URL and history update steps. Maybe if we implement real session - // history/navigation, we can fix that. - - if (historyHandling === "push") { - this._window._sessionHistory.removeAllEntriesAfterCurrentEntry(); - - this._window._sessionHistory.clearHistoryTraversalTasks(); - - const newEntry = { - document: this._document, - stateObject: data, - url: newURL - }; - this._window._sessionHistory.addEntryAfterCurrentEntry(newEntry); - this._window._sessionHistory.updateCurrentEntry(newEntry); - } else { - const { currentEntry } = this._window._sessionHistory; - currentEntry.stateObject = data; - currentEntry.url = newURL; - } - - // TODO: If the current entry in the session history represents a non-GET request - // (e.g. it was the result of a POST submission) then update it to instead represent - // a GET request. - - this._document._URL = newURL; - this._document._clearBaseURLCache(); - - // arguably it's a bit odd that the state and latestEntry do not belong to the SessionHistory - // but the spec gives them to "History" and "Document" respecively. - this._state = data; // TODO clone again!! O_o - this._document._latestEntry = this._window._sessionHistory.currentEntry; - } -}; - -function canHaveItsURLRewritten(document, targetURL) { - const documentURL = document._URL; - - if (targetURL.scheme !== documentURL.scheme || targetURL.username !== documentURL.username || - targetURL.password !== documentURL.password || targetURL.host !== documentURL.host || - targetURL.port !== documentURL.port) { - return false; - } - - if (targetURL.scheme === "https" || targetURL.scheme === "http") { - return true; - } - - if (targetURL.scheme === "file" && targetURL.path !== documentURL.path) { - return false; - } - - if (targetURL.path.join("/") !== documentURL.path.join("/") || targetURL.query !== documentURL.query) { - return false; - } - - return true; -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/window/Location-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/window/Location-impl.js deleted file mode 100644 index 098eb07..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/window/Location-impl.js +++ /dev/null @@ -1,227 +0,0 @@ -"use strict"; -const whatwgURL = require("whatwg-url"); -const DOMException = require("../generated/DOMException"); -const { navigate } = require("./navigation"); - -// Not implemented: use of entry settings object's API base URL in href setter, assign, and replace. Instead we just -// use the document base URL. The difference matters in the case of cross-frame calls. - -exports.implementation = class LocationImpl { - constructor(globalObject, args, privateData) { - this._relevantDocument = privateData.relevantDocument; - this.url = null; - - this._globalObject = globalObject; - } - - get _url() { - return this._relevantDocument._URL; - } - - _locationObjectSetterNavigate(url) { - // Not implemented: extra steps here to determine replacement flag. - - return this._locationObjectNavigate(url); - } - - _locationObjectNavigate(url, { replacement = false } = {}) { - // Not implemented: the setup for calling navigate, which doesn't apply to our stub navigate anyway. - - navigate(this._relevantDocument._defaultView, url, { replacement, exceptionsEnabled: true }); - } - - toString() { - return this.href; - } - - get href() { - return whatwgURL.serializeURL(this._url); - } - set href(v) { - const newURL = whatwgURL.parseURL(v, { baseURL: this._relevantDocument.baseURL() }); - if (newURL === null) { - throw new TypeError(`Could not parse "${v}" as a URL`); - } - - this._locationObjectSetterNavigate(newURL); - } - - get origin() { - return whatwgURL.serializeURLOrigin(this._url); - } - - get protocol() { - return this._url.scheme + ":"; - } - set protocol(v) { - const copyURL = { ...this._url }; - - const possibleFailure = whatwgURL.basicURLParse(v + ":", { url: copyURL, stateOverride: "scheme start" }); - if (possibleFailure === null) { - throw new TypeError(`Could not parse the URL after setting the procol to "${v}"`); - } - - if (copyURL.scheme !== "http" && copyURL.scheme !== "https") { - return; - } - - this._locationObjectSetterNavigate(copyURL); - } - - get host() { - const url = this._url; - - if (url.host === null) { - return ""; - } - if (url.port === null) { - return whatwgURL.serializeHost(url.host); - } - - return whatwgURL.serializeHost(url.host) + ":" + whatwgURL.serializeInteger(url.port); - } - set host(v) { - const copyURL = { ...this._url }; - - if (whatwgURL.hasAnOpaquePath(copyURL)) { - return; - } - - whatwgURL.basicURLParse(v, { url: copyURL, stateOverride: "host" }); - - this._locationObjectSetterNavigate(copyURL); - } - - get hostname() { - if (this._url.host === null) { - return ""; - } - - return whatwgURL.serializeHost(this._url.host); - } - set hostname(v) { - const copyURL = { ...this._url }; - - if (whatwgURL.hasAnOpaquePath(copyURL)) { - return; - } - - whatwgURL.basicURLParse(v, { url: copyURL, stateOverride: "hostname" }); - - this._locationObjectSetterNavigate(copyURL); - } - - get port() { - if (this._url.port === null) { - return ""; - } - - return whatwgURL.serializeInteger(this._url.port); - } - set port(v) { - const copyURL = { ...this._url }; - - if (whatwgURL.cannotHaveAUsernamePasswordPort(copyURL)) { - return; - } - - whatwgURL.basicURLParse(v, { url: copyURL, stateOverride: "port" }); - - this._locationObjectSetterNavigate(copyURL); - } - - get pathname() { - return whatwgURL.serializePath(this._url); - } - set pathname(v) { - const copyURL = { ...this._url }; - - if (whatwgURL.hasAnOpaquePath(copyURL)) { - return; - } - - copyURL.path = []; - whatwgURL.basicURLParse(v, { url: copyURL, stateOverride: "path start" }); - - this._locationObjectSetterNavigate(copyURL); - } - - get search() { - if (this._url.query === null || this._url.query === "") { - return ""; - } - - return "?" + this._url.query; - } - set search(v) { - const copyURL = { ...this._url }; - - if (v === "") { - copyURL.query = null; - } else { - const input = v[0] === "?" ? v.substring(1) : v; - copyURL.query = ""; - whatwgURL.basicURLParse(input, { - url: copyURL, - stateOverride: "query", - encodingOverride: this._relevantDocument.charset - }); - } - - this._locationObjectSetterNavigate(copyURL); - } - - get hash() { - if (this._url.fragment === null || this._url.fragment === "") { - return ""; - } - - return "#" + this._url.fragment; - } - set hash(v) { - const copyURL = { ...this._url }; - - const input = v[0] === "#" ? v.substring(1) : v; - copyURL.fragment = ""; - whatwgURL.basicURLParse(input, { url: copyURL, stateOverride: "fragment" }); - - if (copyURL.fragment === this._url.fragment) { - return; - } - - this._locationObjectSetterNavigate(copyURL); - } - - assign(url) { - // Should be entry settings object; oh well - const parsedURL = this._relevantDocument.encodingParseAURL(url); - - if (parsedURL === null) { - throw DOMException.create(this._globalObject, [ - `Could not resolve the given string "${url}" relative to the base URL "${this._relevantDocument.URL}"`, - "SyntaxError" - ]); - } - - this._locationObjectNavigate(parsedURL); - } - - replace(url) { - // Should be entry settings object; oh well - const parsedURL = this._relevantDocument.encodingParseAURL(url); - - if (parsedURL === null) { - throw DOMException.create(this._globalObject, [ - `Could not resolve the given string "${url}" relative to the base URL "${this._relevantDocument.URL}"`, - "SyntaxError" - ]); - } - - this._locationObjectNavigate(parsedURL, { replacement: true }); - } - - reload() { - const flags = { replace: true, reloadTriggered: true, exceptionsEnabled: true }; - navigate(this._relevantDocument._defaultView, this._url, flags); - } -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/window/Screen-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/window/Screen-impl.js deleted file mode 100644 index 4f99c41..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/window/Screen-impl.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -// https://drafts.csswg.org/cssom-view-1/#the-screen-interface -class ScreenImpl {} - -ScreenImpl.prototype.availWidth = 0; -ScreenImpl.prototype.availHeight = 0; -ScreenImpl.prototype.width = 0; -ScreenImpl.prototype.height = 0; -ScreenImpl.prototype.colorDepth = 24; -ScreenImpl.prototype.pixelDepth = 24; - -exports.implementation = ScreenImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/window/SessionHistory.js b/vanilla/node_modules/jsdom/lib/jsdom/living/window/SessionHistory.js deleted file mode 100644 index 9864ae5..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/window/SessionHistory.js +++ /dev/null @@ -1,163 +0,0 @@ -"use strict"; -const whatwgURL = require("whatwg-url"); -const HashChangeEvent = require("../generated/HashChangeEvent.js"); -const PopStateEvent = require("../generated/PopStateEvent.js"); -const notImplemented = require("../../browser/not-implemented.js"); -const idlUtils = require("../generated/utils.js"); -const { fireAnEvent } = require("../helpers/events"); - -// https://html.spec.whatwg.org/#session-history -class SessionHistory { - constructor(initialEntry, window) { - this._window = window; - this._windowImpl = idlUtils.implForWrapper(window); - this._historyTraversalQueue = new Set(); - this._entries = [initialEntry]; - this._currentIndex = 0; - } - - _queueHistoryTraversalTask(fn) { - const timeoutId = this._window.setTimeout(() => { - this._historyTraversalQueue.delete(timeoutId); - fn(); - }, 0); - - this._historyTraversalQueue.add(timeoutId); - } - - clearHistoryTraversalTasks() { - for (const timeoutId of this._historyTraversalQueue) { - this._window.clearTimeout(timeoutId); - } - this._historyTraversalQueue.clear(); - } - - get length() { - return this._entries.length; - } - - get currentEntry() { - return this._entries[this._currentIndex]; - } - - // https://html.spec.whatwg.org/#dom-history-pushstate - removeAllEntriesAfterCurrentEntry() { - this._entries.splice(this._currentIndex + 1, Infinity); - } - - // https://html.spec.whatwg.org/#traverse-the-history-by-a-delta - traverseByDelta(delta) { - this._queueHistoryTraversalTask(() => { - const newIndex = this._currentIndex + delta; - if (newIndex < 0 || newIndex >= this.length) { - return; - } - - const specifiedEntry = this._entries[newIndex]; - - // Not implemented: unload a document guard - - // Not clear that this should be queued. html/browsers/history/the-history-interface/004.html can be fixed - // by removing the queue, but doing so breaks some tests in history.js that also pass in browsers. - this._queueHistoryTraversalTask(() => { - // If there is an ongoing attempt to navigate specified browsing context that has not yet matured, - // then cancel that attempt to navigate the browsing context. - - // Doing this seems to break tests involving navigating via push/pop state and via fragments. I think this - // is because these navigations should already count as having "matured" because the document is not changing. - - // this.clearHistoryTraversalTasks(); - - if (specifiedEntry.document !== this.currentEntry.document) { - // TODO: unload the active document with the recycle parameter set to false - notImplemented(this._window, "traversing history to another Document"); - } - this.traverseHistory(specifiedEntry); - }); - }); - } - - // https://html.spec.whatwg.org/#traverse-the-history - traverseHistory(specifiedEntry, flags = {}) { - if (!specifiedEntry.document) { - // If entry no longer holds a Document object, then navigate the browsing context to entry's URL - // to perform an entry update of entry, and abort these steps - notImplemented(this._window, "traversing the history to an entry that no longer holds a Document"); - } - // Not spec compliant, just minimal. Lots of missing steps. - - const nonBlockingEvents = Boolean(flags.nonBlockingEvents); - - const document = idlUtils.implForWrapper(this._window._document); - - const { currentEntry } = this; - - // If the current entry's title was not set by the pushState() or replaceState() methods, then set its title - // to the value returned by the document.title IDL attribute. - if (currentEntry.title === undefined) { - currentEntry.title = document.title; - } - - - if (specifiedEntry.document !== currentEntry.document) { - // If entry has a different Document object than the current entry, then... - notImplemented(this._window, "traversing the history to an entry with a different Document"); - } - - document._URL = specifiedEntry.url; - - const hashChanged = - specifiedEntry.url.fragment !== currentEntry.url.fragment && specifiedEntry.document === currentEntry.document; - let oldURL, newURL; - if (hashChanged) { - oldURL = currentEntry.url; - newURL = specifiedEntry.url; - } - - if (flags.replacement) { - // If the traversal was initiated with replacement enabled, remove the entry immediately before the - // specified entry in the session history. - this._entries.splice(this._entries.indexOf(specifiedEntry) - 1, 1); - } - - this.updateCurrentEntry(specifiedEntry); - - const state = specifiedEntry.stateObject; // TODO structured clone - - // arguably it's a bit odd that the state and latestEntry do not belong to the SessionHistory - // but the spec gives them to "History" and "Document" respecively. - document._history._state = state; - const stateChanged = specifiedEntry.document._latestEntry !== specifiedEntry; - specifiedEntry.document._latestEntry = specifiedEntry; - - const fireEvents = () => this._fireEvents(stateChanged, hashChanged, state, oldURL, newURL); - - if (nonBlockingEvents) { - this._window.setTimeout(fireEvents, 0); - } else { - fireEvents(); - } - } - - _fireEvents(stateChanged, hashChanged, state, oldURL, newURL) { - if (stateChanged) { - fireAnEvent("popstate", this._windowImpl, PopStateEvent, { state }); - } - - if (hashChanged) { - fireAnEvent("hashchange", this._windowImpl, HashChangeEvent, { - oldURL: whatwgURL.serializeURL(oldURL), - newURL: whatwgURL.serializeURL(newURL) - }); - } - } - - addEntryAfterCurrentEntry(entry) { - this._entries.splice(this._currentIndex + 1, 0, entry); - } - - updateCurrentEntry(entry) { - this._currentIndex = this._entries.indexOf(entry); - } -} -module.exports = SessionHistory; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/window/navigation.js b/vanilla/node_modules/jsdom/lib/jsdom/living/window/navigation.js deleted file mode 100644 index b50fc4b..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/window/navigation.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -const whatwgURL = require("whatwg-url"); -const { notImplemented } = require("../../browser/not-implemented.js"); -const reportException = require("../helpers/runtime-script-errors.js"); -const { utf8Decode } = require("../helpers/encoding.js"); -const idlUtils = require("../generated/utils.js"); - -// https://html.spec.whatwg.org/#evaluate-a-javascript:-url, kind of -exports.evaluateJavaScriptURL = (window, urlRecord) => { - const urlString = whatwgURL.serializeURL(urlRecord); - const encodedScriptSource = urlString.substring("javascript:".length); - const scriptSource = utf8Decode(whatwgURL.percentDecodeString(encodedScriptSource)); - if (window._runScripts === "dangerously") { - try { - return window.eval(scriptSource); - } catch (e) { - reportException(window, e, urlString); - } - } - return undefined; -}; - -// https://html.spec.whatwg.org/#navigating-across-documents -exports.navigate = (window, newURL, flags) => { - // This is NOT a spec-compliant implementation of navigation in any way. It implements a few selective steps that - // are nice for jsdom users, regarding hash changes and JavaScript URLs. Full navigation support is being worked on - // and will likely require some additional hooks to be implemented. - if (!window._document) { - return; - } - - const document = idlUtils.implForWrapper(window._document); - const currentURL = document._URL; - - if (!flags.reloadTriggered && urlEquals(currentURL, newURL, { excludeFragments: true })) { - if (newURL.fragment !== currentURL.fragment) { - navigateToFragment(window, newURL, flags); - } - return; - } - - // NOT IMPLEMENTED: Prompt to unload the active document of browsingContext. - - // NOT IMPLEMENTED: form submission algorithm - // const navigationType = 'other'; - - // NOT IMPLEMENTED: if resource is a response... - if (newURL.scheme === "javascript") { - setTimeout(() => { - const result = exports.evaluateJavaScriptURL(window, newURL); - if (typeof result === "string") { - notImplemented(window, "string results from 'javascript:' URLs"); - } - }, 0); - return; - } - navigateFetch(window); -}; - -// https://html.spec.whatwg.org/#scroll-to-fragid -function navigateToFragment(window, newURL, flags) { - const document = idlUtils.implForWrapper(window._document); - - window._sessionHistory.clearHistoryTraversalTasks(); - - if (!flags.replacement) { - // handling replacement=true here deviates from spec, but matches real browser behaviour - // see https://github.com/whatwg/html/issues/2796 for spec bug - window._sessionHistory.removeAllEntriesAfterCurrentEntry(); - } - const newEntry = { document, url: newURL }; - window._sessionHistory.addEntryAfterCurrentEntry(newEntry); - window._sessionHistory.traverseHistory(newEntry, { nonBlockingEvents: true, replacement: flags.replacement }); -} - -// https://html.spec.whatwg.org/#process-a-navigate-fetch -function navigateFetch(window) { - // TODO: - notImplemented(window, "navigation to another Document"); -} - -// https://url.spec.whatwg.org/#concept-url-equals -function urlEquals(a, b, flags) { - const serializedA = whatwgURL.serializeURL(a, flags.excludeFragments); - const serializedB = whatwgURL.serializeURL(b, flags.excludeFragments); - return serializedA === serializedB; -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/FormData-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/FormData-impl.js deleted file mode 100644 index f3cd717..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/FormData-impl.js +++ /dev/null @@ -1,191 +0,0 @@ -"use strict"; -const DOMException = require("../generated/DOMException"); -const idlUtils = require("../generated/utils"); -const { closest } = require("../helpers/traversal"); -const { isDisabled, isButton, isSubmitButton } = require("../helpers/form-controls"); -const Blob = require("../generated/Blob.js"); -const File = require("../generated/File.js"); -const conversions = require("webidl-conversions"); - -exports.implementation = class FormDataImpl { - constructor(globalObject, args) { - this._globalObject = globalObject; - this._entries = []; - - if (args[0] !== undefined) { - const [form, submitter = null] = args; - if (submitter !== null) { - if (!isSubmitButton(submitter)) { - throw new TypeError("The specified element is not a submit button"); - } - if (submitter.form !== form) { - throw DOMException.create(this._globalObject, [ - "The specified element is not owned by this form element", - "NotFoundError" - ]); - } - } - this._entries = constructTheEntryList(form, submitter); - } - } - - append(name, value, filename) { - const entry = createAnEntry(name, value, filename); - this._entries.push(entry); - } - - delete(name) { - this._entries = this._entries.filter(entry => entry.name !== name); - } - - get(name) { - const foundEntry = this._entries.find(entry => entry.name === name); - return foundEntry !== undefined ? idlUtils.tryWrapperForImpl(foundEntry.value) : null; - } - - getAll(name) { - return this._entries.filter(entry => entry.name === name).map(entry => idlUtils.tryWrapperForImpl(entry.value)); - } - - has(name) { - return this._entries.findIndex(entry => entry.name === name) !== -1; - } - - set(name, value, filename) { - const entry = createAnEntry(name, value, filename); - - const foundIndex = this._entries.findIndex(e => e.name === name); - if (foundIndex !== -1) { - this._entries[foundIndex] = entry; - this._entries = this._entries.filter((e, i) => e.name !== name || i === foundIndex); - } else { - this._entries.push(entry); - } - } - - * [Symbol.iterator]() { - for (const entry of this._entries) { - yield [entry.name, idlUtils.tryWrapperForImpl(entry.value)]; - } - } -}; - -function createAnEntry(name, value, filename) { - const entry = { name }; - - // https://github.com/whatwg/xhr/issues/75 - - if (Blob.isImpl(value) && !File.isImpl(value)) { - const oldValue = value; - value = File.createImpl(value._globalObject, [ - [], - "blob", - { type: oldValue.type } - ]); - // "representing the same bytes" - value._bytes = oldValue._bytes; - } - - if (File.isImpl(value) && filename !== undefined) { - const oldValue = value; - value = File.createImpl(value._globalObject, [ - [], - filename, - // spec makes no mention of `lastModified`; assume it is inherited - // (Chrome's behavior) - { type: oldValue.type, lastModified: oldValue.lastModified } - ]); - // "representing the same bytes" - value._bytes = oldValue._bytes; - } - - entry.value = value; - - return entry; -} - -function constructTheEntryList(form, submitter) { - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set - // TODO: handle encoding - // TODO: handling "constructing entry list" - - const controls = form._getSubmittableElementNodes(); - const entryList = []; - - for (const field of controls) { - if (closest(field, "datalist") !== null) { - continue; - } - if (isDisabled(field)) { - continue; - } - if (isButton(field) && field !== submitter) { - continue; - } - if (field.type === "checkbox" && field._checkedness === false) { - continue; - } - if (field.type === "radio" && field._checkedness === false) { - continue; - } - if (field.localName === "object") { // in jsdom, no objects are "using a plugin" - continue; - } - - const name = field.getAttributeNS(null, "name"); - if (field.localName === "input" && field.type === "image") { - const prefix = name ? `${name}.` : ""; - const coordinate = field._selectedCoordinate ?? { x: 0, y: 0 }; - appendAnEntry(entryList, `${prefix}x`, coordinate.x); - appendAnEntry(entryList, `${prefix}y`, coordinate.y); - continue; - } - - // TODO: handle form-associated custom elements. - - if (name === null || name === "") { - continue; - } - - if (field.localName === "select") { - for (const option of field.options) { - if (option._selectedness === true && !isDisabled(field)) { - appendAnEntry(entryList, name, option._getValue()); - } - } - } else if (field.localName === "input" && (field.type === "checkbox" || field.type === "radio")) { - const value = field.hasAttributeNS(null, "value") ? field.getAttributeNS(null, "value") : "on"; - appendAnEntry(entryList, name, value); - } else if (field.type === "file") { - if (field.files.length === 0) { - const value = File.createImpl(form._globalObject, [[], "", { type: "application/octet-stream" }]); - appendAnEntry(entryList, name, value); - } else { - for (let i = 0; i < field.files.length; ++i) { - appendAnEntry(entryList, name, field.files.item(i)); - } - } - } else { - appendAnEntry(entryList, name, field._getValue()); - } - - const dirname = field.getAttributeNS(null, "dirname"); - if (dirname !== null && dirname !== "") { - const dir = "ltr"; // jsdom does not (yet?) implement actual directionality - appendAnEntry(entryList, dirname, dir); - } - } - - // TODO: formdata event - - return entryList; -} - -function appendAnEntry(entryList, name, value) { - name = conversions.USVString(name); - if (!File.isImpl(value)) { - value = conversions.USVString(value); - } - const entry = createAnEntry(name, value); - entryList.push(entry); -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js deleted file mode 100644 index 69cd1be..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js +++ /dev/null @@ -1,1049 +0,0 @@ -"use strict"; - -const { spawnSync } = require("child_process"); -const { inspect } = require("util"); -const { parseURL, serializeURL } = require("whatwg-url"); -const { getBOMEncoding, labelToName, legacyHookDecode } = require("@exodus/bytes/encoding.js"); -const tough = require("tough-cookie"); -const { MIMEType } = require("whatwg-mimetype"); -const DOMException = require("../generated/DOMException"); -const idlUtils = require("../generated/utils"); -const Document = require("../generated/Document"); -const Blob = require("../generated/Blob"); -const FormData = require("../generated/FormData"); -const XMLHttpRequestUpload = require("../generated/XMLHttpRequestUpload"); -const ProgressEvent = require("../generated/ProgressEvent"); -const { isHeaderName, isHeaderValue, normalizeHeaderValue } = require("../fetch/header-utils"); -const HeaderList = require("../fetch/header-list"); -const { isForbiddenRequestHeader } = require("../fetch/header-types"); -const { performFetch, isNetworkError } = require("./xhr-utils"); -const XMLHttpRequestEventTargetImpl = require("./XMLHttpRequestEventTarget-impl").implementation; -const { parseIntoDocument } = require("../../browser/parser"); -const { fragmentSerialization } = require("../domparsing/serialization"); -const { copyToArrayBufferInTargetRealmDestructively, concatTypedArrays } = require("../helpers/binary-data"); -const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor"); -const { utf8Encode, utf8Decode } = require("../helpers/encoding"); -const { fireAnEvent } = require("../helpers/events"); -const { parseJSONFromBytes } = require("../helpers/json"); -const { asciiCaseInsensitiveMatch } = require("../helpers/strings"); -const { serializeEntryList } = require("./multipart-form-data"); - -const syncWorkerFile = require.resolve("./xhr-sync-worker.js"); - -const READY_STATES = Object.freeze({ - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 -}); - -const tokenRegexp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/; - -const allowedRequestMethods = new Set(["OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE"]); -const forbiddenRequestMethods = new Set(["TRACK", "TRACE", "CONNECT"]); - -// Helper functions for error handling - -function dispatchError(xhr, errMessage) { - // Store the error message for sync XHR worker to serialize - xhr._error = errMessage; - requestErrorSteps(xhr, "error", DOMException.create(xhr._globalObject, [errMessage, "NetworkError"])); -} - -function requestErrorSteps(xhr, event, exception) { - const { upload } = xhr; - - xhr.readyState = READY_STATES.DONE; - xhr._send = false; - - setResponseToNetworkError(xhr); - - if (xhr._synchronous) { - throw exception; - } - - fireAnEvent("readystatechange", xhr); - - if (!xhr._uploadComplete) { - xhr._uploadComplete = true; - - if (xhr._uploadListener) { - fireAnEvent(event, upload, ProgressEvent, { loaded: 0, total: 0, lengthComputable: false }); - fireAnEvent("loadend", upload, ProgressEvent, { loaded: 0, total: 0, lengthComputable: false }); - } - } - - fireAnEvent(event, xhr, ProgressEvent, { loaded: 0, total: 0, lengthComputable: false }); - fireAnEvent("loadend", xhr, ProgressEvent, { loaded: 0, total: 0, lengthComputable: false }); -} - -function setResponseToNetworkError(xhr) { - xhr._responseBytes = - xhr._responseCache = - xhr._responseTextCache = - xhr._responseXMLCache = null; - - xhr._responseHeaders = new HeaderList(); - xhr.status = 0; - xhr.statusText = ""; -} - -class XMLHttpRequestImpl extends XMLHttpRequestEventTargetImpl { - constructor(window) { - super(window); - - const { _ownerDocument } = this; - - this.upload = XMLHttpRequestUpload.createImpl(window); - - // Public WebIDL properties - this.readyState = READY_STATES.UNSENT; - this.responseURL = ""; - this.status = 0; - this.statusText = ""; - - // Request configuration - this._synchronous = false; - this._withCredentials = false; - this._mimeType = null; - this._auth = null; - this._method = undefined; - this._responseType = ""; - this._requestHeaders = new HeaderList(); - this._referrer = _ownerDocument.URL; - this._url = ""; - this._timeout = 0; - this._body = undefined; - this._preflight = false; - this._overrideMIMEType = null; - this._overrideCharset = null; - this._requestManager = _ownerDocument._requestManager; - this._dispatcher = window._dispatcher; - this._cookieJar = _ownerDocument._cookieJar; - this._encoding = _ownerDocument._encoding; - this._origin = window._origin; - this._userAgent = window.navigator.userAgent; - - // Runtime/response state - this._beforeSend = false; - this._send = false; - this._controller = null; - this._timeoutStart = 0; - this._timeoutId = 0; - this._timeoutFn = null; - this._responseBytes = null; - this._responseCache = null; - this._responseTextCache = null; - this._responseXMLCache = null; - this._responseHeaders = new HeaderList(); - this._filteredResponseHeaders = new Set(); - this._error = ""; - this._uploadComplete = false; - this._uploadListener = false; - // Signifies that we're calling abort() from xhr-utils.js because of a window shutdown. - // In that case the termination reason is "fatal", not "end-user abort". - this._abortError = false; - this._bufferStepSize = 1 * 1024 * 1024; // pre-allocate buffer increase step size. init value is 1MB - this._totalReceivedChunkSize = 0; - } - - get responseType() { - return this._responseType; - } - set responseType(responseType) { - if (this.readyState === READY_STATES.LOADING || this.readyState === READY_STATES.DONE) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - if (this.readyState === READY_STATES.OPENED && this._synchronous) { - throw DOMException.create(this._globalObject, [ - "The object does not support the operation or argument.", - "InvalidAccessError" - ]); - } - this._responseType = responseType; - } - - get response() { - if (this._responseCache) { - // Needed because of: https://github.com/jsdom/webidl2js/issues/149 - return idlUtils.tryWrapperForImpl(this._responseCache); - } - let res; - - const responseBytes = this._responseBytes?.slice(0, this._totalReceivedChunkSize) ?? null; - - switch (this.responseType) { - case "": - case "text": { - res = this.responseText; - break; - } - case "arraybuffer": { - if (!responseBytes) { - return null; - } - res = copyToArrayBufferInTargetRealmDestructively(responseBytes.buffer, this._globalObject); - break; - } - case "blob": { - if (!responseBytes) { - return null; - } - const contentType = finalMIMEType(this); - res = Blob.createImpl(this._globalObject, [ - [new Uint8Array(responseBytes)], - { type: contentType || "" } - ]); - break; - } - case "document": { - res = this.responseXML; - break; - } - case "json": { - if (this.readyState !== READY_STATES.DONE || !responseBytes) { - res = null; - } - - try { - res = parseJSONFromBytes(responseBytes); - } catch { - res = null; - } - break; - } - } - this._responseCache = res; - // Needed because of: https://github.com/jsdom/webidl2js/issues/149 - return idlUtils.tryWrapperForImpl(res); - } - get responseText() { - if (this.responseType !== "" && this.responseType !== "text") { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - if (this.readyState !== READY_STATES.LOADING && this.readyState !== READY_STATES.DONE) { - return ""; - } - if (this._responseTextCache) { - return this._responseTextCache; - } - const responseBytes = this._responseBytes?.slice(0, this._totalReceivedChunkSize) ?? null; - if (!responseBytes) { - return ""; - } - - const fallbackEncodingLabel = finalCharset(this) || getBOMEncoding(responseBytes) || "UTF-8"; - const res = legacyHookDecode(responseBytes, fallbackEncodingLabel); - - this._responseTextCache = res; - return res; - } - get responseXML() { - if (this.responseType !== "" && this.responseType !== "document") { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - if (this.readyState !== READY_STATES.DONE) { - return null; - } - if (this._responseXMLCache) { - return this._responseXMLCache; - } - const responseBytes = this._responseBytes?.slice(0, this._totalReceivedChunkSize) ?? null; - if (!responseBytes) { - return null; - } - - const contentType = finalMIMEType(this); - let isHTML = false; - let isXML = false; - const parsed = MIMEType.parse(contentType); - if (parsed) { - isHTML = parsed.isHTML(); - isXML = parsed.isXML(); - if (!isXML && !isHTML) { - return null; - } - } - - if (this.responseType === "" && isHTML) { - return null; - } - - const encoding = finalCharset(this) || labelToName(getBOMEncoding(responseBytes)) || "UTF-8"; - const resText = legacyHookDecode(responseBytes, encoding); - - if (!resText) { - return null; - } - const res = Document.createImpl(this._globalObject, [], { - options: { - url: this._url, - lastModified: new Date(this._responseHeaders.get("last-modified")), - parsingMode: isHTML ? "html" : "xml", - cookieJar: { setCookieSync: () => undefined, getCookieStringSync: () => "" }, - encoding, - parseOptions: this._ownerDocument._parseOptions - } - }); - try { - parseIntoDocument(resText, res); - } catch { - this._responseXMLCache = null; - return null; - } - res.close(); - this._responseXMLCache = res; - return res; - } - - get timeout() { - return this._timeout; - } - set timeout(val) { - if (this._synchronous) { - throw DOMException.create(this._globalObject, [ - "The object does not support the operation or argument.", - "InvalidAccessError" - ]); - } - this._timeout = val; - clearTimeout(this._timeoutId); - if (val > 0 && this._timeoutFn) { - this._timeoutId = setTimeout( - this._timeoutFn, - Math.max(0, val - ((new Date()).getTime() - this._timeoutStart)) - ); - } else { - this._timeoutFn = null; - this._timeoutStart = 0; - } - } - - get withCredentials() { - return this._withCredentials; - } - set withCredentials(val) { - if (!(this.readyState === READY_STATES.UNSENT || this.readyState === READY_STATES.OPENED)) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - if (this._send) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - this._withCredentials = val; - } - - abort() { - // Terminate the request - clearTimeout(this._timeoutId); - this._timeoutFn = null; - this._timeoutStart = 0; - - if (this._controller) { - this._controller.abort(); - this._controller = null; - } - - if (this._abortError) { - // Special case that ideally shouldn't be going through the public API at all. - // Run the https://xhr.spec.whatwg.org/#handle-errors "fatal" steps. - this.readyState = READY_STATES.DONE; - this._send = false; - setResponseToNetworkError(this); - return; - } - - if ((this.readyState === READY_STATES.OPENED && this._send) || - this.readyState === READY_STATES.HEADERS_RECEIVED || - this.readyState === READY_STATES.LOADING) { - requestErrorSteps(this, "abort"); - } - - if (this.readyState === READY_STATES.DONE) { - this.readyState = READY_STATES.UNSENT; - - setResponseToNetworkError(this); - } - } - getAllResponseHeaders() { - if (this.readyState === READY_STATES.UNSENT || this.readyState === READY_STATES.OPENED) { - return ""; - } - const result = []; - for (const [key, value] of this._responseHeaders) { - const lcKey = key.toLowerCase(); - if (!this._filteredResponseHeaders.has(lcKey)) { - result.push(`${lcKey}: ${value}`); - } - } - return result.join("\r\n"); - } - - getResponseHeader(header) { - if (this.readyState === READY_STATES.UNSENT || this.readyState === READY_STATES.OPENED) { - return null; - } - const lcHeader = header.toLowerCase(); - if (this._filteredResponseHeaders.has(lcHeader)) { - return null; - } - return this._responseHeaders.get(lcHeader); - } - - open(method, url, asynchronous, user, password) { - const { _ownerDocument } = this; - if (!_ownerDocument) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - - if (!tokenRegexp.test(method)) { - throw DOMException.create(this._globalObject, [ - "The string did not match the expected pattern.", - "SyntaxError" - ]); - } - const upperCaseMethod = method.toUpperCase(); - if (forbiddenRequestMethods.has(upperCaseMethod)) { - throw DOMException.create(this._globalObject, ["The operation is insecure.", "SecurityError"]); - } - - if (this._controller && typeof this._controller.abort === "function") { - this._controller.abort(); - } - - if (allowedRequestMethods.has(upperCaseMethod)) { - method = upperCaseMethod; - } - if (typeof asynchronous !== "undefined") { - this._synchronous = !asynchronous; - } else { - this._synchronous = false; - } - if (this._responseType && this._synchronous) { - throw DOMException.create(this._globalObject, [ - "The object does not support the operation or argument.", - "InvalidAccessError" - ]); - } - if (this._synchronous && this._timeout) { - throw DOMException.create(this._globalObject, [ - "The object does not support the operation or argument.", - "InvalidAccessError" - ]); - } - this._method = method; - - const urlRecord = parseURL(url, { baseURL: _ownerDocument.baseURL() }); - if (!urlRecord) { - throw DOMException.create(this._globalObject, [ - "The string did not match the expected pattern.", - "SyntaxError" - ]); - } - - if (user || (password && !urlRecord.username)) { - this._auth = { - user, - pass: password - }; - urlRecord.username = ""; - urlRecord.password = ""; - } - - this._url = serializeURL(urlRecord); - this._requestHeaders = new HeaderList(); - this._preflight = false; - - this._send = false; - this._uploadListener = false; - this._body = undefined; - this._abortError = false; - - this._responseBytes = null; - this._responseCache = null; - this._responseTextCache = null; - this._responseXMLCache = null; - this._responseHeaders = new HeaderList(); - this._totalReceivedChunkSize = 0; - this.responseURL = ""; - this.status = 0; - this.statusText = ""; - - readyStateChange(this, READY_STATES.OPENED); - } - - overrideMimeType(mime) { - if (this.readyState === READY_STATES.LOADING || this.readyState === READY_STATES.DONE) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - - this._overrideMIMEType = "application/octet-stream"; - - // Waiting for better spec: https://github.com/whatwg/xhr/issues/157 - const parsed = MIMEType.parse(mime); - if (parsed) { - this._overrideMIMEType = parsed.essence; - - const charset = parsed.parameters.get("charset"); - if (charset) { - this._overrideCharset = labelToName(charset); - } - } - } - - // TODO: Add support for URLSearchParams and ReadableStream - send(body) { - const { upload, _ownerDocument } = this; - // Not per spec, but per tests: https://github.com/whatwg/xhr/issues/65 - if (!_ownerDocument) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - - if (this.readyState !== READY_STATES.OPENED || this._send) { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - - this._beforeSend = true; - - try { - if (this._method === "GET" || this._method === "HEAD") { - body = null; - } - - if (body !== null) { - let extractedContentType = null; - - if (Document.isImpl(body)) { - // Note: our utf8Encode() does both USVString conversion and UTF-8 encoding. - this._body = utf8Encode(fragmentSerialization(body, { requireWellFormed: false })); - } else { - const { body: extractedBody, type } = extractBody(body); - this._body = extractedBody; - extractedContentType = type; - } - - const originalAuthorContentType = this._requestHeaders.get("content-type"); - - if (originalAuthorContentType !== null) { - if (Document.isImpl(body) || typeof body === "string") { - const parsed = MIMEType.parse(originalAuthorContentType); - if (parsed) { - const charset = parsed.parameters.get("charset"); - if (charset && !asciiCaseInsensitiveMatch(charset, "UTF-8")) { - parsed.parameters.set("charset", "UTF-8"); - this._requestHeaders.set("Content-Type", parsed.toString()); - } - } - } - } else if (Document.isImpl(body)) { - if (body._parsingMode === "html") { - this._requestHeaders.set("Content-Type", "text/html;charset=UTF-8"); - } else { - this._requestHeaders.set("Content-Type", "application/xml;charset=UTF-8"); - } - } else if (extractedContentType !== null) { - this._requestHeaders.set("Content-Type", extractedContentType); - } - } - } finally { - if (this._beforeSend) { - this._beforeSend = false; - } else { - throw DOMException.create(this._globalObject, ["The object is in an invalid state.", "InvalidStateError"]); - } - } - - if (Object.keys(upload._eventListeners).length > 0) { - this._uploadListener = true; - } - - // request doesn't like zero-length bodies - if (this._body && this._body.byteLength === 0) { - this._body = null; - } - - // Per XHR spec step 11: "If req's body is null, then set this's upload complete flag." - // This prevents upload events from firing for GET/HEAD and other bodyless requests. - // Note: this._body may be undefined (for GET/HEAD) or null (for zero-length bodies). - if (!this._body) { - this._uploadComplete = true; - } - - if (this._synchronous) { - const configStr = JSON.stringify(this._serializeRequest()); - const child = spawnSync( - process.execPath, - [syncWorkerFile], - { input: configStr, maxBuffer: Infinity } - ); - - // Try to parse the response first. If we have valid JSON, the request succeeded - // even if the process crashed during cleanup (e.g., UV_HANDLE_CLOSING on Windows). - // See: https://github.com/nodejs/node/issues/56645 - let response; - try { - response = JSON.parse(child.stdout.toString()); - } catch (parseError) { - // No valid response - check for actual errors - if (child.error) { - throw child.error; - } - if (child.status !== 0) { - throw new Error(child.stderr.toString()); - } - throw new Error("Sync XHR worker did not produce a JSON-parseable response", { cause: parseError }); - } - this._adoptSerializedResponse(response); - - this.readyState = READY_STATES.LOADING; - - if (this._error) { - dispatchError(this, this._error); - throw DOMException.create(this._globalObject, [this._error, "NetworkError"]); - } else { - const contentLength = this._responseHeaders.get("content-length") || "0"; - const byteLength = parseInt(contentLength) || this._responseBytes.length; - const progressObj = { lengthComputable: false }; - if (byteLength !== 0) { - progressObj.total = byteLength; - progressObj.loaded = byteLength; - progressObj.lengthComputable = true; - } - fireAnEvent("progress", this, ProgressEvent, progressObj); - readyStateChange(this, READY_STATES.DONE); - fireAnEvent("load", this, ProgressEvent, progressObj); - fireAnEvent("loadend", this, ProgressEvent, progressObj); - } - } else { - this._send = true; - this._totalReceivedChunkSize = 0; - this._bufferStepSize = 1 * 1024 * 1024; - - if (body !== null && body !== "") { - this._uploadComplete = false; - } else { - this._uploadComplete = true; - } - - // State for upload progress - use this._body which is the processed Uint8Array - const uploadTotal = this._body ? this._body.byteLength : 0; - const uploadProgress = { - lengthComputable: uploadTotal > 0, - total: uploadTotal, - loaded: 0 - }; - - // Create abort controller BEFORE firing loadstart so open() called in - // loadstart handler can properly abort this request - const abortController = new AbortController(); - this._controller = abortController; - - // Register with request manager so window.close()/stop() can abort this request - const requestManagerEntry = { - abort: () => { - this._abortError = true; - abortController.abort(); - } - }; - if (this._requestManager) { - this._requestManager.add(requestManagerEntry); - } - - // Per XHR spec, fire loadstart on xhr first, then on upload. - fireAnEvent("loadstart", this, ProgressEvent); - - if (!this._uploadComplete && this._uploadListener) { - fireAnEvent("loadstart", upload, ProgressEvent, uploadProgress); - } - - // Per XHR spec: "If this's state is not opened or this's send() flag is unset, return." - // Also check if this request was aborted (e.g., by open() called in loadstart handler) - if (this.readyState !== READY_STATES.OPENED || !this._send || abortController.signal.aborted) { - if (this._requestManager) { - this._requestManager.remove(requestManagerEntry); - } - return; - } - - // Async fetch and body streaming - (async () => { - try { - const response = await performFetch( - this._dispatcher, - { - url: this._url, - method: this._method, - requestHeaders: this._requestHeaders, - body: this._body, - origin: this._origin, - referrer: this._referrer, - userAgent: this._userAgent, - withCredentials: this._withCredentials, - auth: this._auth, - cookieJar: this._cookieJar, - uploadListener: this._uploadListener - }, - abortController.signal - ); - - // Handle network errors (includes CORS failures) - if (isNetworkError(response)) { - if (abortController.signal.aborted) { - // Request was aborted - don't fire error events - return; - } - dispatchError(this, response.error?.message || "Network error"); - return; - } - - // Fire upload complete events - if (!this._uploadComplete) { - this._uploadComplete = true; - if (this._uploadListener) { - uploadProgress.loaded = uploadProgress.total; - fireAnEvent("progress", upload, ProgressEvent, uploadProgress); - fireAnEvent("load", upload, ProgressEvent, uploadProgress); - fireAnEvent("loadend", upload, ProgressEvent, uploadProgress); - } - } - - // Process response headers (CORS filtering done by performFetch) - const { headers, filteredResponseHeaders } = response; - - this.responseURL = response.url; - this.status = response.status; - this.statusText = response.statusText; - this._responseHeaders = headers; - this._filteredResponseHeaders = filteredResponseHeaders; - - // Set up progress tracking - // If content-encoding is set, the body was compressed and we report decompressed bytes, - // so lengthComputable must be false (method b from the XHR spec) - const contentEncoding = headers.get("content-encoding"); - const contentLength = headers.get("content-length") || "0"; - const bufferLength = parseInt(contentLength) || 0; - const progressObj = { lengthComputable: false, loaded: 0, total: 0 }; - if (bufferLength !== 0 && !contentEncoding) { - progressObj.total = bufferLength; - progressObj.lengthComputable = true; - } - - // Pre-allocate buffer - this._responseBytes = new Uint8Array(this._bufferStepSize); - this._responseCache = null; - this._responseTextCache = null; - this._responseXMLCache = null; - - readyStateChange(this, READY_STATES.HEADERS_RECEIVED); - - // Track progress for deduplication - let lastProgressReported; - - // Stream the response body - if (response.body) { - let rawBytesReceived = 0; - - // Body is already decompressed by the decompress interceptor. - // Track bytes for progress as they arrive. - response.body.on("data", chunk => { - rawBytesReceived += chunk.length; - progressObj.loaded = rawBytesReceived; - }); - - for await (const chunk of response.body) { - // Check if aborted - if (abortController.signal.aborted) { - break; - } - - // Store decompressed bytes - this._totalReceivedChunkSize += chunk.length; - if (this._totalReceivedChunkSize >= this._bufferStepSize) { - this._bufferStepSize *= 2; - while (this._totalReceivedChunkSize >= this._bufferStepSize) { - this._bufferStepSize *= 2; - } - const tmpBuf = new Uint8Array(this._bufferStepSize); - tmpBuf.set(this._responseBytes); - this._responseBytes = tmpBuf; - } - this._responseBytes.set(chunk, this._totalReceivedChunkSize - chunk.length); - this._responseCache = null; - this._responseTextCache = null; - this._responseXMLCache = null; - - if (this.readyState === READY_STATES.HEADERS_RECEIVED) { - this.readyState = READY_STATES.LOADING; - } - fireAnEvent("readystatechange", this); - - if (progressObj.total !== progressObj.loaded || this._totalReceivedChunkSize === rawBytesReceived) { - if (lastProgressReported !== progressObj.loaded) { - lastProgressReported = progressObj.loaded; - fireAnEvent("progress", this, ProgressEvent, progressObj); - } - } - } - } - - // Request complete - clearTimeout(this._timeoutId); - this._timeoutFn = null; - this._timeoutStart = 0; - this._controller = null; - - if (this._requestManager) { - this._requestManager.remove(requestManagerEntry); - } - - // Don't fire completion events if aborted - if (abortController.signal.aborted) { - return; - } - - // Fire final progress if not already fired with this loaded value - if (lastProgressReported !== progressObj.loaded) { - fireAnEvent("progress", this, ProgressEvent, progressObj); - } - readyStateChange(this, READY_STATES.DONE); - fireAnEvent("load", this, ProgressEvent, progressObj); - fireAnEvent("loadend", this, ProgressEvent, progressObj); - } catch (err) { - this._controller = null; - if (this._requestManager) { - this._requestManager.remove(requestManagerEntry); - } - // Don't fire error events if aborted - if (!abortController.signal.aborted) { - dispatchError(this, err.message || String(err)); - } - } - })(); - - if (this.timeout > 0) { - this._timeoutStart = (new Date()).getTime(); - this._timeoutFn = () => { - this._controller?.abort(); - if (!(this.readyState === READY_STATES.UNSENT || - (this.readyState === READY_STATES.OPENED && !this._send) || - this.readyState === READY_STATES.DONE)) { - this._send = false; - let stateChanged = false; - if (!this._uploadComplete) { - fireAnEvent("progress", upload, ProgressEvent); - readyStateChange(this, READY_STATES.DONE); - fireAnEvent("timeout", upload, ProgressEvent); - fireAnEvent("loadend", upload, ProgressEvent); - stateChanged = true; - } - fireAnEvent("progress", this, ProgressEvent); - if (!stateChanged) { - readyStateChange(this, READY_STATES.DONE); - } - fireAnEvent("timeout", this, ProgressEvent); - fireAnEvent("loadend", this, ProgressEvent); - } - this.readyState = READY_STATES.UNSENT; - }; - this._timeoutId = setTimeout(this._timeoutFn, this.timeout); - } - } - } - - setRequestHeader(header, value) { - if (this.readyState !== READY_STATES.OPENED) { - throw DOMException.create( - this._globalObject, - ["setRequestHeader() can only be called in the OPENED state.", "InvalidStateError"] - ); - } - if (this._send) { - throw DOMException.create( - this._globalObject, - ["setRequestHeader() cannot be called after send()", "InvalidStateError"] - ); - } - - value = normalizeHeaderValue(value); - - if (!isHeaderName(header)) { - throw DOMException.create(this._globalObject, ["Invalid header name", "SyntaxError"]); - } - if (!isHeaderValue(value)) { - throw DOMException.create(this._globalObject, ["Invalid header value", "SyntaxError"]); - } - - if (isForbiddenRequestHeader(header, value)) { - return; - } - - this._requestHeaders.combine(header, value); - } - - // Serialization methods for sync XHR worker communication - - // Called in main process before spawning sync worker - _serializeRequest() { - let body = this._body; - if (body instanceof Uint8Array) { - body = { type: "Uint8Array", data: Array.from(body) }; - } - - return { - method: this._method, - url: this._url, - body, - requestHeaders: this._requestHeaders.toJSON(), - withCredentials: this._withCredentials, - mimeType: this._mimeType, - auth: this._auth, - responseType: this._responseType, - timeout: this._timeout, - preflight: this._preflight, - cookieJar: this._cookieJar, - encoding: this._encoding, - origin: this._origin, - referrer: this._referrer, - userAgent: this._userAgent - }; - } - - // Called in main process after sync worker returns - _adoptSerializedResponse(response) { - this.status = response.status; - this.statusText = response.statusText; - this.responseURL = response.responseURL; - - if (response.responseBytes) { - this._responseBytes = new Uint8Array(response.responseBytes); - } - this._responseHeaders = HeaderList.fromJSON(response.responseHeaders); - this._filteredResponseHeaders = new Set(response.filteredResponseHeaders); - this._error = response.error || ""; - this._totalReceivedChunkSize = response.totalReceivedChunkSize; - this._uploadComplete = response.uploadComplete; - - if (response.cookieJar) { - this._cookieJar = tough.CookieJar.deserializeSync( - response.cookieJar, - this._ownerDocument._cookieJar.store - ); - } - } - - // Called in worker to set up XHR from serialized config - _adoptSerializedRequest(config) { - this._method = config.method; - this._url = config.url; - this._body = config.body?.type === "Uint8Array" ? - new Uint8Array(config.body.data) : - config.body; - this._requestHeaders = HeaderList.fromJSON(config.requestHeaders); - this._synchronous = false; // Run as async in worker - this._withCredentials = config.withCredentials; - this._mimeType = config.mimeType; - this._auth = config.auth; - this._responseType = config.responseType; - this._timeout = config.timeout; - this._preflight = config.preflight; - this._cookieJar = config.cookieJar ? - tough.CookieJar.fromJSON(config.cookieJar) : - null; - this._encoding = config.encoding; - this._origin = config.origin; - this._referrer = config.referrer; - this._userAgent = config.userAgent; - - this.readyState = READY_STATES.OPENED; - } - - // Called in worker to serialize response - _serializeResponse() { - let responseBytes = this._responseBytes; - if (responseBytes instanceof Uint8Array) { - responseBytes = Array.from(responseBytes.slice(0, this._totalReceivedChunkSize)); - } - - let error = this._error; - if (error && typeof error !== "string") { - error = error.stack || inspect(error); - } - - return { - status: this.status, - statusText: this.statusText, - responseURL: this.responseURL, - responseBytes, - responseHeaders: this._responseHeaders.toJSON(), - filteredResponseHeaders: Array.from(this._filteredResponseHeaders), - error, - totalReceivedChunkSize: this._totalReceivedChunkSize, - uploadComplete: this._uploadComplete, - cookieJar: this._cookieJar - }; - } -} - -setupForSimpleEventAccessors(XMLHttpRequestImpl.prototype, ["readystatechange"]); - -function readyStateChange(xhr, readyState) { - if (xhr.readyState === readyState) { - return; - } - - xhr.readyState = readyState; - - fireAnEvent("readystatechange", xhr); -} - -function finalMIMEType(xhr) { - return xhr._overrideMIMEType || xhr._responseHeaders.get("content-type"); -} - -function finalCharset(xhr) { - if (xhr._overrideCharset) { - return xhr._overrideCharset; - } - const parsedContentType = MIMEType.parse(xhr._responseHeaders.get("content-type")); - if (parsedContentType) { - return labelToName(parsedContentType.parameters.get("charset")); - } - return null; -} - -function extractBody(bodyInit) { - // https://fetch.spec.whatwg.org/#concept-bodyinit-extract - // We represent the body as a `Uint8Array`. - - if (Blob.isImpl(bodyInit)) { - return { - body: bodyInit._bytes, - type: bodyInit.type === "" ? null : bodyInit.type - }; - } else if (idlUtils.isArrayBuffer(bodyInit)) { - return { - body: new Uint8Array(bodyInit).slice(0), - type: null - }; - } else if (ArrayBuffer.isView(bodyInit)) { - return { - body: new Uint8Array(bodyInit), - type: null - }; - } else if (FormData.isImpl(bodyInit)) { - const { boundary, outputChunks } = serializeEntryList(bodyInit._entries); - - return { - body: concatTypedArrays(outputChunks), - type: "multipart/form-data; boundary=" + utf8Decode(boundary) - }; - } - - // Must be a string - return { - body: utf8Encode(bodyInit), - type: "text/plain;charset=UTF-8" - }; -} - -exports.implementation = XMLHttpRequestImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestEventTarget-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestEventTarget-impl.js deleted file mode 100644 index 0455515..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestEventTarget-impl.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -const EventTargetImpl = require("../events/EventTarget-impl").implementation; -const idlUtils = require("../generated/utils"); -const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor"); - -const events = ["loadstart", "progress", "abort", "error", "load", "timeout", "loadend"]; - -class XMLHttpRequestEventTargetImpl extends EventTargetImpl { - // TODO: remove this when we fix EventTargetImpl to use this._globalObject directly instead of using _ownerDocument. - // https://github.com/jsdom/jsdom/issues/2780 - get _ownerDocument() { - return idlUtils.implForWrapper(this._globalObject._document); - } -} -setupForSimpleEventAccessors(XMLHttpRequestEventTargetImpl.prototype, events); - -exports.implementation = XMLHttpRequestEventTargetImpl; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestUpload-impl.js b/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestUpload-impl.js deleted file mode 100644 index c91071c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestUpload-impl.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -const XMLHttpRequestEventTargetImpl = require("./XMLHttpRequestEventTarget-impl").implementation; - -exports.implementation = class XMLHttpRequestUploadImpl extends XMLHttpRequestEventTargetImpl {}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/multipart-form-data.js b/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/multipart-form-data.js deleted file mode 100644 index 4b09302..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/multipart-form-data.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -const conversions = require("webidl-conversions"); -const { utf8Encode } = require("../helpers/encoding"); - -// https://fetch.spec.whatwg.org/#concept-bodyinit-extract (note: always UTF-8) -// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart%2Fform-data-encoding-algorithm -// https://andreubotella.github.io/multipart-form-data/ - -const contentDispositionPrefix = utf8Encode(`Content-Disposition: form-data; name="`); -const filenamePrefix = utf8Encode(`; filename="`); -const contentType = utf8Encode(`Content-Type: `); - -// https://andreubotella.github.io/multipart-form-data/#multipart-form-data-boundary -function generateBoundary() { - let boundary = "--------------------------"; - for (let i = 0; i < 24; ++i) { - boundary += Math.floor(Math.random() * 10).toString(16); - } - return utf8Encode(boundary); -} - -// https://andreubotella.github.io/multipart-form-data/#escape-a-multipart-form-data-name -function escapeName(name, isFilename = false) { - if (isFilename) { - name = conversions.USVString(name); - } else { - name = name.replace(/\r(?!\n)|(?<!\r)\n/g, "\r\n"); - } - - const encoded = utf8Encode(name); - const encodedWithSubs = []; - for (const originalByte of encoded) { - if (originalByte === 0x0A) { - encodedWithSubs.push(37, 48, 65); // `%0A` - } else if (originalByte === 0x0D) { - encodedWithSubs.push(37, 48, 68); // `%0D` - } else if (originalByte === 0x22) { - encodedWithSubs.push(37, 50, 50); // `%22` - } else { - encodedWithSubs.push(originalByte); - } - } - - return new Uint8Array(encodedWithSubs); -} - -// https://andreubotella.github.io/multipart-form-data/#multipart-form-data-chunk-serializer -exports.serializeEntryList = entries => { - const boundary = generateBoundary(); - const outputChunks = []; - - for (const entry of entries) { - const chunkBytes = [ - 45, 45, // `--` - ...boundary, - 0x0D, 0x0A - ]; - - chunkBytes.push(...contentDispositionPrefix, ...escapeName(entry.name), 0x22 /* `"` */); - - let { value } = entry; - if (typeof value === "string") { - chunkBytes.push(0x0D, 0x0A, 0x0D, 0x0A); - - value = value.replace(/\r(?!\n)|(?<!\r)\n/g, "\r\n"); - - chunkBytes.push(...utf8Encode(value)); - - chunkBytes.push(0x0D, 0x0A); - - outputChunks.push(new Uint8Array(chunkBytes)); - } else { - // value is a FileImpl object - - chunkBytes.push(...filenamePrefix, ...escapeName(value.name, true), 0x22, 0x0D, 0x0A); - - const type = value.type !== "" ? value.type : "application/octet-stream"; - chunkBytes.push(...contentType, ...utf8Encode(type)); - - chunkBytes.push(0x0D, 0x0A, 0x0D, 0x0A); - - outputChunks.push( - new Uint8Array(chunkBytes), - // The spec returns the File object here but for our purposes the bytes (as a `Uint8Array`) are more convenient. - value._bytes, - new Uint8Array([0x0D, 0x0A]) - ); - } - } - - outputChunks.push( - new Uint8Array([45, 45]), // `--` - boundary, - new Uint8Array([45, 45]), // `--` - new Uint8Array([0x0D, 0x0A]) - ); - - return { boundary, outputChunks }; -}; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js b/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js deleted file mode 100644 index 1f2672c..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -const { JSDOM } = require("../../../.."); -const idlUtils = require("../generated/utils"); - -const dom = new JSDOM(); -const xhr = new dom.window.XMLHttpRequest(); -const xhrImpl = idlUtils.implForWrapper(xhr); - -const chunks = []; - -process.stdin.on("data", chunk => { - chunks.push(chunk); -}); - -process.stdin.on("end", () => { - // eslint-disable-next-line no-restricted-globals -- We can't avoid receiving `Buffer`s from `process.stdin`. - const buffer = Buffer.concat(chunks); - - const config = JSON.parse(buffer.toString()); - xhrImpl._adoptSerializedRequest(config); - - function writeResultAndExit() { - process.stdout.write(JSON.stringify(xhrImpl._serializeResponse()), () => { - // Exit immediately. The process destruction will handle all connection cleanup. - process.exit(0); - }); - } - - try { - xhr.addEventListener("loadend", writeResultAndExit, false); - xhr.send(xhrImpl._body); - } catch (error) { - xhrImpl._error = error; - writeResultAndExit(); - } -}); diff --git a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js b/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js deleted file mode 100644 index 828d9ea..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js +++ /dev/null @@ -1,206 +0,0 @@ -"use strict"; -const { Readable } = require("stream"); -const { parseURL, serializeURL, serializeURLOrigin } = require("whatwg-url"); -const HeaderList = require("../fetch/header-list"); -const { isForbiddenResponseHeaderName, isNoCORSSafelistedRequestHeaderName } = require("../fetch/header-types"); - -const headerListSeparatorRegexp = /,[ \t]*/; -const simpleMethods = new Set(["GET", "HEAD", "POST"]); - -const corsSafeResponseHeaders = new Set([ - "cache-control", - "content-language", - "content-length", - "content-type", - "expires", - "last-modified", - "pragma" -]); - -/** - * A network error response. - */ -function makeNetworkError(error = null) { - return { type: "error", error }; -} - -/** - * Check if a response is a network error. - */ -function isNetworkError(response) { - return response && response.type === "error"; -} - -/** - * Performs a fetch operation for XHR with full CORS handling. - * Delegates redirect handling and CORS validation to the dispatcher. - * - * @param {JSDOMDispatcher} dispatcher - The dispatcher to use for sending the request - * @param {Object} config - Request configuration - * @param {AbortSignal} signal - Signal to abort the fetch - * @returns {Promise<Object>} The response object with filteredResponseHeaders, or a network error response - */ -async function performFetch(dispatcher, config, signal) { - const { - url, - method, - requestHeaders: userRequestHeaders, - body, - origin, - referrer, - withCredentials, - auth, - uploadListener - } = config; - - const urlRecord = parseURL(url); - const ucMethod = method.toUpperCase(); - - // Build request headers - start with user-set headers - // Default headers (User-Agent, Accept, etc.) are added by the dispatcher - const requestHeaders = userRequestHeaders.clone(); - - if (referrer) { - requestHeaders.set("Referer", referrer); - } - - const crossOrigin = origin !== serializeURLOrigin(urlRecord); - if (crossOrigin) { - requestHeaders.set("Origin", origin); - } - - // Compute if preflight is needed (but don't execute - dispatcher will) - const nonSimpleHeaders = []; - for (const name of userRequestHeaders.names()) { - if (!isNoCORSSafelistedRequestHeaderName(name)) { - nonSimpleHeaders.push(name); - } - } - const needsPreflight = crossOrigin && - (!simpleMethods.has(ucMethod) || nonSimpleHeaders.length > 0 || uploadListener); - - // Build opaque options for dispatcher - const opaque = { - element: null, - url, - origin, - corsMode: crossOrigin, // Enable CORS handling if cross-origin - withCredentials, - auth - }; - if (needsPreflight) { - opaque.preflight = { unsafeHeaders: nonSimpleHeaders }; - } - - // Single dispatch call - dispatcher handles preflight, redirects, CORS - const response = await dispatchMainRequest(dispatcher, { - method, - headers: requestHeaders, - body, - opaque - }, signal); - - if (isNetworkError(response)) { - return response; - } - - // Build filtered response headers (post-processing) - const filteredResponseHeaders = new Set(); - const { headers } = response; - - // Determine effective origin for filtering (from response URL after redirects) - const destUrlRecord = parseURL(response.url); - const isCrossOriginResponse = origin !== serializeURLOrigin(destUrlRecord) && destUrlRecord.scheme !== "data"; - - if (isCrossOriginResponse) { - // Filter headers not exposed by CORS - const acehStr = headers.get("access-control-expose-headers"); - const aceh = new Set(acehStr ? acehStr.trim().toLowerCase().split(headerListSeparatorRegexp) : []); - for (const [header] of headers) { - if (!corsSafeResponseHeaders.has(header) && !aceh.has(header) && !aceh.has("*")) { - filteredResponseHeaders.add(header); - } - } - } - - // Always filter forbidden response headers - for (const [header] of headers) { - if (isForbiddenResponseHeaderName(header)) { - filteredResponseHeaders.add(header); - } - } - - response.filteredResponseHeaders = filteredResponseHeaders; - return response; -} - -/** - * Helper to dispatch a request and return a Promise with the response. - * - * We use the callback-based dispatch() API instead of the simpler request() API because of - * WrapHandler's incorrect encoding of header values: https://github.com/nodejs/undici/issues/4797 - */ -function dispatchMainRequest(dispatcher, opts, signal) { - if (signal.aborted) { - return Promise.resolve(makeNetworkError()); - } - - return new Promise(resolve => { - let context, bodyStream, sendAbortToUndiciController; - - function onAbort() { - sendAbortToUndiciController?.(signal.reason); - bodyStream?.destroy(); - resolve(makeNetworkError()); - } - signal.addEventListener("abort", onAbort, { once: true }); - - dispatcher.dispatch(opts, { - onRequestStart(controller, ctx) { - context = ctx; - sendAbortToUndiciController = reason => controller.abort(reason); - if (signal.aborted) { - controller.abort(signal.reason); - } - }, - onResponseStart(controller, statusCode, headers, statusText) { - if (signal.aborted) { - return; - } - - // Prevent unhandled "error" events from `destroy()` calls. - bodyStream = new Readable({ read() {} }); - bodyStream.on("error", () => {}); - - // Get final URL from context (set by dispatcher after handling redirects) - const finalURL = serializeURL(context.finalURL); - - resolve({ - status: statusCode, - statusText: statusText || "", - headers: HeaderList.fromJSON(headers), - body: bodyStream, - url: finalURL - }); - }, - onResponseData(controller, chunk) { - if (signal.aborted) { - return; - } - bodyStream.push(chunk); - }, - onResponseEnd() { - signal.removeEventListener("abort", onAbort); - bodyStream?.push(null); - }, - onResponseError(controller, err) { - signal.removeEventListener("abort", onAbort); - bodyStream?.destroy(err); - resolve(makeNetworkError(err)); - } - }); - }); -} - -exports.performFetch = performFetch; -exports.isNetworkError = isNetworkError; diff --git a/vanilla/node_modules/jsdom/lib/jsdom/utils.js b/vanilla/node_modules/jsdom/lib/jsdom/utils.js deleted file mode 100644 index 43537ce..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/utils.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; -const { domSymbolTree } = require("./living/helpers/internal-constants"); -const SYMBOL_TREE_POSITION = require("symbol-tree").TreePosition; - -/** - * Define a set of properties on an object, by copying the property descriptors - * from the original object. - * - * - `object` {Object} the target object - * - `properties` {Object} the source from which to copy property descriptors - */ -exports.define = function define(object, properties) { - for (const name of Object.getOwnPropertyNames(properties)) { - const propDesc = Object.getOwnPropertyDescriptor(properties, name); - Object.defineProperty(object, name, propDesc); - } -}; - -exports.mixin = (target, source) => { - const keys = Reflect.ownKeys(source); - for (let i = 0; i < keys.length; ++i) { - if (keys[i] in target) { - continue; - } - - Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); - } -}; - -let memoizeQueryTypeCounter = 0; - -/** - * Returns a version of a method that memoizes specific types of calls on the object - * - * - `fn` {Function} the method to be memozied - */ -exports.memoizeQuery = function memoizeQuery(fn) { - // Only memoize query functions with arity <= 2 - if (fn.length > 2) { - return fn; - } - - const type = memoizeQueryTypeCounter++; - - return function (...args) { - if (!this._memoizedQueries) { - return fn.apply(this, args); - } - - if (!this._memoizedQueries[type]) { - this._memoizedQueries[type] = Object.create(null); - } - - let key; - if (args.length === 1 && typeof args[0] === "string") { - key = args[0]; - } else if (args.length === 2 && typeof args[0] === "string" && typeof args[1] === "string") { - key = args[0] + "::" + args[1]; - } else { - return fn.apply(this, args); - } - - if (!(key in this._memoizedQueries[type])) { - this._memoizedQueries[type][key] = fn.apply(this, args); - } - return this._memoizedQueries[type][key]; - }; -}; - -exports.simultaneousIterators = function* (first, second) { - for (;;) { - const firstResult = first.next(); - const secondResult = second.next(); - - if (firstResult.done && secondResult.done) { - return; - } - - yield [ - firstResult.done ? null : firstResult.value, - secondResult.done ? null : secondResult.value - ]; - } -}; - -exports.treeOrderSorter = function (a, b) { - const compare = domSymbolTree.compareTreePosition(a, b); - - if (compare & SYMBOL_TREE_POSITION.PRECEDING) { // b is preceding a - return 1; - } - - if (compare & SYMBOL_TREE_POSITION.FOLLOWING) { - return -1; - } - - // disconnected or equal: - return 0; -}; - -try { - exports.Canvas = require("canvas"); -} catch { - exports.Canvas = null; -} diff --git a/vanilla/node_modules/jsdom/lib/jsdom/virtual-console.js b/vanilla/node_modules/jsdom/lib/jsdom/virtual-console.js deleted file mode 100644 index f8cbd50..0000000 --- a/vanilla/node_modules/jsdom/lib/jsdom/virtual-console.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -const { EventEmitter } = require("events"); - -module.exports = class VirtualConsole extends EventEmitter { - constructor() { - super(); - - this.on("error", () => { - // If "error" event has no listeners, - // EventEmitter throws an exception - }); - } - - forwardTo(anyConsole, { jsdomErrors } = {}) { - for (const method of Object.keys(anyConsole)) { - if (typeof anyConsole[method] === "function") { - function onMethodCall(...args) { - anyConsole[method](...args); - } - this.on(method, onMethodCall); - } - } - - function forward(e) { - if (e.type === "unhandled-exception") { - anyConsole.error(e.cause.stack); - } else { - anyConsole.error(e.message); - } - } - - if (jsdomErrors === undefined) { - this.on("jsdomError", forward); - } else if (Array.isArray(jsdomErrors)) { - this.on("jsdomError", e => { - if (jsdomErrors.includes(e.type)) { - forward(e); - } - }); - } else if (jsdomErrors !== "none") { - throw new TypeError("Invalid jsdomErrors option"); - } - - return this; - } -}; |
